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
ConnectionRasterSh.hpp
1 // Copyright © 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_PLUGIN_DATA_SHARED_CONNECTIONRASTERSH_HPP_INCLUDED
5 #define FIRE_PLUGIN_DATA_SHARED_CONNECTIONRASTERSH_HPP_INCLUDED
6 
7 #include <fire/exception/Exception.hpp>
8 
9 #include <string>
10 #include <exception>
11 
12 #include "fire/gis/export.hpp"
13 #include "fire/source/shared/ConnectionSh.hpp"
14 #include "fire/source/raster/ConnectionRaster.hpp"
15 #include "fire/source/raster/shared/LayerRasterSh.hpp"
16 
17 namespace fire {
18 namespace source {
19 namespace raster {
20 namespace shared {
21 
22 class FIRE_GIS_DLL ConnectionRasterSh : public source::shared::ConnectionSh {
23  public:
24  explicit ConnectionRasterSh(ConnectionRaster* ptr = NULL): ConnectionSh(ptr) {
25  if (NULL == ptr) {
26  ptr = new ConnectionRaster();
27  }
28 
29  _ptr.reset(ptr);
30  }
31 
32  ConnectionRasterSh(ConnectionRasterSh const & c): ConnectionSh(c) {
33  }
34 
35  explicit ConnectionRasterSh(ConnectionSh const & c): ConnectionSh(c) {
36  }
37 
38  inline source::raster::LayerRaster::LayerRasterShp getLayer(const std::string& name) const {
39  return _getPtr()->getLayer(name);
40  }
41 
42  inline source::raster::LayerRaster::LayerRasterShp getLayer(const std::string& name, const std::string& driver) const {
43  return _getPtr()->getLayer(name, driver);
44  }
45 
46  inline void getRasterDrivers(const std::string& name, ConnectionRaster::VctDrivers& list) const {
47  _getPtr()->getRasterDrivers(name, list);
48  }
49 
50  inline void getRasterDrivers(const DriverType::DriverType& dt, ConnectionRaster::VctDrivers& list) const {
51  _getPtr()->getRasterDrivers(dt, list);
52  }
53 
54  private:
55  inline ConnectionRaster* _getPtr() {
56  ConnectionRaster* ret = dynamic_cast< ConnectionRaster* >(_ptr.get());
57  if (NULL == ret)
58  throw fire::exception::Exception("Invalid ConnectionRaster pointer");
59 
60  return ret;
61  }
62 
63  inline const ConnectionRaster* _getPtr() const {
64  const ConnectionRaster* ret = dynamic_cast< const ConnectionRaster* >(_ptr.get());
65  if (NULL == ret)
66  throw fire::exception::Exception("Invalid ConnectionSpatialDb pointer");
67 
68  return ret;
69  }
70 };
71 } // namespace shared
72 } // namespace raster
73 } // namespace source
74 } // namespace fire
75 
76 #endif
Definition: ConnectionRasterSh.hpp:22
Classe per la gestione di un'eccezione generica.
Definition: Exception.hpp:26
Definition: LayerRasterSh.hpp:18
Definition: ConnectionRaster.hpp:30
Definition: ConnectionSh.hpp:21