OpenTREP Logo  0.07.4
C++ Open Travel Request Parsing Library
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 
29  struct LocationKey : public OPENTREP_Abstract {
30  public:
31  // //////////////// Getters ///////////////
35  const IATACode_T& getIataCode() const {
36  return _iataCode;
37  }
38 
42  const IATAType& getIataType() const {
43  return _iataType;
44  }
45 
49  const GeonamesID_T& getGeonamesID() const {
50  return _geonamesID;
51  }
52 
56  const IsGeonames_T& isGeonames() const {
57  return _isGeonames;
58  }
59 
60 
61  public:
62  // ////////////////// Setters /////////////////
66  void setIataCode (const std::string& iIataCode) {
67  _iataCode = IATACode_T (iIataCode);
68  }
69 
73  void setIataType (const IATAType& iIATAType) {
74  _iataType = iIATAType;
75  }
76 
80  void setGeonamesID (const GeonamesID_T& iGeonamesID) {
81  _geonamesID = iGeonamesID;
82  }
83 
88  _isGeonames = isGeonames;
89  }
90 
91 
92  public:
93  // ////////////// Display methods //////////////
99  void toStream (std::ostream&) const;
100 
106  void fromStream (std::istream&);
107 
111  std::string toString() const;
112 
117  std::string describe() const;
118 
119 
120  public:
121  // ////////////// Constructors and destructors //////////////
125  LocationKey (const IATACode_T&, const IATAType&, const GeonamesID_T&);
126 
130  LocationKey (const LocationKey&);
131 
135  ~LocationKey();
136 
140  bool operator== (const LocationKey&) const;
141 
145  bool operator!= (const LocationKey& iLocationKey) const {
146  return !(iLocationKey == *this);
147  }
148 
149  private:
153  LocationKey();
154 
155 
156  private:
157  // //////////////////// Attributes ///////////////////////
163  IATACode_T _iataCode;
164 
170  IATAType _iataType;
171 
177  GeonamesID_T _geonamesID;
178 
182  IsGeonames_T _isGeonames;
183  };
184 
185 }
186 #endif // __OPENTREP_LOCATIONKEY_HPP
OPENTREP::LocationKey::getGeonamesID
const GeonamesID_T & getGeonamesID() const
Definition: LocationKey.hpp:49
OPENTREP::LocationKey::setGeonamesID
void setGeonamesID(const GeonamesID_T &iGeonamesID)
Definition: LocationKey.hpp:80
OPENTREP::LocationKey::getIataCode
const IATACode_T & getIataCode() const
Definition: LocationKey.hpp:35
OPENTREP::LocationKey::operator==
bool operator==(const LocationKey &) const
Definition: LocationKey.cpp:43
OPENTREP::LocationKey::operator!=
bool operator!=(const LocationKey &iLocationKey) const
Definition: LocationKey.hpp:145
OPENTREP::IATACode_T
Definition: OPENTREP_Types.hpp:154
OPENTREP::LocationKey::fromStream
void fromStream(std::istream &)
Definition: LocationKey.cpp:72
OPENTREP::LocationKey::~LocationKey
~LocationKey()
Definition: LocationKey.cpp:39
IATAType.hpp
OPENTREP::LocationKey::setIataType
void setIataType(const IATAType &iIATAType)
Definition: LocationKey.hpp:73
OPENTREP::LocationKey::setIataCode
void setIataCode(const std::string &iIataCode)
Definition: LocationKey.hpp:66
OPENTREP::LocationKey::isGeonames
const IsGeonames_T & isGeonames() const
Definition: LocationKey.hpp:56
OPENTREP
Definition: BasChronometer.cpp:10
OPENTREP::OPENTREP_Abstract
Definition: OPENTREP_Abstract.hpp:16
OPENTREP::LocationKey::describe
std::string describe() const
Definition: LocationKey.cpp:51
OPENTREP_Abstract.hpp
OPENTREP::LocationKey::setIsGeonames
void setIsGeonames(const IsGeonames_T &isGeonames)
Definition: LocationKey.hpp:87
OPENTREP::LocationKey
Class modelling the primary key of a location/POR (point of reference).
Definition: LocationKey.hpp:29
OPENTREP::IsGeonames_T
bool IsGeonames_T
Definition: OPENTREP_Types.hpp:635
OPENTREP::IATAType
Enumeration of place/location types with respect to their use for transportation purposes.
Definition: IATAType.hpp:42
OPENTREP::LocationKey::toString
std::string toString() const
Definition: LocationKey.cpp:60
OPENTREP::LocationKey::getIataType
const IATAType & getIataType() const
Definition: LocationKey.hpp:42
OPENTREP_Types.hpp
OPENTREP::GeonamesID_T
unsigned int GeonamesID_T
Definition: OPENTREP_Types.hpp:182
OPENTREP::LocationKey::toStream
void toStream(std::ostream &) const
Definition: LocationKey.cpp:67