AirInv Logo  0.1.2
C++ Simulated Airline Inventory Management System library
ScheduleParser.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/BasFileMgr.hpp>
00009 #include <stdair/bom/BomRoot.hpp>
00010 #include <stdair/service/Logger.hpp>
00011 // Airinv
00012 #include <airinv/command/ScheduleParserHelper.hpp>
00013 #include <airinv/command/ScheduleParser.hpp>
00014 #include <airinv/command/InventoryManager.hpp>
00015 
00016 namespace AIRINV {
00017 
00018   // //////////////////////////////////////////////////////////////////////
00019   void ScheduleParser::
00020   generateInventories (const stdair::Filename_T& iScheduleFilename,
00021                        stdair::BomRoot& ioBomRoot) {
00022 
00023     // Check that the file path given as input corresponds to an actual file
00024     bool doesExistAndIsReadable =
00025       stdair::BasFileMgr::doesExistAndIsReadable (iScheduleFilename);
00026     if (doesExistAndIsReadable == false) {
00027       std::ostringstream oMessage;
00028       oMessage << "The schedule input file, '" << iScheduleFilename
00029                << "', can not be retrieved on the file-system";
00030       STDAIR_LOG_ERROR (oMessage.str());
00031       throw ScheduleInputFileNotFoundException (oMessage.str());
00032     }
00033 
00034     // Initialise the Flight-Period file parser.
00035     FlightPeriodFileParser lFlightPeriodParser (ioBomRoot, iScheduleFilename);
00036 
00037     // Parse the CSV-formatted schedule input file, and generate the
00038     // corresponding Inventories for the airlines.
00039     lFlightPeriodParser.generateInventories ();
00040       
00041     // Complete the BomRoot BOM building
00042     // Create the routings for all the inventories.
00043     InventoryManager::createDirectAccesses (ioBomRoot);
00044 
00045     // Build the similar flight-date sets and the corresponding guillotine
00046     // blocks.
00047     InventoryManager::buildSimilarSegmentCabinSets (ioBomRoot);
00048 
00049     // Bid price vector initialisation
00050     InventoryManager::setDefaultBidPriceVector (ioBomRoot);
00051 
00052   }
00053 
00054 }