StdAir Logo  0.44.0
C++ Standard Airline IT Object Library
Inventory.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 
00013 namespace stdair {
00014 
00015   // ////////////////////////////////////////////////////////////////////
00016   Inventory::Inventory() : _key (DEFAULT_AIRLINE_CODE), _parent (NULL) {
00017     // That constructor is used by the serialisation process
00018   }
00019 
00020   // ////////////////////////////////////////////////////////////////////
00021   Inventory::Inventory (const Inventory&)
00022     : _key (DEFAULT_AIRLINE_CODE), _parent (NULL) {
00023     assert (false);
00024   }
00025 
00026   // ////////////////////////////////////////////////////////////////////
00027   Inventory::Inventory (const Key_T& iKey) : _key (iKey), _parent (NULL) {
00028   }
00029 
00030   // ////////////////////////////////////////////////////////////////////
00031   Inventory::~Inventory() {
00032   }
00033 
00034   // ////////////////////////////////////////////////////////////////////
00035   std::string Inventory::toString() const {
00036     std::ostringstream oStr;
00037     oStr << describeKey();
00038     return oStr.str();
00039   }
00040 
00041   // ////////////////////////////////////////////////////////////////////
00042   FlightDate* Inventory::
00043   getFlightDate (const std::string& iFlightDateKeyStr) const {
00044     FlightDate* oFlightDate_ptr =
00045       BomManager::getObjectPtr<FlightDate> (*this, iFlightDateKeyStr);
00046     return oFlightDate_ptr;
00047   }
00048 
00049   // ////////////////////////////////////////////////////////////////////
00050   FlightDate* Inventory::
00051   getFlightDate (const FlightDateKey& iFlightDateKey) const {
00052     return getFlightDate (iFlightDateKey.toString());
00053   }
00054 
00055 }
00056