StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
LegDate.hpp
Go to the documentation of this file.
1 #ifndef __STDAIR_BOM_LEGDATE_HPP
2 #define __STDAIR_BOM_LEGDATE_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <iosfwd>
9 #include <string>
10 // StdAir
15 
16 namespace stdair {
17 
19  struct LegCabinKey;
20  class LegCabin;
21 
25  class LegDate : public BomAbstract {
26  template <typename BOM> friend class FacBom;
27  template <typename BOM> friend class FacCloneBom;
28  friend class FacBomManager;
29 
30  public:
31  // ////////// Type definitions ////////////
33  typedef LegDateKey Key_T;
34 
35 
36  public:
37  // /////////// Getters /////////////
39  const Key_T& getKey() const {
40  return _key;
41  }
42 
44  BomAbstract* const getParent() const {
45  return _parent;
46  }
47 
50  return _key.getBoardingPoint();
51  }
52 
60  const AirlineCode_T& getAirlineCode() const;
61 
65  const HolderMap_T& getHolderMap() const {
66  return _holderMap;
67  }
68 
79  LegCabin* getLegCabin (const std::string& iLegCabinKeyStr) const;
80 
91  LegCabin* getLegCabin (const LegCabinKey&) const;
92 
94  const AirportCode_T& getOffPoint() const {
95  return _offPoint;
96  }
97 
99  const Date_T& getBoardingDate() const {
100  return _boardingDate;
101  }
102 
104  const Duration_T& getBoardingTime() const {
105  return _boardingTime;
106  }
107 
109  const Date_T& getOffDate() const {
110  return _offDate;
111  }
112 
114  const Duration_T& getOffTime() const {
115  return _offTime;
116  }
117 
119  const Duration_T& getElapsedTime() const {
120  return _elapsedTime;
121  }
122 
124  const Distance_T& getDistance() const {
125  return _distance;
126  }
127 
129  const CabinCapacity_T& getCapacity() const {
130  return _capacity;
131  }
132 
134  const DateOffset_T getDateOffset() const {
135  return _offDate - _boardingDate;
136  }
137 
142  const Duration_T getTimeOffset() const;
143 
144 
145  public:
146  // ///////// Setters //////////
148  void setOffPoint (const AirportCode_T& iOffPoint) {
149  _offPoint = iOffPoint;
150  }
151 
153  void setBoardingDate (const Date_T& iBoardingDate) {
154  _boardingDate = iBoardingDate;
155  }
156 
158  void setBoardingTime (const Duration_T& iBoardingTime) {
159  _boardingTime = iBoardingTime;
160  }
161 
163  void setOffDate (const Date_T& iOffDate) {
164  _offDate = iOffDate;
165  }
166 
168  void setOffTime (const Duration_T& iOffTime) {
169  _offTime = iOffTime;
170  }
171 
173  void setElapsedTime (const Duration_T&);
174 
176  void setOperatingAirlineCode (const AirlineCode_T& iAirlineCode) {
177  _operatingAirlineCode = iAirlineCode;
178  }
179 
181  void setOperatingFlightNumber (const FlightNumber_T& iFlightNumber) {
182  _operatingFlightNumber = iFlightNumber;
183  }
184 
185  private:
187  void updateDistanceFromElapsedTime();
188 
189 
190  public:
191  // /////////// Display support methods /////////
194  void toStream (std::ostream& ioOut) const {
195  ioOut << toString();
196  }
197 
200  void fromStream (std::istream& ioIn) {
201  }
202 
204  std::string toString() const;
205 
207  const std::string describeKey() const {
208  return _key.toString();
209  }
210 
212  const std::string describeRoutingKey() const;
213 
214  protected:
215  // ////////// Constructors and destructors /////////
217  LegDate (const Key_T&);
219  virtual ~LegDate();
220 
221  private:
223  LegDate();
225  LegDate (const LegDate&);
226 
227 
228  protected:
229  // ////////// Attributes /////////
231  Key_T _key;
232 
235 
238 
241 
244 
247 
250 
253 
256 
259 
262 
265 
268  };
269 
270 }
271 #endif // __STDAIR_BOM_LEGDATE_HPP
272 
void toStream(std::ostream &ioOut) const
Definition: LegDate.hpp:194
const std::string toString() const
Definition: LegDateKey.cpp:42
BomAbstract *const getParent() const
Definition: LegDate.hpp:44
virtual ~LegDate()
Definition: LegDate.cpp:44
LocationCode_T AirportCode_T
const Duration_T & getOffTime() const
Definition: LegDate.hpp:114
Class representing the actual attributes for an airline leg-cabin.
Definition: LegCabin.hpp:25
Utility class for linking StdAir-based objects.
FlightNumber_T _operatingFlightNumber
Definition: LegDate.hpp:267
unsigned short FlightNumber_T
Date_T _boardingDate
Definition: LegDate.hpp:243
Handle on the StdAir library context.
boost::posix_time::time_duration Duration_T
CabinCapacity_T _capacity
Definition: LegDate.hpp:261
std::map< const std::type_info *, BomAbstract * > HolderMap_T
Definition: BomAbstract.hpp:63
const std::string describeKey() const
Definition: LegDate.hpp:207
Base class for the Business Object Model (BOM) layer.
Definition: BomAbstract.hpp:24
LegCabin * getLegCabin(const std::string &iLegCabinKeyStr) const
Definition: LegDate.cpp:76
const Duration_T getTimeOffset() const
Definition: LegDate.cpp:88
std::string AirlineCode_T
const Distance_T & getDistance() const
Definition: LegDate.hpp:124
HolderMap_T _holderMap
Definition: LegDate.hpp:237
std::string toString() const
Definition: LegDate.cpp:56
void setOperatingFlightNumber(const FlightNumber_T &iFlightNumber)
Definition: LegDate.hpp:181
BomAbstract * _parent
Definition: LegDate.hpp:234
void setOffPoint(const AirportCode_T &iOffPoint)
Definition: LegDate.hpp:148
AirlineCode_T _operatingAirlineCode
Definition: LegDate.hpp:264
void setOperatingAirlineCode(const AirlineCode_T &iAirlineCode)
Definition: LegDate.hpp:176
Base class for Factory layer.
Definition: FacBom.hpp:22
const CabinCapacity_T & getCapacity() const
Definition: LegDate.hpp:129
const Duration_T & getBoardingTime() const
Definition: LegDate.hpp:104
void setBoardingTime(const Duration_T &iBoardingTime)
Definition: LegDate.hpp:158
const std::string describeRoutingKey() const
Definition: LegDate.cpp:63
const AirportCode_T & getBoardingPoint() const
Definition: LegDateKey.hpp:34
Duration_T _boardingTime
Definition: LegDate.hpp:246
const AirlineCode_T & getAirlineCode() const
Definition: LegDate.cpp:48
void setOffDate(const Date_T &iOffDate)
Definition: LegDate.hpp:163
boost::gregorian::date Date_T
const Date_T & getBoardingDate() const
Definition: LegDate.hpp:99
const Duration_T & getElapsedTime() const
Definition: LegDate.hpp:119
Duration_T _elapsedTime
Definition: LegDate.hpp:255
void setOffTime(const Duration_T &iOffTime)
Definition: LegDate.hpp:168
Duration_T _offTime
Definition: LegDate.hpp:252
Key of a given leg-cabin, made of a cabin code (only).
Definition: LegCabinKey.hpp:26
boost::gregorian::date_duration DateOffset_T
Date_T _offDate
Definition: LegDate.hpp:249
const AirportCode_T & getOffPoint() const
Definition: LegDate.hpp:94
const Date_T & getOffDate() const
Definition: LegDate.hpp:109
Distance_T _distance
Definition: LegDate.hpp:258
const Key_T & getKey() const
Definition: LegDate.hpp:39
const DateOffset_T getDateOffset() const
Definition: LegDate.hpp:134
void fromStream(std::istream &ioIn)
Definition: LegDate.hpp:200
LegDateKey Key_T
Definition: LegDate.hpp:33
const AirportCode_T & getBoardingPoint() const
Definition: LegDate.hpp:49
Base class for Factory layer.
Definition: FacCloneBom.hpp:22
const HolderMap_T & getHolderMap() const
Definition: LegDate.hpp:65
AirportCode_T _offPoint
Definition: LegDate.hpp:240
void setElapsedTime(const Duration_T &)
Definition: LegDate.cpp:103
unsigned long int Distance_T
void setBoardingDate(const Date_T &iBoardingDate)
Definition: LegDate.hpp:153