openModeller  Version 1.5.0
OccurrencesFactory.hh
Go to the documentation of this file.
1 
29 #ifndef _OCCURRENCES_FACTORY_HH_
30 #define _OCCURRENCES_FACTORY_HH_
31 
35 
36 #ifdef TERRALIB_FOUND
38 #endif
39 
40 #ifdef CURL_FOUND
43 #endif
44 
45 #include <string>
46 using std::string;
47 
48 #include <map>
49 using std::map;
50 
51 #include <vector>
52 using std::vector;
53 
57 class dllexp OccurrencesFactory
58 {
59 
60 private:
61 
62  // Function pointer to builder function.
63  typedef OccurrencesReader * (*CreateOccurrencesReaderCallback)( const char * source, const char * coordSystem );
64 
65  // Map of OccurrencesReader and identifiers.
66  typedef map<string, CreateOccurrencesReaderCallback> DriversMap;
67 
68 public:
69 
72  static OccurrencesFactory& instance();
73 
79  bool registerDriver( const string& driverId, CreateOccurrencesReaderCallback builder );
80 
85  bool unregisterDriver( const string& driverId );
86 
90  vector<string> getRegisteredDrivers();
91 
97  OccurrencesReader * create( const char * source, const char * coordSystem );
98 
99 private:
100 
101  // Indicates if the factory was initiated (i.e., drivers were registered).
102  static bool _initiated;
103 
104  // Map of OccurrencesReader and identifiers.
106 
107  // No constructor allowed (singleton pattern).
109 
110  // No copy allowed.
112 
113  // No copy allowed.
114  OccurrencesFactory& operator=( const OccurrencesFactory& );
115 
116  // No destructor allowed.
118 };
119 
120 #endif
map< string, CreateOccurrencesReaderCallback > DriversMap