$treeview $search $mathjax
StdAir Logo  1.00.2
$projectbrief
$projectbrief
$searchbox

stdair/bom/FlightDate.cpp

Go to the documentation of this file.
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& iFlightDate)
00025     : _key (iFlightDate._key), _parent (NULL) {
00026   }
00027   
00028   // ////////////////////////////////////////////////////////////////////
00029   FlightDate::FlightDate (const Key_T& iKey) : _key (iKey), _parent (NULL) {
00030   }
00031 
00032   // ////////////////////////////////////////////////////////////////////
00033   FlightDate::~FlightDate() {
00034   }
00035   
00036   // ////////////////////////////////////////////////////////////////////
00037   const AirlineCode_T& FlightDate::getAirlineCode() const {
00038     const Inventory* lInventory_ptr =
00039       static_cast<const Inventory*> (getParent());
00040     assert (lInventory_ptr != NULL);
00041     return lInventory_ptr->getAirlineCode();
00042   }
00043 
00044   // ////////////////////////////////////////////////////////////////////
00045   std::string FlightDate::toString() const {
00046     std::ostringstream oStr;
00047     oStr << describeKey();
00048     return oStr.str();
00049   }
00050 
00051   // ////////////////////////////////////////////////////////////////////
00052   LegDate* FlightDate::getLegDate (const std::string& iLegDateKeyStr) const {
00053     LegDate* oLegDate_ptr =
00054       BomManager::getObjectPtr<LegDate> (*this, iLegDateKeyStr);
00055     return oLegDate_ptr;
00056   }
00057 
00058   // ////////////////////////////////////////////////////////////////////
00059   LegDate* FlightDate::getLegDate (const LegDateKey& iLegDateKey) const {
00060     return getLegDate (iLegDateKey.toString());
00061   }
00062 
00063   // ////////////////////////////////////////////////////////////////////
00064   SegmentDate* FlightDate::
00065   getSegmentDate (const std::string& iSegmentDateKeyStr) const {
00066     SegmentDate* oSegmentDate_ptr = 
00067       BomManager::getObjectPtr<SegmentDate> (*this, iSegmentDateKeyStr);
00068     return oSegmentDate_ptr;
00069   }
00070 
00071   // ////////////////////////////////////////////////////////////////////
00072   SegmentDate* FlightDate::
00073   getSegmentDate (const SegmentDateKey& iSegmentDateKey) const {
00074     return getSegmentDate (iSegmentDateKey.toString());
00075   }
00076 
00077 }
00078