StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
FlightDate.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <sstream>
7 // StdAir
10 #include <stdair/bom/Inventory.hpp>
12 #include <stdair/bom/LegDate.hpp>
14 
15 namespace stdair {
16 
17  // ////////////////////////////////////////////////////////////////////
18  FlightDate::FlightDate()
19  : _key (DEFAULT_FLIGHT_NUMBER, DEFAULT_DEPARTURE_DATE), _parent (NULL) {
20  // That constructor is used by the serialisation process
21  }
22 
23  // ////////////////////////////////////////////////////////////////////
24  FlightDate::FlightDate (const FlightDate& iFlightDate)
25  : _key (iFlightDate._key), _parent (NULL) {
26  }
27 
28  // ////////////////////////////////////////////////////////////////////
29  FlightDate::FlightDate (const Key_T& iKey) : _key (iKey), _parent (NULL) {
30  }
31 
32  // ////////////////////////////////////////////////////////////////////
34  }
35 
36  // ////////////////////////////////////////////////////////////////////
38  const Inventory* lInventory_ptr =
39  static_cast<const Inventory*> (getParent());
40  assert (lInventory_ptr != NULL);
41  return lInventory_ptr->getAirlineCode();
42  }
43 
44  // ////////////////////////////////////////////////////////////////////
45  std::string FlightDate::toString() const {
46  std::ostringstream oStr;
47  oStr << describeKey();
48  return oStr.str();
49  }
50 
51  // ////////////////////////////////////////////////////////////////////
52  LegDate* FlightDate::getLegDate (const std::string& iLegDateKeyStr) const {
53  LegDate* oLegDate_ptr =
54  BomManager::getObjectPtr<LegDate> (*this, iLegDateKeyStr);
55  return oLegDate_ptr;
56  }
57 
58  // ////////////////////////////////////////////////////////////////////
59  LegDate* FlightDate::getLegDate (const LegDateKey& iLegDateKey) const {
60  return getLegDate (iLegDateKey.toString());
61  }
62 
63  // ////////////////////////////////////////////////////////////////////
65  getSegmentDate (const std::string& iSegmentDateKeyStr) const {
66  SegmentDate* oSegmentDate_ptr =
67  BomManager::getObjectPtr<SegmentDate> (*this, iSegmentDateKeyStr);
68  return oSegmentDate_ptr;
69  }
70 
71  // ////////////////////////////////////////////////////////////////////
73  getSegmentDate (const SegmentDateKey& iSegmentDateKey) const {
74  return getSegmentDate (iSegmentDateKey.toString());
75  }
76 
77 }
78 
const std::string toString() const
Definition: LegDateKey.cpp:42
const Date_T DEFAULT_DEPARTURE_DATE
const std::string toString() const
Class representing the actual attributes for an airline segment-date.
Definition: SegmentDate.hpp:36
Handle on the StdAir library context.
std::string toString() const
Definition: FlightDate.cpp:45
std::string AirlineCode_T
const AirlineCode_T & getAirlineCode() const
Definition: Inventory.hpp:56
Key of a given flight-date, made of a flight number and a departure date.
const AirlineCode_T & getAirlineCode() const
Definition: FlightDate.cpp:37
SegmentDate * getSegmentDate(const std::string &iSegmentDateKeyStr) const
Definition: FlightDate.cpp:65
Class representing the actual attributes for an airline inventory.
Definition: Inventory.hpp:34
virtual ~FlightDate()
Definition: FlightDate.cpp:33
const FlightNumber_T DEFAULT_FLIGHT_NUMBER
Key of a given segment-date, made of an origin and a destination airports.
LegDate * getLegDate(const std::string &iLegDateKeyStr) const
Definition: FlightDate.cpp:52
const std::string describeKey() const
Definition: FlightDate.hpp:162
BomAbstract *const getParent() const
Definition: FlightDate.hpp:57