00001 #ifndef __AIRINV_CMD_INVENTORYPARSERHELPER_HPP
00002 #define __AIRINV_CMD_INVENTORYPARSERHELPER_HPP
00003
00004
00005
00006
00007
00008 #include <string>
00009
00010 #include <stdair/command/CmdAbstract.hpp>
00011
00012 #include <airinv/AIRINV_Types.hpp>
00013 #include <airinv/basic/BasParserTypes.hpp>
00014 #include <airinv/bom/FlightDateStruct.hpp>
00015
00016
00017 namespace stdair {
00018 class BomRoot;
00019 }
00020
00021 namespace AIRINV {
00022
00023 namespace InventoryParserHelper {
00024
00025
00026
00027
00029 struct ParserSemanticAction {
00031 ParserSemanticAction (FlightDateStruct&);
00033 FlightDateStruct& _flightDate;
00034 };
00035
00037 struct storeSnapshotDate : public ParserSemanticAction {
00039 storeSnapshotDate (FlightDateStruct&);
00041 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00042 };
00043
00045 struct storeAirlineCode : public ParserSemanticAction {
00047 storeAirlineCode (FlightDateStruct&);
00049 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00050 };
00051
00053 struct storeFlightNumber : public ParserSemanticAction {
00055 storeFlightNumber (FlightDateStruct&);
00057 void operator() (unsigned int iNumber) const;
00058 };
00059
00061 struct storeFlightDate : public ParserSemanticAction {
00063 storeFlightDate (FlightDateStruct&);
00065 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00066 };
00067
00069 struct storeFlightTypeCode : public ParserSemanticAction {
00071 storeFlightTypeCode (FlightDateStruct&);
00073 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00074 };
00075
00077 struct storeFlightVisibilityCode : public ParserSemanticAction {
00079 storeFlightVisibilityCode (FlightDateStruct&);
00081 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00082 };
00083
00085 struct storeLegBoardingPoint : public ParserSemanticAction {
00087 storeLegBoardingPoint (FlightDateStruct&);
00089 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00090 };
00091
00093 struct storeLegOffPoint : public ParserSemanticAction {
00095 storeLegOffPoint (FlightDateStruct&);
00097 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00098 };
00099
00101 struct storeBoardingDate : public ParserSemanticAction {
00103 storeBoardingDate (FlightDateStruct&);
00105 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00106 };
00107
00109 struct storeBoardingTime : public ParserSemanticAction {
00111 storeBoardingTime (FlightDateStruct&);
00113 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00114 };
00115
00117 struct storeOffDate : public ParserSemanticAction {
00119 storeOffDate (FlightDateStruct&);
00121 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00122 };
00123
00125 struct storeOffTime : public ParserSemanticAction {
00127 storeOffTime (FlightDateStruct&);
00129 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00130 };
00131
00133 struct storeLegCabinCode : public ParserSemanticAction {
00135 storeLegCabinCode (FlightDateStruct&);
00137 void operator() (char iChar) const;
00138 };
00139
00141 struct storeSaleableCapacity : public ParserSemanticAction {
00143 storeSaleableCapacity (FlightDateStruct&);
00145 void operator() (double iReal) const;
00146 };
00147
00149 struct storeAU : public ParserSemanticAction {
00151 storeAU (FlightDateStruct&);
00153 void operator() (double iReal) const;
00154 };
00155
00157 struct storeUPR : public ParserSemanticAction {
00159 storeUPR (FlightDateStruct&);
00161 void operator() (double iReal) const;
00162 };
00163
00165 struct storeBookingCounter : public ParserSemanticAction {
00167 storeBookingCounter (FlightDateStruct&);
00169 void operator() (double iReal) const;
00170 };
00171
00173 struct storeNAV : public ParserSemanticAction {
00175 storeNAV (FlightDateStruct&);
00177 void operator() (double iReal) const;
00178 };
00179
00181 struct storeGAV : public ParserSemanticAction {
00183 storeGAV (FlightDateStruct&);
00185 void operator() (double iReal) const;
00186 };
00187
00189 struct storeACP : public ParserSemanticAction {
00191 storeACP (FlightDateStruct&);
00193 void operator() (double iReal) const;
00194 };
00195
00197 struct storeETB : public ParserSemanticAction {
00199 storeETB (FlightDateStruct&);
00201 void operator() (double iReal) const;
00202 };
00203
00205 struct storeYieldUpperRange : public ParserSemanticAction {
00207 storeYieldUpperRange (FlightDateStruct&);
00209 void operator() (double iReal) const;
00210 };
00211
00213 struct storeBucketAvaibality : public ParserSemanticAction {
00215 storeBucketAvaibality (FlightDateStruct&);
00217 void operator() (double iReal) const;
00218 };
00219
00221 struct storeSeatIndex : public ParserSemanticAction {
00223 storeSeatIndex (FlightDateStruct&);
00225 void operator() (double iReal) const;
00226 };
00227
00229 struct storeSegmentBoardingPoint : public ParserSemanticAction {
00231 storeSegmentBoardingPoint (FlightDateStruct&);
00233 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00234 };
00235
00237 struct storeSegmentOffPoint : public ParserSemanticAction {
00239 storeSegmentOffPoint (FlightDateStruct&);
00241 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00242 };
00243
00245 struct storeSegmentCabinCode : public ParserSemanticAction {
00247 storeSegmentCabinCode (FlightDateStruct&);
00249 void operator() (char iChar) const;
00250 };
00251
00253 struct storeSegmentCabinBookingCounter : public ParserSemanticAction {
00255 storeSegmentCabinBookingCounter (FlightDateStruct&);
00257 void operator() (double iReal) const;
00258 };
00259
00261 struct storeClassCode : public ParserSemanticAction {
00263 storeClassCode (FlightDateStruct&);
00265 void operator() (char iChar) const;
00266 };
00267
00269 struct storeSubclassCode : public ParserSemanticAction {
00271 storeSubclassCode (FlightDateStruct&);
00273 void operator() (unsigned int iNumber) const;
00274 };
00275
00277 struct storeParentClassCode : public ParserSemanticAction {
00279 storeParentClassCode (FlightDateStruct&);
00281 void operator() (char iChar) const;
00282 };
00283
00285 struct storeParentSubclassCode : public ParserSemanticAction {
00287 storeParentSubclassCode (FlightDateStruct&);
00289 void operator() (unsigned int iNumber) const;
00290 };
00291
00293 struct storeCumulatedProtection : public ParserSemanticAction {
00295 storeCumulatedProtection (FlightDateStruct&);
00297 void operator() (double iReal) const;
00298 };
00299
00301 struct storeProtection : public ParserSemanticAction {
00303 storeProtection (FlightDateStruct&);
00305 void operator() (double iReal) const;
00306 };
00307
00309 struct storeNego : public ParserSemanticAction {
00311 storeNego (FlightDateStruct&);
00313 void operator() (double iReal) const;
00314 };
00315
00317 struct storeNoShow : public ParserSemanticAction {
00319 storeNoShow (FlightDateStruct&);
00321 void operator() (double iReal) const;
00322 };
00323
00325 struct storeOverbooking : public ParserSemanticAction {
00327 storeOverbooking (FlightDateStruct&);
00329 void operator() (double iReal) const;
00330 };
00331
00333 struct storeNbOfBkgs : public ParserSemanticAction {
00335 storeNbOfBkgs (FlightDateStruct&);
00337 void operator() (double iReal) const;
00338 };
00339
00341 struct storeNbOfGroupBkgs : public ParserSemanticAction {
00343 storeNbOfGroupBkgs (FlightDateStruct&);
00345 void operator() (double iReal) const;
00346 };
00347
00349 struct storeNbOfPendingGroupBkgs : public ParserSemanticAction {
00351 storeNbOfPendingGroupBkgs (FlightDateStruct&);
00353 void operator() (double iReal) const;
00354 };
00355
00357 struct storeNbOfStaffBkgs : public ParserSemanticAction {
00359 storeNbOfStaffBkgs (FlightDateStruct&);
00361 void operator() (double iReal) const;
00362 };
00363
00366 struct storeNbOfWLBkgs : public ParserSemanticAction {
00368 storeNbOfWLBkgs (FlightDateStruct&);
00370 void operator() (double iReal) const;
00371 };
00372
00374 struct storeClassETB : public ParserSemanticAction {
00376 storeClassETB (FlightDateStruct&);
00378 void operator() (double iReal) const;
00379 };
00380
00383 struct storeClassAvailability : public ParserSemanticAction {
00385 storeClassAvailability (FlightDateStruct&);
00387 void operator() (double iReal) const;
00388 };
00389
00392 struct storeSegmentAvailability : public ParserSemanticAction {
00394 storeSegmentAvailability (FlightDateStruct&);
00396 void operator() (double iReal) const;
00397 };
00398
00401 struct storeRevenueAvailability : public ParserSemanticAction {
00403 storeRevenueAvailability (FlightDateStruct&);
00405 void operator() (double iReal) const;
00406 };
00407
00409 struct storeFamilyCode : public ParserSemanticAction {
00411 storeFamilyCode (FlightDateStruct&);
00413 void operator() (int iCode) const;
00414 };
00415
00417 struct storeFClasses : public ParserSemanticAction {
00419 storeFClasses (FlightDateStruct&);
00421 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00422 };
00423
00425 struct doEndFlightDate : public ParserSemanticAction {
00427 doEndFlightDate (stdair::BomRoot&, FlightDateStruct&,
00428 unsigned int&);
00430 void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00432 stdair::BomRoot& _bomRoot;
00433 unsigned int& _nbOfFlights;
00434 };
00435
00436
00438
00439
00440
00442
00454 struct InventoryParser :
00455 public boost::spirit::classic::grammar<InventoryParser> {
00456
00457 InventoryParser (stdair::BomRoot&, FlightDateStruct&, unsigned int&);
00458
00459 template <typename ScannerT>
00460 struct definition {
00461 definition (InventoryParser const& self);
00462
00463
00464 boost::spirit::classic::rule<ScannerT> flight_date_list,
00465 not_to_be_parsed,
00466 flight_date, flight_date_end, flight_key, airline_code, flight_number,
00467 flight_type_code, flight_visibility_code,
00468 date, leg_list, leg, leg_key, leg_details,
00469 leg_cabin_list, leg_cabin_details,
00470 bucket_list, bucket_details,
00471 time, segment_list, segment, segment_key, full_segment_cabin_details,
00472 segment_cabin_list, segment_cabin_key, segment_cabin_details,
00473 class_list, class_key, parent_subclass_code,
00474 class_protection, class_nego, class_details,
00475 family_cabin_list, family_cabin_details;
00476
00478 boost::spirit::classic::rule<ScannerT> const& start() const;
00479 };
00480
00481
00482 stdair::BomRoot& _bomRoot;
00483 FlightDateStruct& _flightDate;
00484 unsigned int& _nbOfFlights;
00485 };
00486
00487 }
00488
00489
00491
00492
00493
00495
00500 class InventoryFileParser : public stdair::CmdAbstract {
00501 public:
00503 InventoryFileParser (stdair::BomRoot&,
00504 const stdair::Filename_T& iInventoryInputFilename);
00505
00507 bool buildInventory ();
00508
00509 private:
00511 void init();
00512
00513 private:
00514
00516 stdair::Filename_T _filename;
00517
00519 iterator_t _startIterator;
00520
00522 iterator_t _endIterator;
00523
00525 stdair::BomRoot& _bomRoot;
00526
00528 FlightDateStruct _flightDate;
00529
00531 unsigned int _nbOfFlights;
00532 };
00533
00534 }
00535 #endif // __AIRINV_CMD_INVENTORYPARSERHELPER_HPP