class holding the services related to Travel Demand Generation. More...
#include <trademgen/TRADEMGEN_Service.hpp>
Public Member Functions | |
TRADEMGEN_Service (const stdair::BasLogParams &, const stdair::BasDBParams &, const stdair::RandomSeed_T &) | |
Constructor. | |
TRADEMGEN_Service (const stdair::BasLogParams &, const stdair::RandomSeed_T &) | |
TRADEMGEN_Service (stdair::STDAIR_ServicePtr_T, SEVMGR::SEVMGR_ServicePtr_T, const stdair::RandomSeed_T &) | |
void | parseAndLoad (const DemandFilePath &) |
~TRADEMGEN_Service () | |
void | buildSampleBom () |
void | clonePersistentBom () |
void | buildComplementaryLinks (stdair::BomRoot &) |
stdair::BookingRequestStruct | buildSampleBookingRequest (const bool isForCRS=false) |
void | displayAirlineListFromDB () const |
const stdair::Count_T & | getExpectedTotalNumberOfRequestsToBeGenerated () const |
const stdair::Count_T & | getActualTotalNumberOfRequestsToBeGenerated () const |
const bool | stillHavingRequestsToBeGenerated (const stdair::DemandStreamKeyStr_T &, stdair::ProgressStatusSet &, const stdair::DemandGenerationMethod &) const |
stdair::Count_T | generateFirstRequests (const stdair::DemandGenerationMethod &) const |
stdair::BookingRequestPtr_T | generateNextRequest (const stdair::DemandStreamKeyStr_T &, const stdair::DemandGenerationMethod &) const |
bool | hasDemandStream (const stdair::DemandStreamKeyStr_T &) const |
stdair::ProgressStatusSet | popEvent (stdair::EventStruct &) const |
bool | isQueueDone () const |
bool | generateCancellation (const stdair::TravelSolutionStruct &, const stdair::PartySize_T &, const stdair::DateTime_T &, const stdair::Date_T &) const |
void | reset () const |
const stdair::ProgressStatus & | getProgressStatus () const |
const stdair::ProgressStatus & | getProgressStatus (const stdair::EventType::EN_EventType &) const |
std::string | jsonHandler (const stdair::JSONString &) const |
std::string | csvDisplay () const |
std::string | list () const |
std::string | list (const stdair::EventType::EN_EventType &) const |
std::string | displayDemandStream () const |
class holding the services related to Travel Demand Generation.
Definition at line 44 of file TRADEMGEN_Service.hpp.
TRADEMGEN::TRADEMGEN_Service::TRADEMGEN_Service | ( | const stdair::BasLogParams & | iLogParams, |
const stdair::BasDBParams & | iDBParams, | ||
const stdair::RandomSeed_T & | iRandomSeed | ||
) |
Constructor.
The initTrademgenService() method is called; see the corresponding documentation for more details.
A reference on an output stream is given, so that log outputs can be directed onto that stream.
Moreover, database connection parameters are given, so that a session can be created on the corresponding database.
const | stdair::BasLogParams& Parameters for the output log stream. |
const | stdair::BasDBParams& Parameters for the database access. |
const | stdair::RandomSeed_T& Seed for the random generation. |
Definition at line 78 of file TRADEMGEN_Service.cpp.
TRADEMGEN::TRADEMGEN_Service::TRADEMGEN_Service | ( | const stdair::BasLogParams & | iLogParams, |
const stdair::RandomSeed_T & | iRandomSeed | ||
) |
Constructor.
The initTrademgenService() method is called; see the corresponding documentation for more details.
A reference on an output stream is given, so that log outputs can be directed onto that stream.
const | stdair::BasLogParams& Parameters for the output log stream. |
const | stdair::RandomSeed_T& Seed for the random generation. |
Definition at line 54 of file TRADEMGEN_Service.cpp.
TRADEMGEN::TRADEMGEN_Service::TRADEMGEN_Service | ( | stdair::STDAIR_ServicePtr_T | ioSTDAIR_Service_ptr, |
SEVMGR::SEVMGR_ServicePtr_T | ioSEVMGR_Service_ptr, | ||
const stdair::RandomSeed_T & | iRandomSeed | ||
) |
Constructor.
The initTrademgenService() method is called; see the corresponding documentation for more details.
Moreover, as no reference on any output stream is given, neither any database access parameter is given, it is assumed that the StdAir log service has already been initialised with the proper log output stream by some other methods in the calling chain (for instance, when the TRADEMGEN_Service is itself being initialised by another library service such as TVLSIM_Service).
stdair::STDAIR_ServicePtr_T | Handler on the STDAIR_Service. |
SEVMGR::SEVMGR_ServicePtr_T | Handler on the SEVMGR_Service. |
const | stdair::RandomSeed_T& Seed for the random generation. |
Definition at line 104 of file TRADEMGEN_Service.cpp.
TRADEMGEN::TRADEMGEN_Service::~TRADEMGEN_Service | ( | ) |
Destructor.
Definition at line 125 of file TRADEMGEN_Service.cpp.
void TRADEMGEN::TRADEMGEN_Service::parseAndLoad | ( | const DemandFilePath & | iDemandFilePath | ) |
Parse the demand input file.
The CSV file, describing the parameters of the demand to be generated for the simulator, is parsed and instantiated in memory accordingly.
const | DemandFilePath& Filename of the input demand file. |
Definition at line 241 of file TRADEMGEN_Service.cpp.
References buildComplementaryLinks(), clonePersistentBom(), and generateDemand().
Referenced by TRADEMGEN::Trademgener::init(), and main().
void TRADEMGEN::TRADEMGEN_Service::buildSampleBom | ( | ) |
Build a sample BOM tree, made of a single DemandStream object.
As of now (March 2011), it corresponds to:
Definition at line 310 of file TRADEMGEN_Service.cpp.
References buildComplementaryLinks(), and clonePersistentBom().
Referenced by TRADEMGEN::Trademgener::init(), and main().
void TRADEMGEN::TRADEMGEN_Service::clonePersistentBom | ( | ) |
Clone the persistent BOM object.
Definition at line 382 of file TRADEMGEN_Service.cpp.
References buildComplementaryLinks().
Referenced by buildSampleBom(), and parseAndLoad().
void TRADEMGEN::TRADEMGEN_Service::buildComplementaryLinks | ( | stdair::BomRoot & | ioBomRoot | ) |
Build all the complementary links in the given bom root object.
Definition at line 419 of file TRADEMGEN_Service.cpp.
Referenced by buildSampleBom(), clonePersistentBom(), and parseAndLoad().
stdair::BookingRequestStruct TRADEMGEN::TRADEMGEN_Service::buildSampleBookingRequest | ( | const bool | isForCRS = false | ) |
Build a sample booking request structure.
As of now (March 2011), the sample booking request is made of the following parameters:
As of now (March 2011), the CRS-related booking request is made of the following parameters:
const | bool isForCRS Whether the sample booking request is for CRS. |
Definition at line 425 of file TRADEMGEN_Service.cpp.
void TRADEMGEN::TRADEMGEN_Service::displayAirlineListFromDB | ( | ) | const |
Display the list of airlines, as held within the sample database.
Definition at line 535 of file TRADEMGEN_Service.cpp.
Referenced by main().
const stdair::Count_T & TRADEMGEN::TRADEMGEN_Service::getExpectedTotalNumberOfRequestsToBeGenerated | ( | ) | const |
Get the expected number of events/requests to be generated for all the demand streams.
Calls the SEvMgr service with the same name "getExpectedTotalNumberOfRequestsToBeGenerated", which computes that number.
Definition at line 596 of file TRADEMGEN_Service.cpp.
Referenced by generateDemand(), and TRADEMGEN::Trademgener::trademgen().
const stdair::Count_T & TRADEMGEN::TRADEMGEN_Service::getActualTotalNumberOfRequestsToBeGenerated | ( | ) | const |
Get the actual number of events/requests to be generated for all the demand streams.
Calls the SEvMgr service with the same name "getActualTotalNumberOfRequestsToBeGenerated", which computes that number.
Definition at line 617 of file TRADEMGEN_Service.cpp.
const bool TRADEMGEN::TRADEMGEN_Service::stillHavingRequestsToBeGenerated | ( | const stdair::DemandStreamKeyStr_T & | iKey, |
stdair::ProgressStatusSet & | ioPSS, | ||
const stdair::DemandGenerationMethod & | iDemandGenerationMethod | ||
) | const |
Check whether enough requests have already been generated for the demand stream which corresponds to the given key.
const | DemandStreamKey& A string identifying uniquely the demand stream (e.g., "SIN-HND 2010-Feb-08 Y"). |
const | stdair::DemandGenerationMethod& States whether the demand generation must be performed following the method based on statistic orders. The alternative method, while more "intuitive", is also a sequential algorithm. |
Definition at line 638 of file TRADEMGEN_Service.cpp.
stdair::Count_T TRADEMGEN::TRADEMGEN_Service::generateFirstRequests | ( | const stdair::DemandGenerationMethod & | iDemandGenerationMethod | ) | const |
Browse the list of demand streams and generate the first request of each stream.
const | stdair::DemandGenerationMethod& States whether the demand generation must be performed following the method based on statistic orders. The alternative method, while more "intuitive", is also a sequential algorithm. |
Definition at line 663 of file TRADEMGEN_Service.cpp.
Referenced by generateDemand(), and TRADEMGEN::Trademgener::trademgen().
stdair::BookingRequestPtr_T TRADEMGEN::TRADEMGEN_Service::generateNextRequest | ( | const stdair::DemandStreamKeyStr_T & | iKey, |
const stdair::DemandGenerationMethod & | iDemandGenerationMethod | ||
) | const |
Generate a request with the demand stream which corresponds to the given key.
const | DemandStreamKey& A string identifying uniquely the demand stream (e.g., "SIN-HND 2010-Feb-08 Y"). |
const | stdair::DemandGenerationMethod& States whether the demand generation must be performed following the method based on statistic orders. The alternative method, while more "intuitive", is also a sequential algorithm. |
Definition at line 689 of file TRADEMGEN_Service.cpp.
Referenced by generateDemand(), and TRADEMGEN::Trademgener::trademgen().
bool TRADEMGEN::TRADEMGEN_Service::hasDemandStream | ( | const stdair::DemandStreamKeyStr_T & | iDemandStreamKey | ) | const |
States whether a demand stream with the given key is used to generate demand.
const | DemandStreamKey& A string identifying uniquely the demand stream (e.g., "SIN-HND 2010-Feb-08 Y"). |
Definition at line 868 of file TRADEMGEN_Service.cpp.
stdair::ProgressStatusSet TRADEMGEN::TRADEMGEN_Service::popEvent | ( | stdair::EventStruct & | ioEventStruct | ) | const |
Pop the next coming (in time) event, and remove it from the event queue thanks to the SEvMgr service.
Definition at line 713 of file TRADEMGEN_Service.cpp.
Referenced by generateDemand(), and TRADEMGEN::Trademgener::trademgen().
bool TRADEMGEN::TRADEMGEN_Service::isQueueDone | ( | ) | const |
States whether the event queue has reached the end.
Calls the SEvMgr service with the same name "isQueueDone", which states whether the event queue has reached the end.
For now, that method states whether the event queue is empty.
Definition at line 729 of file TRADEMGEN_Service.cpp.
Referenced by generateDemand(), and TRADEMGEN::Trademgener::trademgen().
bool TRADEMGEN::TRADEMGEN_Service::generateCancellation | ( | const stdair::TravelSolutionStruct & | iTravelSolution, |
const stdair::PartySize_T & | iPartySize, | ||
const stdair::DateTime_T & | iRequestTime, | ||
const stdair::Date_T & | iDepartureDate | ||
) | const |
Generate the potential cancellation event.
Definition at line 749 of file TRADEMGEN_Service.cpp.
void TRADEMGEN::TRADEMGEN_Service::reset | ( | ) | const |
Reset the context of the demand streams for another demand generation without having to reparse the demand input file.
Definition at line 811 of file TRADEMGEN_Service.cpp.
Referenced by generateDemand(), and TRADEMGEN::Trademgener::trademgen().
const stdair::ProgressStatus & TRADEMGEN::TRADEMGEN_Service::getProgressStatus | ( | ) | const |
Get the overall progress status (for the whole event queue).
Definition at line 832 of file TRADEMGEN_Service.cpp.
const stdair::ProgressStatus & TRADEMGEN::TRADEMGEN_Service::getProgressStatus | ( | const stdair::EventType::EN_EventType & | iEventType | ) | const |
Get the progress status for the given event type (e.g., booking request, optimisation notification, schedule change, break point).
Definition at line 850 of file TRADEMGEN_Service.cpp.
std::string TRADEMGEN::TRADEMGEN_Service::jsonHandler | ( | const stdair::JSONString & | iJSONString | ) | const |
Dispatch the JSon command string to the SEvMgr service. (Only SEvMgr has json export commands for now).
const | stdair::JSONString& Input string which contained the JSon command string. |
Definition at line 447 of file TRADEMGEN_Service.cpp.
std::string TRADEMGEN::TRADEMGEN_Service::csvDisplay | ( | ) | const |
Recursively display (dump in the returned string) the objects of the BOM tree.
Definition at line 468 of file TRADEMGEN_Service.cpp.
Referenced by generateDemand(), and TRADEMGEN::Trademgener::trademgen().
std::string TRADEMGEN::TRADEMGEN_Service::list | ( | ) | const |
Display (dump in the returned string) the event list of the event queue.
Definition at line 490 of file TRADEMGEN_Service.cpp.
std::string TRADEMGEN::TRADEMGEN_Service::list | ( | const stdair::EventType::EN_EventType & | iEventType | ) | const |
Display (dump in the returned string) the events with the given type
Definition at line 513 of file TRADEMGEN_Service.cpp.
std::string TRADEMGEN::TRADEMGEN_Service::displayDemandStream | ( | ) | const |
Display (dump in the returned string) the demand streams
Definition at line 885 of file TRADEMGEN_Service.cpp.
References TRADEMGEN::DemandStream::describeKey().