openModeller
Version 1.4.0
|
00001 00029 #ifndef _RASTER_FACTORYHH_ 00030 #define _RASTER_FACTORYHH_ 00031 00032 #include <openmodeller/env_io/Raster.hh> 00033 #include <openmodeller/env_io/GdalRaster.hh> 00034 #include <openmodeller/env_io/WcsProxyRaster.hh> 00035 #include <openmodeller/env_io/RemoteRaster.hh> 00036 00037 #ifdef TERRALIB_FOUND 00038 #include <openmodeller/env_io/TerralibRaster.hh> 00039 #endif 00040 00041 #include <string> 00042 using std::string; 00043 00044 #include <map> 00045 using std::map; 00046 00047 class MapFormat; 00048 00050 00056 class dllexp RasterFactory 00057 { 00058 00059 private: 00060 00061 // Function pointer to builder function. 00062 typedef Raster* (*CreateRasterCallback)(); 00063 00064 // Map of Rasters and identifiers. 00065 typedef std::map<string, CreateRasterCallback> DriversMap; 00066 00067 public: 00068 00072 static RasterFactory& instance(); 00073 00078 bool registerDriver( const string& driverId, CreateRasterCallback builder ); 00079 00081 bool unregisterDriver( const string& driverId ); 00082 00086 Raster* create( const string& source, int categ = 0 ); 00087 00091 #ifdef MPI_FOUND 00092 Raster* create( const string& output_file_source, const string& source, const MapFormat& format ); 00093 #else 00094 Raster* create( const string& source, const MapFormat& format ); 00095 #endif 00096 00097 private: 00098 00099 // Indicates if the factory was initiated (i.e., drivers were registered). 00100 static bool _initiated; 00101 00103 DriversMap _drivers; 00104 00105 // No constructor allowed (singleton pattern). 00106 RasterFactory(){}; 00107 00109 RasterFactory( const RasterFactory& ); 00110 00112 RasterFactory& operator=( const RasterFactory& ); 00113 00115 ~RasterFactory(){}; 00116 }; 00117 00118 #endif 00119