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
FieldSh.hpp
1 // Copyright © 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_PLUGIN_DATA_SHARED_FIELDSH_HPP_INCLUDED
5 #define FIRE_PLUGIN_DATA_SHARED_FIELDSH_HPP_INCLUDED
6 
7 #include <boost/shared_ptr.hpp>
8 #include <fire/shared/Shared.hpp>
9 
10 #include <string>
11 #include <exception>
12 
13 #include "fire/gis/export.hpp"
14 #include "fire/source/vector/Field.hpp"
15 
16 namespace fire {
17 namespace source {
18 namespace vector {
19 namespace shared {
20 
21 class FIRE_GIS_DLL FieldSh: public fire::shared::Shared< Field > {
22  public:
23  FieldSh(): Shared(NULL) {
24  }
25 
26  explicit FieldSh(Field* ptr): Shared(ptr) {
27  }
28 
29  explicit FieldSh(Field const & fld): Shared(NULL) {
30  Field* fldPtr = new Field(fld);
31  _ptr.reset(fldPtr);
32  }
33 
34  explicit FieldSh(const std::string & name, const FieldType::FieldType & type, const bool & nullable, const bool & isKeyPart, const int & nativeType = -1): Shared(NULL) {
35  Field* fldPtr = new Field(name, type, nullable, isKeyPart, nativeType);
36  _ptr.reset(fldPtr);
37  }
38 
39  FieldSh(FieldSh const & c) {
40  this->operator =(c);
41  }
42 
43  inline FieldSh clone() const {
44  Field* fld = new Field(*_getPtr());
45  FieldSh ret(fld);
46  return ret;
47  }
48 
49  inline bool isEqualsStricted(FieldSh const & r) const {
50  return _getPtr()->isEqualsStricted(r);
51  }
52 
53  inline bool operator!=(FieldSh const & r) const {
54  return !(this->operator ==(r));
55  }
56 
57  inline bool operator==(FieldSh const & r) const {
58  if (!r)
59  return false;
60 
61  if (Shared::operator ==(r))
62  return true;
63 
64  const Field& lFld = *this;
65  const Field& rFld = r;
66  return lFld == rFld;
67  }
68 
69  inline std::string getName() const {
70  return _getPtr()->getName();
71  }
72 
73  inline FieldType::FieldType getType() const {
74  return _getPtr()->getType();
75  }
76 
77  inline int getNativeType() const {
78  return _getPtr()->getNativeType();
79  }
80 
81  inline bool isNullable() const {
82  return _getPtr()->isNullable();
83  }
84 
85  inline bool isKeyPart() const {
86  return _getPtr()->isKeyPart();
87  }
88 
89  inline void setName(std::string const & name) {
90  _getPtr()->setName(name);
91  }
92 
93  inline void setType(FieldType::FieldType const & ft) {
94  _getPtr()->setType(ft);
95  }
96 
97  inline void setNullable(bool const & nullable) {
98  _getPtr()->setNullable(nullable);
99  }
100 
101  inline void setKeyPart(bool const & keypart) {
102  _getPtr()->setKeyPart(keypart);
103  }
104 
105  inline void addExtraParam(Field::ExtraParamFieldType id, const int& val) {
106  _getPtr()->addExtraParam(id, val);
107  }
108 
109  inline const int getExtraParam(const Field::ExtraParamFieldType id) const {
110  return _getPtr()->getExtraParam(id);
111  }
112 
113  inline bool existsExtraParam(const Field::ExtraParamFieldType id) const {
114  return _getPtr()->existsExtraParam(id);
115  }
116 };
117 
118 } // namespace shared
119 } // namespace vector
120 } // namespace source
121 } // namespace fire
122 
123 #endif
Definition: Field.hpp:30
Definition: FieldSh.hpp:21
std::string getName() const
Restituisce il nome del campo.
Definition: Shared.hpp:17
ExtraParamFieldType
Chiavi dei parametri descrittivi extra impostabili sul Field.
Definition: Field.hpp:35