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
ConnectionSh.hpp
1 // Copyright © 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_PLUGIN_DATA_SHARED_CONNECTIONSH_HPP_INCLUDED
5 #define FIRE_PLUGIN_DATA_SHARED_CONNECTIONSH_HPP_INCLUDED
6 
7 #include <boost/shared_ptr.hpp>
8 #include <fire/shared/Shared.hpp>
9 #include <fire/exception/Exception.hpp>
10 
11 #include <string>
12 #include <exception>
13 
14 #include "fire/gis/export.hpp"
15 #include "fire/source/Connection.hpp"
16 
17 namespace fire {
18 namespace source {
19 namespace shared {
20 
21 class FIRE_GIS_DLL ConnectionSh: public fire::shared::Shared< Connection > {
22  public:
23  explicit ConnectionSh(Connection* ptr): Shared(ptr) {
24  }
25 
26  ConnectionSh(ConnectionSh const & c) {
27  this->operator =(c);
28  }
29 
30  inline void setId(const std::string& pool, const std::string& id) {
31  _getPtr()->setId(pool, id);
32  }
33 
34  inline std::string getId() const {
35  return _getPtr()->getId();
36  }
37 
38  inline std::string getInstanceId() const {
39  return _getPtr()->getInstanceId();
40  }
41 
42  inline std::string getPoolId() const {
43  return _getPtr()->getPoolId();
44  }
45 
46  inline Connection::ConnectionParams const & getConnectionString() const {
47  return _getPtr()->getConnectionString();
48  }
49 
50  inline virtual void open() {
51  _getPtr()->open();
52  }
53 
54  inline void open(Connection::ConnectionParams const & cnnStr) {
55  _getPtr()->open(cnnStr);
56  }
57 
58  inline virtual bool isEmpty() const {
59  return _getPtr() == NULL;
60  }
61 
62  inline bool isOpen() const {
63  return _getPtr()->isOpen();
64  }
65 
66  inline virtual bool isValid() const {
67  return (_getPtr()->isValid());
68  }
69  inline virtual void close() {
70  _getPtr()->close();
71  }
72 
73  inline virtual ConnectionType::ConnectionType getType() const {
74  return ConnectionType::UNKNOWN;
75  }
76 
77  inline virtual Features const getFeatures() const {
78  return _getPtr()->getFeatures();
79  }
80 
81  inline virtual Connection::LayerList getLayers() const {
82  return _getPtr()->getLayers();
83  }
84 
85  inline virtual std::string getNamespace() const {
86  return _getPtr()->getNamespace();
87  }
88 
89  private:
90  inline Connection* _getPtr() {
91  Connection* ret = dynamic_cast< Connection* >(_ptr.get());
92  if (NULL == ret)
93  throw fire::exception::Exception("Invalid Connection pointer");
94 
95  return ret;
96  }
97 
98  inline const Connection* _getPtr() const {
99  const Connection* ret = dynamic_cast< const Connection* >(_ptr.get());
100  if (NULL == ret)
101  throw fire::exception::Exception("Invalid Connection pointer");
102 
103  return ret;
104  }
105 };
106 
107 } // namespace shared
108 } // namespace source
109 } // namespace fire
110 
111 #endif
Oggetto che consente di verificare la presenza di specifiche funzionalità sull'implementazione di una...
Definition: Features.hpp:21
Classe astratta che implementa l'interfaccia di base di una sorgente dati sia vettoriale che raster...
Definition: Connection.hpp:31
Classe per la gestione di un'eccezione generica.
Definition: Exception.hpp:26
Definition: Shared.hpp:17
Definition: ConnectionSh.hpp:21