0.1.2
C++ Simulated Airline Inventory Management System library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
InventoryParserHelper.hpp
Go to the documentation of this file.
1
#ifndef __AIRINV_CMD_INVENTORYPARSERHELPER_HPP
2
#define __AIRINV_CMD_INVENTORYPARSERHELPER_HPP
3
4
// //////////////////////////////////////////////////////////////////////
5
// Import section
6
// //////////////////////////////////////////////////////////////////////
7
// STL
8
#include <string>
9
// StdAir
10
#include <stdair/command/CmdAbstract.hpp>
11
// Airinv
12
#include <
airinv/AIRINV_Types.hpp
>
13
#include <
airinv/basic/BasParserTypes.hpp
>
14
#include <
airinv/bom/FlightDateStruct.hpp
>
15
16
// Forward declarations
17
namespace
stdair {
18
class
BomRoot;
19
}
20
21
namespace
AIRINV {
22
23
namespace
InventoryParserHelper {
24
25
// ///////////////////////////////////////////////////////////////////
26
// Semantic actions
27
// ///////////////////////////////////////////////////////////////////
29
struct
ParserSemanticAction
{
31
ParserSemanticAction
(
FlightDateStruct
&);
33
FlightDateStruct
&
_flightDate
;
34
};
35
37
struct
storeSnapshotDate
:
public
ParserSemanticAction
{
39
storeSnapshotDate
(
FlightDateStruct
&);
41
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
42
};
43
45
struct
storeAirlineCode
:
public
ParserSemanticAction
{
47
storeAirlineCode
(
FlightDateStruct
&);
49
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
50
};
51
53
struct
storeFlightNumber
:
public
ParserSemanticAction
{
55
storeFlightNumber
(
FlightDateStruct
&);
57
void
operator()
(
unsigned
int
iNumber)
const
;
58
};
59
61
struct
storeFlightDate
:
public
ParserSemanticAction
{
63
storeFlightDate
(
FlightDateStruct
&);
65
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
66
};
67
69
struct
storeFlightTypeCode
:
public
ParserSemanticAction
{
71
storeFlightTypeCode
(
FlightDateStruct
&);
73
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
74
};
75
77
struct
storeFlightVisibilityCode
:
public
ParserSemanticAction
{
79
storeFlightVisibilityCode
(
FlightDateStruct
&);
81
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
82
};
83
85
struct
storeLegBoardingPoint
:
public
ParserSemanticAction
{
87
storeLegBoardingPoint
(
FlightDateStruct
&);
89
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
90
};
91
93
struct
storeLegOffPoint
:
public
ParserSemanticAction
{
95
storeLegOffPoint
(
FlightDateStruct
&);
97
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
98
};
99
101
struct
storeBoardingDate
:
public
ParserSemanticAction
{
103
storeBoardingDate
(
FlightDateStruct
&);
105
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
106
};
107
109
struct
storeBoardingTime
:
public
ParserSemanticAction
{
111
storeBoardingTime
(
FlightDateStruct
&);
113
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
114
};
115
117
struct
storeOffDate
:
public
ParserSemanticAction
{
119
storeOffDate
(
FlightDateStruct
&);
121
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
122
};
123
125
struct
storeOffTime
:
public
ParserSemanticAction
{
127
storeOffTime
(
FlightDateStruct
&);
129
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
130
};
131
133
struct
storeLegCabinCode
:
public
ParserSemanticAction
{
135
storeLegCabinCode
(
FlightDateStruct
&);
137
void
operator()
(
char
iChar)
const
;
138
};
139
141
struct
storeSaleableCapacity
:
public
ParserSemanticAction
{
143
storeSaleableCapacity
(
FlightDateStruct
&);
145
void
operator()
(
double
iReal)
const
;
146
};
147
149
struct
storeAU
:
public
ParserSemanticAction
{
151
storeAU
(
FlightDateStruct
&);
153
void
operator()
(
double
iReal)
const
;
154
};
155
157
struct
storeUPR
:
public
ParserSemanticAction
{
159
storeUPR
(
FlightDateStruct
&);
161
void
operator()
(
double
iReal)
const
;
162
};
163
165
struct
storeBookingCounter
:
public
ParserSemanticAction
{
167
storeBookingCounter
(
FlightDateStruct
&);
169
void
operator()
(
double
iReal)
const
;
170
};
171
173
struct
storeNAV
:
public
ParserSemanticAction
{
175
storeNAV
(
FlightDateStruct
&);
177
void
operator()
(
double
iReal)
const
;
178
};
179
181
struct
storeGAV
:
public
ParserSemanticAction
{
183
storeGAV
(
FlightDateStruct
&);
185
void
operator()
(
double
iReal)
const
;
186
};
187
189
struct
storeACP
:
public
ParserSemanticAction
{
191
storeACP
(
FlightDateStruct
&);
193
void
operator()
(
double
iReal)
const
;
194
};
195
197
struct
storeETB
:
public
ParserSemanticAction
{
199
storeETB
(
FlightDateStruct
&);
201
void
operator()
(
double
iReal)
const
;
202
};
203
205
struct
storeYieldUpperRange
:
public
ParserSemanticAction
{
207
storeYieldUpperRange
(
FlightDateStruct
&);
209
void
operator()
(
double
iReal)
const
;
210
};
211
213
struct
storeBucketAvaibality
:
public
ParserSemanticAction
{
215
storeBucketAvaibality
(
FlightDateStruct
&);
217
void
operator()
(
double
iReal)
const
;
218
};
219
221
struct
storeSeatIndex
:
public
ParserSemanticAction
{
223
storeSeatIndex
(
FlightDateStruct
&);
225
void
operator()
(
double
iReal)
const
;
226
};
227
229
struct
storeSegmentBoardingPoint
:
public
ParserSemanticAction
{
231
storeSegmentBoardingPoint
(
FlightDateStruct
&);
233
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
234
};
235
237
struct
storeSegmentOffPoint
:
public
ParserSemanticAction
{
239
storeSegmentOffPoint
(
FlightDateStruct
&);
241
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
242
};
243
245
struct
storeSegmentCabinCode
:
public
ParserSemanticAction
{
247
storeSegmentCabinCode
(
FlightDateStruct
&);
249
void
operator()
(
char
iChar)
const
;
250
};
251
253
struct
storeSegmentCabinBookingCounter
:
public
ParserSemanticAction
{
255
storeSegmentCabinBookingCounter
(
FlightDateStruct
&);
257
void
operator()
(
double
iReal)
const
;
258
};
259
261
struct
storeClassCode
:
public
ParserSemanticAction
{
263
storeClassCode
(
FlightDateStruct
&);
265
void
operator()
(
char
iChar)
const
;
266
};
267
269
struct
storeSubclassCode
:
public
ParserSemanticAction
{
271
storeSubclassCode
(
FlightDateStruct
&);
273
void
operator()
(
unsigned
int
iNumber)
const
;
274
};
275
277
struct
storeParentClassCode
:
public
ParserSemanticAction
{
279
storeParentClassCode
(
FlightDateStruct
&);
281
void
operator()
(
char
iChar)
const
;
282
};
283
285
struct
storeParentSubclassCode
:
public
ParserSemanticAction
{
287
storeParentSubclassCode
(
FlightDateStruct
&);
289
void
operator()
(
unsigned
int
iNumber)
const
;
290
};
291
293
struct
storeCumulatedProtection
:
public
ParserSemanticAction
{
295
storeCumulatedProtection
(
FlightDateStruct
&);
297
void
operator()
(
double
iReal)
const
;
298
};
299
301
struct
storeProtection
:
public
ParserSemanticAction
{
303
storeProtection
(
FlightDateStruct
&);
305
void
operator()
(
double
iReal)
const
;
306
};
307
309
struct
storeNego
:
public
ParserSemanticAction
{
311
storeNego
(
FlightDateStruct
&);
313
void
operator()
(
double
iReal)
const
;
314
};
315
317
struct
storeNoShow
:
public
ParserSemanticAction
{
319
storeNoShow
(
FlightDateStruct
&);
321
void
operator()
(
double
iReal)
const
;
322
};
323
325
struct
storeOverbooking
:
public
ParserSemanticAction
{
327
storeOverbooking
(
FlightDateStruct
&);
329
void
operator()
(
double
iReal)
const
;
330
};
331
333
struct
storeNbOfBkgs
:
public
ParserSemanticAction
{
335
storeNbOfBkgs
(
FlightDateStruct
&);
337
void
operator()
(
double
iReal)
const
;
338
};
339
341
struct
storeNbOfGroupBkgs
:
public
ParserSemanticAction
{
343
storeNbOfGroupBkgs
(
FlightDateStruct
&);
345
void
operator()
(
double
iReal)
const
;
346
};
347
349
struct
storeNbOfPendingGroupBkgs
:
public
ParserSemanticAction
{
351
storeNbOfPendingGroupBkgs
(
FlightDateStruct
&);
353
void
operator()
(
double
iReal)
const
;
354
};
355
357
struct
storeNbOfStaffBkgs
:
public
ParserSemanticAction
{
359
storeNbOfStaffBkgs
(
FlightDateStruct
&);
361
void
operator()
(
double
iReal)
const
;
362
};
363
366
struct
storeNbOfWLBkgs
:
public
ParserSemanticAction
{
368
storeNbOfWLBkgs
(
FlightDateStruct
&);
370
void
operator()
(
double
iReal)
const
;
371
};
372
374
struct
storeClassETB
:
public
ParserSemanticAction
{
376
storeClassETB
(
FlightDateStruct
&);
378
void
operator()
(
double
iReal)
const
;
379
};
380
383
struct
storeClassAvailability
:
public
ParserSemanticAction
{
385
storeClassAvailability
(
FlightDateStruct
&);
387
void
operator()
(
double
iReal)
const
;
388
};
389
392
struct
storeSegmentAvailability
:
public
ParserSemanticAction
{
394
storeSegmentAvailability
(
FlightDateStruct
&);
396
void
operator()
(
double
iReal)
const
;
397
};
398
401
struct
storeRevenueAvailability
:
public
ParserSemanticAction
{
403
storeRevenueAvailability
(
FlightDateStruct
&);
405
void
operator()
(
double
iReal)
const
;
406
};
407
409
struct
storeFamilyCode
:
public
ParserSemanticAction
{
411
storeFamilyCode
(
FlightDateStruct
&);
413
void
operator()
(
int
iCode)
const
;
414
};
415
417
struct
storeFClasses
:
public
ParserSemanticAction
{
419
storeFClasses
(
FlightDateStruct
&);
421
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
422
};
423
425
struct
doEndFlightDate
:
public
ParserSemanticAction
{
427
doEndFlightDate
(stdair::BomRoot&,
FlightDateStruct
&,
428
unsigned
int
&);
430
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
432
stdair::BomRoot&
_bomRoot
;
433
unsigned
int
&
_nbOfFlights
;
434
};
435
436
438
//
439
// (Boost Spirit) Grammar Definition
440
//
442
454
struct
InventoryParser
:
455
public
boost::spirit::classic::grammar<InventoryParser> {
456
457
InventoryParser
(stdair::BomRoot&,
FlightDateStruct
&,
unsigned
int
&);
458
459
template
<
typename
ScannerT>
460
struct
definition
{
461
definition
(
InventoryParser
const
&
self
);
462
463
// Instantiation of rules
464
boost::spirit::classic::rule<ScannerT>
flight_date_list
,
465
not_to_be_parsed
,
466
flight_date
,
flight_date_end
,
flight_key
,
airline_code
,
flight_number
,
467
flight_type_code
,
flight_visibility_code
,
468
date
,
leg_list
,
leg
,
leg_key
,
leg_details
,
469
leg_cabin_list
,
leg_cabin_details
,
470
bucket_list
,
bucket_details
,
471
time
,
segment_list
,
segment
,
segment_key
,
full_segment_cabin_details
,
472
segment_cabin_list
,
segment_cabin_key
,
segment_cabin_details
,
473
class_list
,
class_key
,
parent_subclass_code
,
474
class_protection
,
class_nego
,
class_details
,
475
family_cabin_list
,
family_cabin_details
;
476
478
boost::spirit::classic::rule<ScannerT>
const
&
start
()
const
;
479
};
480
481
// Parser Context
482
stdair::BomRoot&
_bomRoot
;
483
FlightDateStruct
&
_flightDate
;
484
unsigned
int
&
_nbOfFlights
;
485
};
486
487
}
488
489
491
//
492
// Entry class for the file parser
493
//
495
500
class
InventoryFileParser
:
public
stdair::CmdAbstract {
501
public
:
503
InventoryFileParser
(stdair::BomRoot&,
504
const
stdair::Filename_T& iInventoryInputFilename);
505
507
bool
buildInventory
();
508
509
private
:
511
void
init();
512
513
private
:
514
// Attributes
516
stdair::Filename_T _filename;
517
519
iterator_t
_startIterator;
520
522
iterator_t
_endIterator;
523
525
stdair::BomRoot& _bomRoot;
526
528
FlightDateStruct
_flightDate;
529
531
unsigned
int
_nbOfFlights;
532
};
533
534
}
535
#endif // __AIRINV_CMD_INVENTORYPARSERHELPER_HPP
Generated on Sun Aug 12 2012 20:06:30 for AirInv by
1.8.1.2