OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LocationKey.hpp
Go to the documentation of this file.
1 #ifndef __OPENTREP_LOCATIONKEY_HPP
2 #define __OPENTREP_LOCATIONKEY_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <iosfwd>
9 #include <string>
10 // OpenTrep
13 #include <opentrep/IATAType.hpp>
14 
15 namespace OPENTREP {
16 
21  struct LocationKey : public OPENTREP_Abstract {
22  public:
23  // //////////////// Getters ///////////////
27  const IATACode_T& getIataCode() const {
28  return _iataCode;
29  }
30 
34  const IATAType& getIataType() const {
35  return _iataType;
36  }
37 
41  const GeonamesID_T& getGeonamesID() const {
42  return _geonamesID;
43  }
44 
48  const IsGeonames_T& isGeonames() const {
49  return _isGeonames;
50  }
51 
52 
53  public:
54  // ////////////////// Setters /////////////////
58  void setIataCode (const std::string& iIataCode) {
59  _iataCode = IATACode_T (iIataCode);
60  }
61 
65  void setIataType (const IATAType& iIATAType) {
66  _iataType = iIATAType;
67  }
68 
72  void setGeonamesID (const GeonamesID_T& iGeonamesID) {
73  _geonamesID = iGeonamesID;
74  }
75 
80  _isGeonames = isGeonames;
81  }
82 
83 
84  public:
85  // ////////////// Display methods //////////////
91  void toStream (std::ostream&) const;
92 
98  void fromStream (std::istream&);
99 
103  std::string toString() const;
104 
109  std::string describe() const;
110 
111 
112  public:
113  // ////////////// Constructors and destructors //////////////
117  LocationKey (const IATACode_T&, const IATAType&, const GeonamesID_T&);
118 
122  LocationKey (const LocationKey&);
123 
127  ~LocationKey();
128 
132  bool operator== (const LocationKey&) const;
133 
137  bool operator!= (const LocationKey& iLocationKey) const {
138  return !(iLocationKey == *this);
139  }
140 
141  private:
145  LocationKey();
146 
147 
148  private:
149  // //////////////////// Attributes ///////////////////////
153  IATACode_T _iataCode;
154 
158  IATAType _iataType;
159 
163  GeonamesID_T _geonamesID;
164 
168  IsGeonames_T _isGeonames;
169  };
170 
171 }
172 #endif // __OPENTREP_LOCATIONKEY_HPP
Class modelling the primary key of a location/POR (point of reference).
Definition: LocationKey.hpp:21
void setIataCode(const std::string &iIataCode)
Definition: LocationKey.hpp:58
const IATAType & getIataType() const
Definition: LocationKey.hpp:34
bool operator!=(const LocationKey &iLocationKey) const
void setGeonamesID(const GeonamesID_T &iGeonamesID)
Definition: LocationKey.hpp:72
bool operator==(const LocationKey &) const
Definition: LocationKey.cpp:43
const GeonamesID_T & getGeonamesID() const
Definition: LocationKey.hpp:41
void toStream(std::ostream &) const
Definition: LocationKey.cpp:67
std::string describe() const
Definition: LocationKey.cpp:51
const IsGeonames_T & isGeonames() const
Definition: LocationKey.hpp:48
void fromStream(std::istream &)
Definition: LocationKey.cpp:72
Enumeration of output types.
Definition: IATAType.hpp:22
void setIataType(const IATAType &iIATAType)
Definition: LocationKey.hpp:65
const IATACode_T & getIataCode() const
Definition: LocationKey.hpp:27
void setIsGeonames(const IsGeonames_T &isGeonames)
Definition: LocationKey.hpp:79
std::string toString() const
Definition: LocationKey.cpp:60