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
DataService.hpp
1 // Copyright © 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_GIS_DATA_DATASERVICE_HPP_INCLUDED
5 #define FIRE_GIS_DATA_DATASERVICE_HPP_INCLUDED
6 
7 #include <boost/thread/mutex.hpp>
8 
9 #include <map>
10 #include <string>
11 #include <vector>
12 #include <exception>
13 
14 #include "fire/gis/export.hpp"
15 #include "fire/source/shared/ConnectionSh.hpp"
16 #include "fire/source/vector/shared/ConnectionVectorSh.hpp"
17 #include "fire/source/raster/shared/ConnectionRasterSh.hpp"
18 #include "fire/gis/data/ConnectionPool.hpp"
19 
20 namespace fire {
21 namespace gis {
22 namespace data {
23 
27 class FIRE_GIS_DLL DataService {
28  public:
32  DataService();
33 
37  ~DataService();
38 
44  bool exists(const std::string& id) const;
45 
53  std::string create(const std::string & cnnNmsp, const source::Connection::ConnectionParams& params, const int& num, const std::string& id = "");
54 
59  void erase(const std::string& id);
60 
66  source::Connection::ConnectionShp get(const std::string& id);
67 
73  source::vector::ConnectionVector::ConnectionVectorShp getVector(const std::string& id);
74 
80  source::raster::ConnectionRaster::ConnectionRasterShp getRaster(const std::string& id);
81 
87  static bool existsPool(const std::string& id);
88 
96  static std::string createPool(const std::string & cnnNmsp, const source::Connection::ConnectionParams& params, const int& num, const std::string& id = "");
97 
102  static void erasePool(const std::string& id);
103 
109  static source::Connection::ConnectionShp getConnection(const std::string& id);
110 
116  static source::raster::ConnectionRaster::ConnectionRasterShp getConnectionRaster(const std::string& id);
117 
123  static source::vector::ConnectionVector::ConnectionVectorShp getConnectionVector(const std::string& id);
124 
125  private:
126  typedef boost::shared_ptr< ConnectionPool > ConnectionPoolShp;
127  typedef std::map< std::string, ConnectionPoolShp > MapConnectionPool;
128  typedef std::vector< std::string > VctPoolId;
129 
130  void _erase(VctPoolId const & ids);
131 
132  static DataService _instance;
133  static boost::mutex _stMtx;
134 
135  MapConnectionPool _pools;
136  mutable boost::mutex _mtx;
137 };
138 
139 } // namespace data
140 } // namespace gis
141 } // namespace fire
142 
143 #endif
Definition: ConnectionRasterSh.hpp:22
Contenitore di tutti i fire::gis::data::ConnectionPool usati nella sessione di lavoro.
Definition: DataService.hpp:27
Definition: ConnectionSh.hpp:21
Definition: ConnectionVectorSh.hpp:21