StdAir Logo  1.00.6
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  namespace archive {
22  namespace detail {
23  template <class T>
24  class heap_allocation;
25  }
26  }
27 }
28 
29 namespace stdair {
30 
32  struct SegmentCabinKey;
33  class SegmentCabin;
34 
35  // Define the routing leg keys list type.
36  typedef std::list<std::string> RoutingLegKeyList_T;
37 
42  class SegmentDate : public BomAbstract {
43  template <typename BOM> friend class FacBom;
44  template <typename BOM> friend class FacCloneBom;
45  friend class FacBomManager;
47  template <class T> friend class boost::archive::detail::heap_allocation;
48 
49  public:
50  // ////////// Type definitions ////////////
55 
56 
57  public:
58  // /////////// Getters /////////////
62  const Key_T& getKey() const {
63  return _key;
64  }
65 
69  BomAbstract* const getParent() const {
70  return _parent;
71  }
72 
77  return _key.getBoardingPoint();
78  }
79 
83  const AirportCode_T& getOffPoint() const {
84  return _key.getOffPoint();
85  }
86 
90  const HolderMap_T& getHolderMap() const {
91  return _holderMap;
92  }
93 
97  const Date_T& getBoardingDate() const {
98  return _boardingDate;
99  }
100 
104  const Duration_T& getBoardingTime() const {
105  return _boardingTime;
106  }
107 
111  const Date_T& getOffDate() const {
112  return _offDate;
113  }
114 
118  const Duration_T& getOffTime() const {
119  return _offTime;
120  }
121 
125  const Duration_T& getElapsedTime() const {
126  return _elapsedTime;
127  }
128 
132  const Distance_T& getDistance() const {
133  return _distance;
134  }
135 
139  const DateOffset_T getDateOffset() const {
140  return _offDate - _boardingDate;
141  }
142 
151  const Duration_T getTimeOffset() const;
152 
157  return _operatingSegmentDate;
158  }
159 
165  }
166 
171  return _routingLegKeyList;
172  }
173 
174  public:
175  // ///////// Setters //////////
179  void setBoardingDate (const Date_T& iBoardingDate) {
180  _boardingDate = iBoardingDate;
181  }
182 
186  void setBoardingTime (const Duration_T& iBoardingTime) {
187  _boardingTime = iBoardingTime;
188  }
189 
193  void setOffDate (const Date_T& iOffDate) {
194  _offDate = iOffDate;
195  }
196 
200  void setOffTime (const Duration_T& iOffTime) {
201  _offTime = iOffTime;
202  }
203 
207  void setElapsedTime (const Duration_T& iElapsedTime) {
208  _elapsedTime = iElapsedTime;
209  }
210 
214  void setDistance (const Distance_T& iDistance) {
215  _distance = iDistance;
216  }
217 
221  void addLegKey (const std::string& iLegKey) {
222  _routingLegKeyList.push_back(iLegKey);
223  }
224 
225  private:
229  void linkWithOperating (SegmentDate& iSegmentDate) {
230  _operatingSegmentDate = &iSegmentDate;
231  }
232 
233  public:
234  // /////////// Display support methods /////////
240  void toStream (std::ostream& ioOut) const {
241  ioOut << toString();
242  }
243 
249  void fromStream (std::istream& ioIn) {
250  }
251 
255  std::string toString() const;
256 
260  const std::string describeKey() const {
261  return _key.toString();
262  }
263 
264 
265  public:
266  // /////////// (Boost) Serialisation support methods /////////
270  template<class Archive>
271  void serialize (Archive& ar, const unsigned int iFileVersion);
272 
273  private:
281  void serialisationImplementationExport() const;
282  void serialisationImplementationImport();
283 
284 
285  protected:
286  // ////////// Constructors and destructors /////////
290  SegmentDate (const Key_T&);
291 
295  virtual ~SegmentDate();
296 
297  private:
301  SegmentDate();
302 
306  SegmentDate (const SegmentDate&);
307 
308 
309  protected:
310  // ////////// Attributes /////////
315 
320 
325 
333 
341 
346 
351 
356 
361 
366 
371 
376  };
377 
378 }
379 #endif // __STDAIR_BOM_SEGMENTDATE_HPP
380 
unsigned long int Distance_T
const RoutingLegKeyList_T & getLegKeyList() const
const Duration_T getTimeOffset() const
Definition: SegmentDate.cpp:55
const SegmentDateList_T & getMarketingSegmentDateList() const
const Duration_T & getOffTime() const
LocationCode_T AirportCode_T
virtual ~SegmentDate()
Definition: SegmentDate.cpp:44
std::map< const std::type_info *, BomAbstract * > HolderMap_T
Definition: BomAbstract.hpp:63
void setBoardingDate(const Date_T &iBoardingDate)
Duration_T _elapsedTime
const Duration_T & getBoardingTime() const
BomAbstract * _parent
Key of a given segment-date, made of an origin and a destination airports.
Base class for Factory layer.
Definition: FacCloneBom.hpp:22
boost::gregorian::date Date_T
Forward declarations.
void setOffDate(const Date_T &iOffDate)
void addLegKey(const std::string &iLegKey)
SegmentDate * getOperatingSegmentDate() const
std::list< std::string > RoutingLegKeyList_T
Definition: SegmentDate.hpp:33
Base class for the Business Object Model (BOM) layer.
Definition: BomAbstract.hpp:24
void setBoardingTime(const Duration_T &iBoardingTime)
void setOffTime(const Duration_T &iOffTime)
void toStream(std::ostream &ioOut) const
BomAbstract *const getParent() const
Definition: SegmentDate.hpp:69
Class representing the actual attributes for an airline segment-cabin.
friend class boost::serialization::access
Definition: SegmentDate.hpp:46
SegmentDateKey Key_T
Definition: SegmentDate.hpp:54
std::string toString() const
Definition: SegmentDate.cpp:48
Class representing the actual attributes for an airline segment-date.
Definition: SegmentDate.hpp:42
Utility class for linking StdAir-based objects.
const DateOffset_T getDateOffset() const
SegmentDate * _operatingSegmentDate
const AirportCode_T & getOffPoint() const
const Key_T & getKey() const
Definition: SegmentDate.hpp:62
RoutingLegKeyList_T _routingLegKeyList
const std::string describeKey() const
Handle on the StdAir library context.
const HolderMap_T & getHolderMap() const
Definition: SegmentDate.hpp:90
Base class for Factory layer.
Definition: FacBom.hpp:22
HolderMap_T _holderMap
const AirportCode_T & getOffPoint() const
Definition: SegmentDate.hpp:83
const Distance_T & getDistance() const
const Date_T & getOffDate() const
Duration_T _boardingTime
const AirportCode_T & getBoardingPoint() const
boost::posix_time::time_duration Duration_T
void serialize(Archive &ar, const unsigned int iFileVersion)
void setDistance(const Distance_T &iDistance)
const Duration_T & getElapsedTime() const
boost::gregorian::date_duration DateOffset_T
void setElapsedTime(const Duration_T &iElapsedTime)
std::list< SegmentDate * > SegmentDateList_T
void fromStream(std::istream &ioIn)
const Date_T & getBoardingDate() const
Definition: SegmentDate.hpp:97
const std::string toString() const
const AirportCode_T & getBoardingPoint() const
Definition: SegmentDate.hpp:76
SegmentDateList_T _marketingSegmentDateList