1.00.0
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
storeOperatingAirlineCode
:
public
ParserSemanticAction
{
103
storeOperatingAirlineCode
(
FlightDateStruct
&);
105
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
106
};
107
109
struct
storeOperatingFlightNumber
:
public
ParserSemanticAction
{
111
storeOperatingFlightNumber
(
FlightDateStruct
&);
113
void
operator()
(
unsigned
int
iNumber)
const
;
114
};
115
117
struct
storeBoardingDate
:
public
ParserSemanticAction
{
119
storeBoardingDate
(
FlightDateStruct
&);
121
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
122
};
123
125
struct
storeBoardingTime
:
public
ParserSemanticAction
{
127
storeBoardingTime
(
FlightDateStruct
&);
129
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
130
};
131
133
struct
storeOffDate
:
public
ParserSemanticAction
{
135
storeOffDate
(
FlightDateStruct
&);
137
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
138
};
139
141
struct
storeOffTime
:
public
ParserSemanticAction
{
143
storeOffTime
(
FlightDateStruct
&);
145
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
146
};
147
149
struct
storeLegCabinCode
:
public
ParserSemanticAction
{
151
storeLegCabinCode
(
FlightDateStruct
&);
153
void
operator()
(
char
iChar)
const
;
154
};
155
157
struct
storeSaleableCapacity
:
public
ParserSemanticAction
{
159
storeSaleableCapacity
(
FlightDateStruct
&);
161
void
operator()
(
double
iReal)
const
;
162
};
163
165
struct
storeAU
:
public
ParserSemanticAction
{
167
storeAU
(
FlightDateStruct
&);
169
void
operator()
(
double
iReal)
const
;
170
};
171
173
struct
storeUPR
:
public
ParserSemanticAction
{
175
storeUPR
(
FlightDateStruct
&);
177
void
operator()
(
double
iReal)
const
;
178
};
179
181
struct
storeBookingCounter
:
public
ParserSemanticAction
{
183
storeBookingCounter
(
FlightDateStruct
&);
185
void
operator()
(
double
iReal)
const
;
186
};
187
189
struct
storeNAV
:
public
ParserSemanticAction
{
191
storeNAV
(
FlightDateStruct
&);
193
void
operator()
(
double
iReal)
const
;
194
};
195
197
struct
storeGAV
:
public
ParserSemanticAction
{
199
storeGAV
(
FlightDateStruct
&);
201
void
operator()
(
double
iReal)
const
;
202
};
203
205
struct
storeACP
:
public
ParserSemanticAction
{
207
storeACP
(
FlightDateStruct
&);
209
void
operator()
(
double
iReal)
const
;
210
};
211
213
struct
storeETB
:
public
ParserSemanticAction
{
215
storeETB
(
FlightDateStruct
&);
217
void
operator()
(
double
iReal)
const
;
218
};
219
221
struct
storeYieldUpperRange
:
public
ParserSemanticAction
{
223
storeYieldUpperRange
(
FlightDateStruct
&);
225
void
operator()
(
double
iReal)
const
;
226
};
227
229
struct
storeBucketAvaibality
:
public
ParserSemanticAction
{
231
storeBucketAvaibality
(
FlightDateStruct
&);
233
void
operator()
(
double
iReal)
const
;
234
};
235
237
struct
storeSeatIndex
:
public
ParserSemanticAction
{
239
storeSeatIndex
(
FlightDateStruct
&);
241
void
operator()
(
double
iReal)
const
;
242
};
243
245
struct
storeSegmentBoardingPoint
:
public
ParserSemanticAction
{
247
storeSegmentBoardingPoint
(
FlightDateStruct
&);
249
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
250
};
251
253
struct
storeSegmentOffPoint
:
public
ParserSemanticAction
{
255
storeSegmentOffPoint
(
FlightDateStruct
&);
257
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
258
};
259
261
struct
storeSegmentCabinCode
:
public
ParserSemanticAction
{
263
storeSegmentCabinCode
(
FlightDateStruct
&);
265
void
operator()
(
char
iChar)
const
;
266
};
267
269
struct
storeSegmentCabinBookingCounter
:
public
ParserSemanticAction
{
271
storeSegmentCabinBookingCounter
(
FlightDateStruct
&);
273
void
operator()
(
double
iReal)
const
;
274
};
275
277
struct
storeClassCode
:
public
ParserSemanticAction
{
279
storeClassCode
(
FlightDateStruct
&);
281
void
operator()
(
char
iChar)
const
;
282
};
283
285
struct
storeSubclassCode
:
public
ParserSemanticAction
{
287
storeSubclassCode
(
FlightDateStruct
&);
289
void
operator()
(
unsigned
int
iNumber)
const
;
290
};
291
293
struct
storeParentClassCode
:
public
ParserSemanticAction
{
295
storeParentClassCode
(
FlightDateStruct
&);
297
void
operator()
(
char
iChar)
const
;
298
};
299
301
struct
storeParentSubclassCode
:
public
ParserSemanticAction
{
303
storeParentSubclassCode
(
FlightDateStruct
&);
305
void
operator()
(
unsigned
int
iNumber)
const
;
306
};
307
309
struct
storeCumulatedProtection
:
public
ParserSemanticAction
{
311
storeCumulatedProtection
(
FlightDateStruct
&);
313
void
operator()
(
double
iReal)
const
;
314
};
315
317
struct
storeProtection
:
public
ParserSemanticAction
{
319
storeProtection
(
FlightDateStruct
&);
321
void
operator()
(
double
iReal)
const
;
322
};
323
325
struct
storeNego
:
public
ParserSemanticAction
{
327
storeNego
(
FlightDateStruct
&);
329
void
operator()
(
double
iReal)
const
;
330
};
331
333
struct
storeNoShow
:
public
ParserSemanticAction
{
335
storeNoShow
(
FlightDateStruct
&);
337
void
operator()
(
double
iReal)
const
;
338
};
339
341
struct
storeOverbooking
:
public
ParserSemanticAction
{
343
storeOverbooking
(
FlightDateStruct
&);
345
void
operator()
(
double
iReal)
const
;
346
};
347
349
struct
storeNbOfBkgs
:
public
ParserSemanticAction
{
351
storeNbOfBkgs
(
FlightDateStruct
&);
353
void
operator()
(
double
iReal)
const
;
354
};
355
357
struct
storeNbOfGroupBkgs
:
public
ParserSemanticAction
{
359
storeNbOfGroupBkgs
(
FlightDateStruct
&);
361
void
operator()
(
double
iReal)
const
;
362
};
363
365
struct
storeNbOfPendingGroupBkgs
:
public
ParserSemanticAction
{
367
storeNbOfPendingGroupBkgs
(
FlightDateStruct
&);
369
void
operator()
(
double
iReal)
const
;
370
};
371
373
struct
storeNbOfStaffBkgs
:
public
ParserSemanticAction
{
375
storeNbOfStaffBkgs
(
FlightDateStruct
&);
377
void
operator()
(
double
iReal)
const
;
378
};
379
382
struct
storeNbOfWLBkgs
:
public
ParserSemanticAction
{
384
storeNbOfWLBkgs
(
FlightDateStruct
&);
386
void
operator()
(
double
iReal)
const
;
387
};
388
390
struct
storeClassETB
:
public
ParserSemanticAction
{
392
storeClassETB
(
FlightDateStruct
&);
394
void
operator()
(
double
iReal)
const
;
395
};
396
399
struct
storeClassAvailability
:
public
ParserSemanticAction
{
401
storeClassAvailability
(
FlightDateStruct
&);
403
void
operator()
(
double
iReal)
const
;
404
};
405
408
struct
storeSegmentAvailability
:
public
ParserSemanticAction
{
410
storeSegmentAvailability
(
FlightDateStruct
&);
412
void
operator()
(
double
iReal)
const
;
413
};
414
417
struct
storeRevenueAvailability
:
public
ParserSemanticAction
{
419
storeRevenueAvailability
(
FlightDateStruct
&);
421
void
operator()
(
double
iReal)
const
;
422
};
423
425
struct
storeFamilyCode
:
public
ParserSemanticAction
{
427
storeFamilyCode
(
FlightDateStruct
&);
429
void
operator()
(
int
iCode)
const
;
430
};
431
433
struct
storeFClasses
:
public
ParserSemanticAction
{
435
storeFClasses
(
FlightDateStruct
&);
437
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
438
};
439
441
struct
doEndFlightDate
:
public
ParserSemanticAction
{
443
doEndFlightDate
(stdair::BomRoot&,
FlightDateStruct
&,
444
unsigned
int
&);
446
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
448
stdair::BomRoot&
_bomRoot
;
449
unsigned
int
&
_nbOfFlights
;
450
};
451
452
454
//
455
// (Boost Spirit) Grammar Definition
456
//
458
470
struct
InventoryParser
:
471
public
boost::spirit::classic::grammar<InventoryParser> {
472
473
InventoryParser
(stdair::BomRoot&,
FlightDateStruct
&,
unsigned
int
&);
474
475
template
<
typename
ScannerT>
476
struct
definition
{
477
definition
(
InventoryParser
const
&
self
);
478
479
// Instantiation of rules
480
boost::spirit::classic::rule<ScannerT>
flight_date_list
,
481
not_to_be_parsed
,
482
flight_date
,
flight_date_end
,
flight_key
,
airline_code
,
flight_number
,
483
flight_type_code
,
flight_visibility_code
,
484
date
,
leg_list
,
leg
,
operating_leg_details
,
leg_key
,
leg_details
,
485
leg_cabin_list
,
leg_cabin_details
,
486
bucket_list
,
bucket_details
,
487
time
,
segment_list
,
segment
,
segment_key
,
full_segment_cabin_details
,
488
segment_cabin_list
,
segment_cabin_key
,
segment_cabin_details
,
489
class_list
,
class_key
,
parent_subclass_code
,
490
class_protection
,
class_nego
,
class_details
,
491
family_cabin_list
,
family_cabin_details
;
492
494
boost::spirit::classic::rule<ScannerT>
const
&
start
()
const
;
495
};
496
497
// Parser Context
498
stdair::BomRoot&
_bomRoot
;
499
FlightDateStruct
&
_flightDate
;
500
unsigned
int
&
_nbOfFlights
;
501
};
502
503
}
504
505
507
//
508
// Entry class for the file parser
509
//
511
516
class
InventoryFileParser
:
public
stdair::CmdAbstract {
517
public
:
519
InventoryFileParser
(stdair::BomRoot&,
520
const
stdair::Filename_T& iInventoryInputFilename);
521
523
bool
buildInventory
();
524
525
private
:
527
void
init();
528
529
private
:
530
// Attributes
532
stdair::Filename_T _filename;
533
535
iterator_t
_startIterator;
536
538
iterator_t
_endIterator;
539
541
stdair::BomRoot& _bomRoot;
542
544
FlightDateStruct
_flightDate;
545
547
unsigned
int
_nbOfFlights;
548
};
549
550
}
551
#endif // __AIRINV_CMD_INVENTORYPARSERHELPER_HPP
Generated on Tue Dec 25 2012 22:19:42 for AirInv by
1.8.1.1