StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
SegmentDate.hpp
Go to the documentation of this file.
1 #ifndef __STDAIR_BOM_SEGMENTDATE_HPP
2 #define __STDAIR_BOM_SEGMENTDATE_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <iosfwd>
9 #include <string>
10 // StdAir
15 
17 namespace boost {
18  namespace serialization {
19  class access;
20  }
21 }
22 
23 namespace stdair {
24 
26  struct SegmentCabinKey;
27  class SegmentCabin;
28 
29  // Define the routing leg keys list type.
30  typedef std::list<std::string> RoutingLegKeyList_T;
31 
36  class SegmentDate : public BomAbstract {
37  template <typename BOM> friend class FacBom;
38  template <typename BOM> friend class FacCloneBom;
39  friend class FacBomManager;
41 
42  public:
43  // ////////// Type definitions ////////////
48 
49 
50  public:
51  // /////////// Getters /////////////
55  const Key_T& getKey() const {
56  return _key;
57  }
58 
62  BomAbstract* const getParent() const {
63  return _parent;
64  }
65 
70  return _key.getBoardingPoint();
71  }
72 
76  const AirportCode_T& getOffPoint() const {
77  return _key.getOffPoint();
78  }
79 
83  const HolderMap_T& getHolderMap() const {
84  return _holderMap;
85  }
86 
90  const Date_T& getBoardingDate() const {
91  return _boardingDate;
92  }
93 
97  const Duration_T& getBoardingTime() const {
98  return _boardingTime;
99  }
100 
104  const Date_T& getOffDate() const {
105  return _offDate;
106  }
107 
111  const Duration_T& getOffTime() const {
112  return _offTime;
113  }
114 
118  const Duration_T& getElapsedTime() const {
119  return _elapsedTime;
120  }
121 
125  const Distance_T& getDistance() const {
126  return _distance;
127  }
128 
132  const DateOffset_T getDateOffset() const {
133  return _offDate - _boardingDate;
134  }
135 
144  const Duration_T getTimeOffset() const;
145 
150  return _operatingSegmentDate;
151  }
152 
158  }
159 
163  const RoutingLegKeyList_T& getLegKeyList () const {
164  return _routingLegKeyList;
165  }
166 
167  public:
168  // ///////// Setters //////////
172  void setBoardingDate (const Date_T& iBoardingDate) {
173  _boardingDate = iBoardingDate;
174  }
175 
179  void setBoardingTime (const Duration_T& iBoardingTime) {
180  _boardingTime = iBoardingTime;
181  }
182 
186  void setOffDate (const Date_T& iOffDate) {
187  _offDate = iOffDate;
188  }
189 
193  void setOffTime (const Duration_T& iOffTime) {
194  _offTime = iOffTime;
195  }
196 
200  void setElapsedTime (const Duration_T& iElapsedTime) {
201  _elapsedTime = iElapsedTime;
202  }
203 
207  void setDistance (const Distance_T& iDistance) {
208  _distance = iDistance;
209  }
210 
214  void addLegKey (const std::string& iLegKey) {
215  _routingLegKeyList.push_back(iLegKey);
216  }
217 
218  private:
222  void linkWithOperating (SegmentDate& iSegmentDate) {
223  _operatingSegmentDate = &iSegmentDate;
224  }
225 
226  public:
227  // /////////// Display support methods /////////
233  void toStream (std::ostream& ioOut) const {
234  ioOut << toString();
235  }
236 
242  void fromStream (std::istream& ioIn) {
243  }
244 
248  std::string toString() const;
249 
253  const std::string describeKey() const {
254  return _key.toString();
255  }
256 
257 
258  public:
259  // /////////// (Boost) Serialisation support methods /////////
263  template<class Archive>
264  void serialize (Archive& ar, const unsigned int iFileVersion);
265 
266  private:
274  void serialisationImplementationExport() const;
275  void serialisationImplementationImport();
276 
277 
278  protected:
279  // ////////// Constructors and destructors /////////
283  SegmentDate (const Key_T&);
284 
288  virtual ~SegmentDate();
289 
290  private:
294  SegmentDate();
295 
299  SegmentDate (const SegmentDate&);
300 
301 
302  protected:
303  // ////////// Attributes /////////
307  Key_T _key;
308 
313 
318 
326 
334 
339 
344 
349 
354 
359 
364 
368  RoutingLegKeyList_T _routingLegKeyList;
369  };
370 
371 }
372 #endif // __STDAIR_BOM_SEGMENTDATE_HPP
373 
void toStream(std::ostream &ioOut) const
LocationCode_T AirportCode_T
const Duration_T & getElapsedTime() const
const std::string toString() const
BomAbstract * _parent
friend class boost::serialization::access
Definition: SegmentDate.hpp:40
const AirportCode_T & getOffPoint() const
Utility class for linking StdAir-based objects.
std::string toString() const
Definition: SegmentDate.cpp:48
void addLegKey(const std::string &iLegKey)
const Duration_T & getOffTime() const
Class representing the actual attributes for an airline segment-date.
Definition: SegmentDate.hpp:36
Handle on the StdAir library context.
boost::posix_time::time_duration Duration_T
void setBoardingTime(const Duration_T &iBoardingTime)
std::map< const std::type_info *, BomAbstract * > HolderMap_T
Definition: BomAbstract.hpp:63
const DateOffset_T getDateOffset() const
Base class for the Business Object Model (BOM) layer.
Definition: BomAbstract.hpp:24
std::list< std::string > RoutingLegKeyList_T
Definition: SegmentDate.hpp:27
SegmentDate * _operatingSegmentDate
void serialize(Archive &ar, const unsigned int iFileVersion)
SegmentDateKey Key_T
Definition: SegmentDate.hpp:47
const Duration_T & getBoardingTime() const
Definition: SegmentDate.hpp:97
const Duration_T getTimeOffset() const
Definition: SegmentDate.cpp:55
const AirportCode_T & getBoardingPoint() const
Definition: SegmentDate.hpp:69
RoutingLegKeyList_T _routingLegKeyList
std::list< SegmentDate * > SegmentDateList_T
Base class for Factory layer.
Definition: FacBom.hpp:22
Duration_T _elapsedTime
const std::string describeKey() const
void fromStream(std::istream &ioIn)
SegmentDate * getOperatingSegmentDate() const
BomAbstract *const getParent() const
Definition: SegmentDate.hpp:62
const SegmentDateList_T & getMarketingSegmentDateList() const
const Date_T & getOffDate() const
const Key_T & getKey() const
Definition: SegmentDate.hpp:55
const Date_T & getBoardingDate() const
Definition: SegmentDate.hpp:90
Forward declarations.
virtual ~SegmentDate()
Definition: SegmentDate.cpp:44
boost::gregorian::date Date_T
const AirportCode_T & getOffPoint() const
Definition: SegmentDate.hpp:76
HolderMap_T _holderMap
Class representing the actual attributes for an airline segment-cabin.
Duration_T _boardingTime
boost::gregorian::date_duration DateOffset_T
SegmentDateList_T _marketingSegmentDateList
Key of a given segment-date, made of an origin and a destination airports.
void setOffTime(const Duration_T &iOffTime)
const AirportCode_T & getBoardingPoint() const
const HolderMap_T & getHolderMap() const
Definition: SegmentDate.hpp:83
void setOffDate(const Date_T &iOffDate)
Base class for Factory layer.
Definition: FacCloneBom.hpp:22
const Distance_T & getDistance() const
void setElapsedTime(const Duration_T &iElapsedTime)
unsigned long int Distance_T
const RoutingLegKeyList_T & getLegKeyList() const
void setDistance(const Distance_T &iDistance)
void setBoardingDate(const Date_T &iBoardingDate)