00001 // ////////////////////////////////////////////////////////////////////// 00002 // Import section 00003 // ////////////////////////////////////////////////////////////////////// 00004 // STL 00005 #include <cassert> 00006 #include <sstream> 00007 // StdAir 00008 #include <stdair/basic/BasConst_Inventory.hpp> 00009 #include <stdair/bom/BomManager.hpp> 00010 #include <stdair/bom/Inventory.hpp> 00011 #include <stdair/bom/FlightDate.hpp> 00012 #include <stdair/bom/LegDate.hpp> 00013 #include <stdair/bom/SegmentDate.hpp> 00014 00015 namespace stdair { 00016 00017 // //////////////////////////////////////////////////////////////////// 00018 FlightDate::FlightDate() 00019 : _key (DEFAULT_FLIGHT_NUMBER, DEFAULT_DEPARTURE_DATE), _parent (NULL) { 00020 // That constructor is used by the serialisation process 00021 } 00022 00023 // //////////////////////////////////////////////////////////////////// 00024 FlightDate::FlightDate (const FlightDate&) 00025 : _key (DEFAULT_FLIGHT_NUMBER, DEFAULT_DEPARTURE_DATE), _parent (NULL) { 00026 assert (false); 00027 } 00028 00029 // //////////////////////////////////////////////////////////////////// 00030 FlightDate::FlightDate (const Key_T& iKey) : _key (iKey), _parent (NULL) { 00031 } 00032 00033 // //////////////////////////////////////////////////////////////////// 00034 FlightDate::~FlightDate() { 00035 } 00036 00037 // //////////////////////////////////////////////////////////////////// 00038 const AirlineCode_T& FlightDate::getAirlineCode() const { 00039 const Inventory* lInventory_ptr = 00040 static_cast<const Inventory*> (getParent()); 00041 assert (lInventory_ptr != NULL); 00042 return lInventory_ptr->getAirlineCode(); 00043 } 00044 00045 // //////////////////////////////////////////////////////////////////// 00046 std::string FlightDate::toString() const { 00047 std::ostringstream oStr; 00048 oStr << describeKey(); 00049 return oStr.str(); 00050 } 00051 00052 // //////////////////////////////////////////////////////////////////// 00053 LegDate* FlightDate::getLegDate (const std::string& iLegDateKeyStr) const { 00054 LegDate* oLegDate_ptr = 00055 BomManager::getObjectPtr<LegDate> (*this, iLegDateKeyStr); 00056 return oLegDate_ptr; 00057 } 00058 00059 // //////////////////////////////////////////////////////////////////// 00060 LegDate* FlightDate::getLegDate (const LegDateKey& iLegDateKey) const { 00061 return getLegDate (iLegDateKey.toString()); 00062 } 00063 00064 // //////////////////////////////////////////////////////////////////// 00065 SegmentDate* FlightDate:: 00066 getSegmentDate (const std::string& iSegmentDateKeyStr) const { 00067 SegmentDate* oSegmentDate_ptr = 00068 BomManager::getObjectPtr<SegmentDate> (*this, iSegmentDateKeyStr); 00069 return oSegmentDate_ptr; 00070 } 00071 00072 // //////////////////////////////////////////////////////////////////// 00073 SegmentDate* FlightDate:: 00074 getSegmentDate (const SegmentDateKey& iSegmentDateKey) const { 00075 return getSegmentDate (iSegmentDateKey.toString()); 00076 } 00077 00078 } 00079