00001 // This is core/vil1/vil1_file_format.cxx 00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00003 #pragma implementation 00004 #endif 00005 00006 #include "vil1_file_format.h" 00007 00008 vil1_file_format::~vil1_file_format() 00009 { 00010 } 00011 00012 #define HAS_PNM 1 00013 #define HAS_VIFF 1 00014 #define HAS_IRIS 1 00015 #define HAS_MIT 1 00016 #define HAS_BMP 1 00017 #define HAS_GIF 1 00018 // These will be defined "outside" if there really is a JPEG (PNG, TIFF) library 00019 // #define HAS_JPEG 00020 // #define HAS_PNG 00021 // #define HAS_TIFF 00022 #define HAS_RAS 1 00023 #define HAS_GEN 1 00024 00025 #if HAS_PNM 00026 #include <vil1/file_formats/vil1_pnm.h> 00027 #endif 00028 00029 #if HAS_IRIS 00030 #include <vil1/file_formats/vil1_iris.h> 00031 #endif 00032 00033 #if HAS_MIT 00034 #include <vil1/file_formats/vil1_mit.h> 00035 #endif 00036 00037 #if HAS_VIFF 00038 #include <vil1/file_formats/vil1_viff.h> 00039 #endif 00040 00041 #if HAS_PNG 00042 #include <vil1/file_formats/vil1_png.h> 00043 #endif 00044 00045 #if HAS_JPEG 00046 #include <vil1/file_formats/vil1_jpeg.h> 00047 #endif 00048 00049 #if HAS_TIFF 00050 #include <vil1/file_formats/vil1_tiff.h> 00051 #endif 00052 00053 #if HAS_BMP 00054 #include <vil1/file_formats/vil1_bmp.h> 00055 #endif 00056 00057 #if HAS_GIF 00058 #include <vil1/file_formats/vil1_gif.h> 00059 #endif 00060 00061 #if HAS_RAS 00062 #include <vil1/file_formats/vil1_ras.h> 00063 #endif 00064 00065 #if HAS_GEN 00066 #include <vil1/file_formats/vil1_gen.h> 00067 #endif 00068 00069 00070 static vil1_file_format** storage = 0; 00071 vil1_file_format** vil1_file_format::all() 00072 { 00073 if (storage == 0) 00074 { 00075 storage = new vil1_file_format*[256]; 00076 int c = 0; 00077 00078 #if HAS_JPEG 00079 storage[c++] = new vil1_jpeg_file_format; 00080 #endif 00081 #if HAS_PNG 00082 storage[c++] = new vil1_png_file_format; 00083 #endif 00084 #if HAS_TIFF 00085 storage[c++] = new vil1_tiff_file_format; 00086 #endif 00087 #if HAS_PNM 00088 storage[c++] = new vil1_pnm_file_format; 00089 #endif 00090 #if HAS_IRIS 00091 storage[c++] = new vil1_iris_file_format; 00092 #endif 00093 #if HAS_MIT 00094 storage[c++] = new vil1_mit_file_format; 00095 #endif 00096 #if HAS_VIFF 00097 storage[c++] = new vil1_viff_file_format; 00098 #endif 00099 #if HAS_BMP 00100 storage[c++] = new vil1_bmp_file_format; 00101 #endif 00102 #if HAS_GIF 00103 storage[c++] = new vil1_gif_file_format; 00104 #endif 00105 #if HAS_RAS 00106 storage[c++] = new vil1_ras_file_format; 00107 #endif 00108 #if HAS_GEN 00109 storage[c++] = new vil1_gen_file_format; 00110 #endif 00111 00112 storage[c] = 0; 00113 } 00114 return storage; 00115 } 00116 00117 class vil1_file_format_list_destroyer 00118 { 00119 public: 00120 ~vil1_file_format_list_destroyer() 00121 { 00122 if (storage==0) return; 00123 unsigned i=0; 00124 while (storage[i]) 00125 delete storage[i++]; 00126 delete [] storage; 00127 } 00128 }; 00129 00130 static vil1_file_format_list_destroyer destroyer_obj;
1.5.1