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
Metadata.hpp
1 // Copyright 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_SOURCE_VECTOR_METADATA_HPP_INCLUDED
5 #define FIRE_SOURCE_VECTOR_METADATA_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/vector/Field.hpp"
16 #include "fire/source/vector/shared/FieldSh.hpp"
17 
18 namespace fire {
19 namespace source {
20 namespace vector {
21 
22 namespace shared {
23 class MetadataSh;
24 } // namespace shared
25 
29 class FIRE_GIS_DLL Metadata {
30  public:
32  typedef std::vector< std::string > VctFldName;
33 
34  public:
38  Metadata();
39 
46  Metadata(const std::string& db, const std::string& schema, const std::string& tbl);
47 
52  Metadata(const Metadata& mtd);
53 
57  virtual ~Metadata();
58 
65  bool operator!=(Metadata const & r) const;
66 
73  bool operator==(Metadata const & r) const;
80  bool isEqualsStricted(Metadata const & r) const;
81 
86  void add(Field::FieldShp const & fld);
92  Field::FieldShp del(const std::string& name);
93 
99  Field::FieldShp del(const size_t &idx);
100 
105  size_t getCount() const;
106 
112  int nameToIndex(const std::string& name) const;
113 
119  std::string indexToName(const size_t &idx) const;
120 
125  void getKeyColumns(VctFldName & list) const;
126 
131  void getGeometryColumns(VctFldName & list) const;
132 
138  Field::FieldShp get(std::string const & name);
139  Field::FieldShp const get(std::string const & name) const;
140 
146  Field::FieldShp get(size_t const & idx);
147  Field::FieldShp const get(size_t const & idx) const;
148 
155  void getSource(std::string& db, std::string& schema, std::string& tbl) const;
156 
163  void setSource(std::string const & db, std::string const & schema, std::string const & tbl);
164 
165  private:
166  Metadata& operator=(const Metadata& source);
167 
168  bool _isEquals(Metadata const & r, bool const & strict) const;
169  size_t _name2IndexNoWait(const std::string& name) const;
170  std::string _index2NameNoWait(const size_t& index) const;
171  void _validateIndexNoWait(const size_t& idx) const;
172  bool _isValidIndexNoWait(const size_t& idx) const;
173  Field::FieldShp _del(const size_t &idx, std::string const & name);
174 
175  typedef std::map< std::string, Field::FieldShp > MapField;
176  typedef std::vector< Field::FieldShp > VctField;
177 
178  std::string _db;
179  std::string _tbl;
180  std::string _schema;
181  VctField _fields;
182  MapField _mapFields;
183 
184  mutable boost::mutex _mtx;
185 };
186 } // namespace vector
187 } // namespace source
188 } // namespace fire
189 
190 #endif
Definition: FieldSh.hpp:21
Definition: MetadataSh.hpp:22
Definisce la struttura di un contenitore di dati vettoriali. Permette di sapere quante colonne compon...
Definition: Metadata.hpp:29