StdAir Logo  1.00.3
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
bool check(const AirlineCode_T &, const FlightNumber_T &, const Date_T &iDepartureDate) const
LocationCode_T AirportCode_T
void importINIConfig(const ConfigINIFile &)
Import the configuration INI input file (format cfg).
const BasDBParams & getDBParams() const
bool exportValue(ValueType &ioValue, const std::string &iPath) const
unsigned short FlightNumber_T
Structure holding the parameters for connection to a database.
Definition: BasDBParams.hpp:19
Handle on the StdAir library context.
STDAIR_Service()
Default constructor.
void buildSampleTravelSolutions(TravelSolutionList_T &)
void updateAirlineFeatures()
Update the airline features objects thanks to the configuration holder.
void buildSampleTravelSolutionForPricing(TravelSolutionList_T &)
std::string AirlineCode_T
std::string jsonExportFlightDateObjects(const AirlineCode_T &, const FlightNumber_T &, const Date_T &iDepartureDate) const
Enumeration of service initialisation types.
BomRoot & getBomRoot() const
Get a reference on the BomRoot object.
std::string jsonExportConfiguration() const
BomRoot & getPersistentBomRoot() const
Get a reference on the BomRoot object.
std::string jsonExportFlightDateList(const AirlineCode_T &iAirlineCode="all", const FlightNumber_T &iFlightNumber=0) const
Structure holding parameters for logging.
std::string jsonExportEventObject(const EventStruct &) const
void buildDummyLegSegmentAccesses(BomRoot &)
BasLogParams getLogParams() const
bool exportConfigValue(ValueType &ioValue, const std::string &iPath)
std::list< TravelSolutionStruct > TravelSolutionList_T
Class holding the context of the Stdair services.
std::string configDisplay() const
std::string csvDisplay() const
void clonePersistentBom()
Clone the persistent Bom.
boost::gregorian::date Date_T
JSON-formatted string.
Definition: stdair_json.hpp:16
std::string list(const AirlineCode_T &iAirlineCode="all", const FlightNumber_T &iFlightNumber=0) const
void buildDummyInventory(const CabinCapacity_T &iCabinCapacity)
Class representing the actual attributes for the Bom root.
Definition: BomRoot.hpp:32
std::string listAirportPairDateRange() const
const ServiceInitialisationType & getServiceInitialisationType() const
Structure holding the elements of a booking request.
BookingRequestStruct buildSampleBookingRequest(const bool isForCRS=false)
bool jsonImportConfiguration(const JSONString &) const
Interface for the STDAIR Services.
~STDAIR_Service()
Destructor.
void importConfigValue(const std::string &iValue, const std::string &iPath)