Fire Core  8.0.0.alpha
GIS framework per tutti gli usi
 Tutto Classi Namespace Funzioni Variabili Ridefinizioni di tipo (typedef) Tipi enumerati (enum) Valori del tipo enumerato Friend
PluginItemFactory.hpp
1 // Copyright 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_DATA_PLUGINITEMFACTORY_HPP_INCLUDED
5 #define FIRE_DATA_PLUGINITEMFACTORY_HPP_INCLUDED
6 
7 #include <QtCore/QLibrary>
8 #include <boost/filesystem.hpp>
9 
10 #include <map>
11 #include <string>
12 #include <vector>
13 #include <exception>
14 
15 #include "fire/graphics/Painter.hpp"
16 #include "fire/source/PluginInfo.hpp"
17 #include "fire/source/raster/DriverType.hpp"
18 #include "fire/source/raster/shared/LayerRasterSh.hpp"
19 #include "fire/source/vector/shared/ConnectionVectorSh.hpp"
20 #include "fire/source/vector/shared/ConnectionSpatialDbSh.hpp"
21 
22 // OCI forward references
23 typedef struct OCIEnv OCIEnv;
24 typedef struct OCISvcCtx OCISvcCtx;
25 
26 namespace fire {
27 namespace gis {
28 namespace data {
32 class FIRE_GIS_DLL PluginItemFactory {
33  public:
37  typedef std::vector< std::string > PluginNamespaceList;
38 
42  typedef std::vector< std::string > RasterManagerList;
43 
48  static PluginItemFactory& getInstance();
49 
54 
61  source::vector::ConnectionVector::ConnectionVectorShp createConnectionVector(std::string const & nmsp);
62 
68  graphics::Painter::PainterShp createPainter(std::string const & nmsp);
69 
75  source::PluginInfo::PluginInfoShp getPluginInfo(std::string const & nmsp);
76 
81  PluginNamespaceList getPluginList();
82 
87  void setPath(std::string const & paths);
88 
93  std::string getPath();
94 
100  void getRasterNamespaces(const source::raster::DriverType::DriverType & type, RasterManagerList & list);
101 
108  source::raster::LayerRaster::LayerRasterShp getLayerRaster(const std::string & name, const std::string & driverName);
109 
115  source::vector::ConnectionVector::ConnectionVectorShp createOciConnectionById(int connectionId);
116 
123  source::vector::ConnectionVector::ConnectionVectorShp createOciConnection(OCIEnv* env, OCISvcCtx* ctx);
124 
125  private:
126  typedef boost::shared_ptr< QLibrary > SharedLibShp;
127  typedef std::map< std::string, SharedLibShp > PluginMap;
128  typedef void * (*startedHandler)();
129  typedef source::PluginInfo * (*infoHandler)();
130  typedef graphics::Painter * (*createPntHandler)(std::string const & nmsp);
131  typedef source::vector::ConnectionVector* (*createCnnHandler)(std::string const & nmsp);
132  typedef source::raster::LayerRaster* (*getLayerRasterHandler)(const std::string& layer, const std::string& driverManager);
133  typedef void* (*getRasterNmspsHandler)(const source::raster::DriverType::DriverType & type, std::vector< std::string > & list);
134 
135  static const std::string _INFO_HANDLER_NAME;
136  static const std::string _STARTED_HANDLER_NAME;
137  static const std::string _BUILDCNNVCT_HANDLER_NAME;
138  static const std::string _BUILDPNT_HANDLER_NAME;
139  static const std::string _GETRSTNMSPS_HANDLER_NAME;
140  static const std::string _GETLAYRST_HANDLER_NAME;
141  static const std::string _PATHS_SEPARATOR;
142  static const std::string _DLL_FILE_PATTERN;
143  static std::string _SEARCH_PATH;
144 
145  static PluginItemFactory _instance;
146 
147  void _loadPlugins();
148  SharedLibShp _getLibrary(std::string const & nmsp);
149  void * _getHandler(std::string const & nmsp, std::string const & entry);
150  void * _getHandler(SharedLibShp const &lib, std::string const & entry);
151  infoHandler _getInfoHandler(std::string const & nmsp);
152  infoHandler _getInfoHandler(SharedLibShp const & lib);
153  startedHandler _getStartedHandler(std::string const & nmsp);
154  startedHandler _getStartedHandler(SharedLibShp const & lib);
155  createCnnHandler _getCreateCnnHandler(std::string const & nmsp);
156  createCnnHandler _getCreateCnnHandler(SharedLibShp const & lib);
157  createPntHandler _getCreatePntHandler(std::string const & nmsp);
158  createPntHandler _getCreatePntHandler(SharedLibShp const & lib);
159  getRasterNmspsHandler _getGetRasterNamespacesHandler(std::string const & nmsp);
160  getRasterNmspsHandler _getGetRasterNamespacesHandler(SharedLibShp const & lib);
161  getLayerRasterHandler _getGetLayerRastertHandler(std::string const & nmsp);
162  getLayerRasterHandler _getGetLayerRastertHandler(SharedLibShp const & lib);
163  source::vector::ConnectionVector::ConnectionVectorShp _createConnection(std::string const & libNmsp, std::string const & nmsp);
164  graphics::Painter::PainterShp _createPainter(std::string const & libNmsp, std::string const & nmsp);
165  boost::filesystem::path _getBinaryPath();
166  void _findPlugin(boost::filesystem::path const & p);
167  bool _verifyLib(SharedLibShp const & lib);
168 
169  boost::mutex _mtx;
170  PluginMap _plugins;
171 };
172 
173 } // namespace data
174 } // namespace gis
175 } // namespace fire
176 
177 #endif
Specializzazione di una connessione per sorgenti dati vettoriali.
Definition: ConnectionVector.hpp:30
std::vector< std::string > RasterManagerList
typedef che descrive il tipo usato per restituire una lista di ManagerRaster
Definition: PluginItemFactory.hpp:42
Definition: LayerRaster.hpp:26
std::vector< std::string > PluginNamespaceList
typedef che descrive il tipo usato per restituire una lista di plugin
Definition: PluginItemFactory.hpp:37
Definition: LayerRasterSh.hpp:18
Informazioni sul plugin attivo.
Definition: PluginInfo.hpp:19
boost::shared_ptr< PluginInfo > PluginInfoShp
Definizione di puntatore condiviso a PluginInfo.
Definition: PluginInfo.hpp:24
Definition: Painter.hpp:33
Oggetto statico deputato al reperimento di connessioni dati e disegnatori personalizzati per gli elem...
Definition: PluginItemFactory.hpp:32
Definition: ConnectionVectorSh.hpp:21