StdAir Logo  1.00.8
C++ Standard Airline IT Object Library
STDAIR_Service.hpp
Go to the documentation of this file.
1 
12 #ifndef __STDAIR_STDAIR_HPP
13 #define __STDAIR_STDAIR_HPP
14 
15 // //////////////////////////////////////////////////////////////////////
16 // Import section
17 // //////////////////////////////////////////////////////////////////////
18 // STL
19 #include <string>
20 // StdAir
23 #include <stdair/stdair_file.hpp>
30 
31 namespace stdair {
32 
34  class BomRoot;
35  struct EventStruct;
36  struct ProgressStatusSet;
37  struct BookingRequestStruct;
38  class JSONString;
39 
40 
45  public:
46  // ////////// Constructors and destructors //////////
51 
64 
80  STDAIR_Service (const BasLogParams&, const BasDBParams&);
81 
86 
87 
88  public:
89  // ////////////////// Business support methods //////////////////
109  void buildSampleBom();
110 
132  void buildDummyInventory (const CabinCapacity_T& iCabinCapacity);
133 
147 
163 
182 
211  BookingRequestStruct buildSampleBookingRequest (const bool isForCRS = false);
212 
216  void clonePersistentBom ();
217 
218  public:
219 
220  // //////////////// Export support methods /////////////////
233  std::string jsonExportFlightDateList (const AirlineCode_T& iAirlineCode = "all",
234  const FlightNumber_T& iFlightNumber = 0) const;
235 
246  std::string jsonExportFlightDateObjects (const AirlineCode_T&,
247  const FlightNumber_T&,
248  const Date_T& iDepartureDate) const;
249 
256  std::string jsonExportEventObject (const EventStruct&) const;
257 
264  std::string jsonExportConfiguration () const;
265 
266  public:
267 
268  // //////////////// Import support methods /////////////////
276  bool jsonImportConfiguration (const JSONString&) const;
277 
278  public:
279  // //////////////// Display support methods /////////////////
293  std::string list (const AirlineCode_T& iAirlineCode = "all",
294  const FlightNumber_T& iFlightNumber = 0) const;
295 
302  std::string listAirportPairDateRange () const;
303 
313  bool check (const AirlineCode_T&, const FlightNumber_T&,
314  const Date_T& iDepartureDate) const;
315 
328  bool check (const AirportCode_T&, const AirportCode_T&,
329  const Date_T& iDepartureDate) const;
330 
337  std::string configDisplay () const;
338 
346  std::string csvDisplay () const;
347 
356  std::string csvDisplay (const BomRoot&) const;
357 
367  std::string csvDisplay (const AirlineCode_T&, const FlightNumber_T&,
368  const Date_T& iDepartureDate) const;
369 
377  std::string csvDisplay (const TravelSolutionList_T&) const;
378 
389  std::string csvDisplay (const AirportCode_T&, const AirportCode_T&,
390  const Date_T& iDepartureDate) const;
391 
392 
393  public:
394  // ///////////////// Getters ///////////////////
403  BomRoot& getBomRoot() const;
404 
413  BomRoot& getPersistentBomRoot() const;
414 
420  BasLogParams getLogParams() const;
421 
428  const BasDBParams& getDBParams() const;
429 
439 
440 
441  private:
442  // /////// Construction and Destruction helper methods ///////
450 
455  void initServiceContext();
456 
474  void logInit (const BasLogParams&);
475 
481  void dbInit (const BasDBParams&);
482 
498  void init();
499 
503  void finalise();
504 
505  public:
506 
512  void importINIConfig (const ConfigINIFile&);
513 
522  void importConfigValue (const std::string& iValue,
523  const std::string& iPath);
524 
533  template <typename ValueType>
534  bool exportConfigValue (ValueType& ioValue, const std::string& iPath);
535 
540  void updateAirlineFeatures ();
541 
542  private:
543  // ///////// Service Context /////////
547  STDAIR_ServiceContext* _stdairServiceContext;
548  };
549 
550  // ////////////////////////////////////////////////////////////////////
551  template <typename ValueType>
552  bool STDAIR_Service::exportConfigValue (ValueType& ioValue,
553  const std::string& iPath) {
554 
555  // Retrieve the StdAir service context
556  assert (_stdairServiceContext != NULL);
557  const STDAIR_ServiceContext& lSTDAIR_ServiceContext =
558  *_stdairServiceContext;
559 
560  // Retrieve the BOM tree root
561  const ConfigHolderStruct& lConfigHolder =
562  lSTDAIR_ServiceContext.getConfigHolder();
563 
564  // Call the dedicated configuration holder method.
565  return lConfigHolder.exportValue <ValueType> (ioValue, iPath);
566  }
567  // ////////////////////////////////////////////////////////////////////
568 
569 }
570 #endif // __STDAIR_STDAIR_HPP
stdair::STDAIR_Service::buildSampleBom
void buildSampleBom()
Definition: STDAIR_Service.cpp:172
stdair::ConfigHolderStruct
Definition: ConfigHolderStruct.hpp:40
stdair::STDAIR_Service::list
std::string list(const AirlineCode_T &iAirlineCode="all", const FlightNumber_T &iFlightNumber=0) const
Definition: STDAIR_Service.cpp:428
stdair::STDAIR_Service::buildSampleTravelSolutionForPricing
void buildSampleTravelSolutionForPricing(TravelSolutionList_T &)
Definition: STDAIR_Service.cpp:215
stdair::STDAIR_ServiceContext
Class holding the context of the Stdair services.
Definition: STDAIR_ServiceContext.hpp:25
stdair::AirlineCode_T
std::string AirlineCode_T
Definition: stdair_basic_types.hpp:31
stdair::BasLogParams
Structure holding parameters for logging.
Definition: BasLogParams.hpp:19
stdair::STDAIR_Service::jsonExportFlightDateObjects
std::string jsonExportFlightDateObjects(const AirlineCode_T &, const FlightNumber_T &, const Date_T &iDepartureDate) const
Definition: STDAIR_Service.cpp:262
stdair::STDAIR_Service::updateAirlineFeatures
void updateAirlineFeatures()
Update the airline features objects thanks to the configuration holder.
Definition: STDAIR_Service.cpp:408
stdair::ServiceInitialisationType
Enumeration of service initialisation types.
Definition: ServiceInitialisationType.hpp:17
stdair::STDAIR_Service::jsonExportConfiguration
std::string jsonExportConfiguration() const
Definition: STDAIR_Service.cpp:359
ConfigHolderStruct.hpp
stdair::BomRoot
Class representing the actual attributes for the Bom root.
Definition: BomRoot.hpp:32
stdair::STDAIR_Service::buildDummyInventory
void buildDummyInventory(const CabinCapacity_T &iCabinCapacity)
Definition: STDAIR_Service.cpp:187
BasLogParams.hpp
stdair_inventory_types.hpp
stdair::STDAIR_Service::buildSampleBookingRequest
BookingRequestStruct buildSampleBookingRequest(const bool isForCRS=false)
Definition: STDAIR_Service.cpp:229
stdair::BookingRequestStruct
Structure holding the elements of a booking request.
Definition: BookingRequestStruct.hpp:21
stdair::STDAIR_Service::getLogParams
BasLogParams getLogParams() const
Definition: STDAIR_Service.cpp:148
stdair::STDAIR_Service::STDAIR_Service
STDAIR_Service()
Default constructor.
Definition: STDAIR_Service.cpp:45
stdair::STDAIR_Service::importConfigValue
void importConfigValue(const std::string &iValue, const std::string &iPath)
Definition: STDAIR_Service.cpp:391
ServiceInitialisationType.hpp
stdair::STDAIR_Service::jsonExportFlightDateList
std::string jsonExportFlightDateList(const AirlineCode_T &iAirlineCode="all", const FlightNumber_T &iFlightNumber=0) const
Definition: STDAIR_Service.cpp:242
stdair::AirportCode_T
LocationCode_T AirportCode_T
Definition: stdair_basic_types.hpp:22
stdair::STDAIR_Service::clonePersistentBom
void clonePersistentBom()
Clone the persistent Bom.
Definition: STDAIR_Service.cpp:635
stdair::ConfigINIFile
Definition: stdair_file.hpp:112
stdair
Handle on the StdAir library context.
Definition: BasChronometer.cpp:9
stdair::STDAIR_Service::csvDisplay
std::string csvDisplay() const
Definition: STDAIR_Service.cpp:525
stdair::STDAIR_Service::jsonImportConfiguration
bool jsonImportConfiguration(const JSONString &) const
Definition: STDAIR_Service.cpp:342
STDAIR_ServiceContext.hpp
stdair::STDAIR_Service::check
bool check(const AirlineCode_T &, const FlightNumber_T &, const Date_T &iDepartureDate) const
Definition: STDAIR_Service.cpp:463
stdair_file.hpp
stdair::STDAIR_Service::getBomRoot
BomRoot & getBomRoot() const
Get a reference on the BomRoot object.
Definition: STDAIR_Service.cpp:128
stdair::STDAIR_Service::jsonExportEventObject
std::string jsonExportEventObject(const EventStruct &) const
Definition: STDAIR_Service.cpp:312
stdair::STDAIR_Service::~STDAIR_Service
~STDAIR_Service()
Destructor.
Definition: STDAIR_Service.cpp:93
BasDBParams.hpp
stdair::STDAIR_Service::buildSampleTravelSolutions
void buildSampleTravelSolutions(TravelSolutionList_T &)
Definition: STDAIR_Service.cpp:222
stdair::ConfigHolderStruct::exportValue
bool exportValue(ValueType &ioValue, const std::string &iPath) const
Definition: ConfigHolderStruct.hpp:144
stdair_service_types.hpp
stdair::STDAIR_Service::getServiceInitialisationType
const ServiceInitialisationType & getServiceInitialisationType() const
Definition: STDAIR_Service.cpp:163
stdair::STDAIR_Service::configDisplay
std::string configDisplay() const
Definition: STDAIR_Service.cpp:508
stdair::STDAIR_Service
Interface for the STDAIR Services.
Definition: STDAIR_Service.hpp:44
stdair::STDAIR_Service::buildDummyLegSegmentAccesses
void buildDummyLegSegmentAccesses(BomRoot &)
Definition: STDAIR_Service.cpp:204
stdair::TravelSolutionList_T
std::list< TravelSolutionStruct > TravelSolutionList_T
Definition: TravelSolutionTypes.hpp:20
stdair::STDAIR_Service::getDBParams
const BasDBParams & getDBParams() const
Definition: STDAIR_Service.cpp:153
stdair::STDAIR_Service::importINIConfig
void importINIConfig(const ConfigINIFile &)
Import the configuration INI input file (format cfg).
Definition: STDAIR_Service.cpp:375
stdair::FlightNumber_T
unsigned short FlightNumber_T
Definition: stdair_basic_types.hpp:34
stdair::STDAIR_Service::exportConfigValue
bool exportConfigValue(ValueType &ioValue, const std::string &iPath)
Definition: STDAIR_Service.hpp:552
stdair::STDAIR_Service::getPersistentBomRoot
BomRoot & getPersistentBomRoot() const
Get a reference on the BomRoot object.
Definition: STDAIR_Service.cpp:138
TravelSolutionTypes.hpp
stdair::EventStruct
Definition: EventStruct.hpp:36
stdair::BasDBParams
Structure holding the parameters for connection to a database.
Definition: BasDBParams.hpp:19
stdair::JSONString
JSON-formatted string.
Definition: stdair_json.hpp:16
stdair::CabinCapacity_T
double CabinCapacity_T
Definition: stdair_inventory_types.hpp:51
stdair::STDAIR_Service::listAirportPairDateRange
std::string listAirportPairDateRange() const
Definition: STDAIR_Service.cpp:446
stdair::Date_T
boost::gregorian::date Date_T
Definition: stdair_date_time_types.hpp:20