0.1.4
C++ Simulated Airline Schedule Manager Library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
ScheduleParserHelper.hpp
Go to the documentation of this file.
1
#ifndef __AIRSCHED_CMD_SCHEDULEPARSERHELPER_HPP
2
#define __AIRSCHED_CMD_SCHEDULEPARSERHELPER_HPP
3
4
// //////////////////////////////////////////////////////////////////////
5
// Import section
6
// //////////////////////////////////////////////////////////////////////
7
// STL
8
#include <string>
9
// StdAir
10
#include <stdair/command/CmdAbstract.hpp>
11
// AirSched
12
#include <
airsched/AIRSCHED_Types.hpp
>
13
#include <
airsched/basic/BasParserTypes.hpp
>
14
#include <
airsched/bom/FlightPeriodStruct.hpp
>
15
16
// Forward declarations
17
namespace
stdair {
18
class
BomRoot;
19
}
20
21
namespace
AIRSCHED {
22
23
namespace
ScheduleParserHelper {
24
25
// ///////////////////////////////////////////////////////////////////
26
// Semantic actions
27
// ///////////////////////////////////////////////////////////////////
29
struct
ParserSemanticAction
{
31
ParserSemanticAction
(
FlightPeriodStruct
&);
33
FlightPeriodStruct
&
_flightPeriod
;
34
};
35
37
struct
storeAirlineCode
:
public
ParserSemanticAction
{
39
storeAirlineCode
(
FlightPeriodStruct
&);
41
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
42
};
43
45
struct
storeFlightNumber
:
public
ParserSemanticAction
{
47
storeFlightNumber
(
FlightPeriodStruct
&);
49
void
operator()
(
unsigned
int
iNumber)
const
;
50
};
51
53
struct
storeDateRangeStart
:
public
ParserSemanticAction
{
55
storeDateRangeStart
(
FlightPeriodStruct
&);
57
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
58
};
59
61
struct
storeDateRangeEnd
:
public
ParserSemanticAction
{
63
storeDateRangeEnd
(
FlightPeriodStruct
&);
65
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
66
};
67
69
struct
storeDow
:
public
ParserSemanticAction
{
71
storeDow
(
FlightPeriodStruct
&);
73
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
74
};
75
77
struct
storeLegBoardingPoint
:
public
ParserSemanticAction
{
79
storeLegBoardingPoint
(
FlightPeriodStruct
&);
81
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
82
};
83
85
struct
storeLegOffPoint
:
public
ParserSemanticAction
{
87
storeLegOffPoint
(
FlightPeriodStruct
&);
89
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
90
};
91
93
struct
storeBoardingTime
:
public
ParserSemanticAction
{
95
storeBoardingTime
(
FlightPeriodStruct
&);
97
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
98
};
99
101
struct
storeOffTime
:
public
ParserSemanticAction
{
103
storeOffTime
(
FlightPeriodStruct
&);
105
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
106
};
107
109
struct
storeElapsedTime
:
public
ParserSemanticAction
{
111
storeElapsedTime
(
FlightPeriodStruct
&);
113
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
114
};
115
117
struct
storeLegCabinCode
:
public
ParserSemanticAction
{
119
storeLegCabinCode
(
FlightPeriodStruct
&);
121
void
operator()
(
char
iChar)
const
;
122
};
123
125
struct
storeCapacity
:
public
ParserSemanticAction
{
127
storeCapacity
(
FlightPeriodStruct
&);
129
void
operator()
(
double
iReal)
const
;
130
};
131
136
struct
storeSegmentSpecificity
:
public
ParserSemanticAction
{
138
storeSegmentSpecificity
(
FlightPeriodStruct
&);
140
void
operator()
(
char
iChar)
const
;
141
};
142
144
struct
storeSegmentBoardingPoint
:
public
ParserSemanticAction
{
146
storeSegmentBoardingPoint
(
FlightPeriodStruct
&);
148
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
149
};
150
152
struct
storeSegmentOffPoint
:
public
ParserSemanticAction
{
154
storeSegmentOffPoint
(
FlightPeriodStruct
&);
156
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
157
};
158
160
struct
storeSegmentCabinCode
:
public
ParserSemanticAction
{
162
storeSegmentCabinCode
(
FlightPeriodStruct
&);
164
void
operator()
(
char
iChar)
const
;
165
};
166
168
struct
storeClasses
:
public
ParserSemanticAction
{
170
storeClasses
(
FlightPeriodStruct
&);
172
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
173
};
174
176
struct
storeFamilyCode
:
public
ParserSemanticAction
{
178
storeFamilyCode
(
FlightPeriodStruct
&);
180
void
operator()
(
int
iCode)
const
;
181
};
182
184
struct
storeFClasses
:
public
ParserSemanticAction
{
186
storeFClasses
(
FlightPeriodStruct
&);
188
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
189
};
190
192
struct
doEndFlight
:
public
ParserSemanticAction
{
194
doEndFlight
(stdair::BomRoot&,
FlightPeriodStruct
&);
196
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
198
stdair::BomRoot&
_bomRoot
;
199
};
200
201
203
//
204
// (Boost Spirit) Grammar Definition
205
//
207
249
struct
FlightPeriodParser
:
250
public
boost::spirit::classic::grammar<FlightPeriodParser> {
251
252
FlightPeriodParser
(stdair::BomRoot&,
FlightPeriodStruct
&);
253
254
template
<
typename
ScannerT>
255
struct
definition
{
256
definition
(
FlightPeriodParser
const
&
self
);
257
258
// Instantiation of rules
259
boost::spirit::classic::rule<ScannerT>
flight_period_list
,
flight_period
,
260
not_to_be_parsed
,
flight_period_end
,
flight_key
,
airline_code
,
261
flight_number
,
date
,
dow
,
time
,
date_offset
,
262
leg
,
leg_key
,
leg_details
,
leg_cabin_details
,
263
segment_section
,
segment_key
,
full_segment_cabin_details
,
264
segment_cabin_details
,
full_family_cabin_details
,
265
family_cabin_details
,
generic_segment
,
specific_segment_list
;
266
268
boost::spirit::classic::rule<ScannerT>
const
&
start
()
const
;
269
};
270
271
// Parser Context
272
stdair::BomRoot&
_bomRoot
;
273
FlightPeriodStruct
&
_flightPeriod
;
274
};
275
276
}
281
282
//
283
// Entry class for the file parser
284
//
286
291
class
FlightPeriodFileParser
:
public
stdair::CmdAbstract {
292
public
:
294
FlightPeriodFileParser
(stdair::BomRoot& ioBomRoot,
295
const
stdair::Filename_T& iFilename);
296
298
bool
generateInventories
();
299
300
private
:
302
void
init();
303
304
private
:
305
// Attributes
307
stdair::Filename_T _filename;
308
310
iterator_t
_startIterator;
311
313
iterator_t
_endIterator;
314
316
stdair::BomRoot& _bomRoot;
317
319
FlightPeriodStruct
_flightPeriod;
320
};
321
322
}
323
#endif // __AIRSCHED_CMD_SCHEDULEPARSERHELPER_HPP
Generated on Mon Aug 13 2012 13:58:34 for AirSched by
1.8.1.2