1.00.26
C++ Standard Airline IT Object Library
Toggle main menu visibility
Loading...
Searching...
No Matches
BomKeyManager.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
#include <sstream>
7
// Boost
8
#include <boost/tokenizer.hpp>
9
#include <boost/lexical_cast.hpp>
10
#include <boost/date_time/gregorian/parsers.hpp>
11
// StdAir
12
#include <
stdair/stdair_exceptions.hpp
>
13
#include <
stdair/basic/BasConst_BomDisplay.hpp
>
14
#include <
stdair/bom/InventoryKey.hpp
>
15
#include <
stdair/bom/FlightDateKey.hpp
>
16
#include <
stdair/bom/SegmentDateKey.hpp
>
17
#include <
stdair/bom/LegDateKey.hpp
>
18
#include <
stdair/bom/ParsedKey.hpp
>
19
#include <
stdair/bom/BomKeyManager.hpp
>
20
#include <
stdair/service/Logger.hpp
>
21
22
namespace
stdair
{
23
24
// ////////////// Tokenising support ///////////////
28
typedef
boost::tokenizer<boost::char_separator<char> >
Tokeniser_T
;
29
30
// ////////////////////////////////////////////////////////////////////
31
ParsedKey
BomKeyManager::extractKeys
(
const
std::string& iFullKeyStr) {
32
ParsedKey
oParsedKey;
33
oParsedKey.
_fullKey
= iFullKeyStr;
34
35
// Token-ise the full key string
36
Tokeniser_T
lTokens (iFullKeyStr,
DEFAULT_KEY_TOKEN_DELIMITER
);
37
Tokeniser_T::iterator itToken = lTokens.begin();
38
39
// Airline code
40
if
(itToken != lTokens.end()) {
41
oParsedKey.
_airlineCode
= *itToken;
42
43
// Flight number
44
++itToken;
45
if
(itToken != lTokens.end()) {
46
oParsedKey.
_flightNumber
= *itToken;
47
48
// Departure date
49
++itToken;
50
if
(itToken != lTokens.end()) {
51
oParsedKey.
_departureDate
= *itToken;
52
53
// Origin
54
++itToken;
55
if
(itToken != lTokens.end()) {
56
oParsedKey.
_boardingPoint
= *itToken;
57
58
// Destination
59
++itToken;
60
if
(itToken != lTokens.end()) {
61
oParsedKey.
_offPoint
= *itToken;
62
63
// Boarding time
64
++itToken;
65
if
(itToken != lTokens.end()) {
66
oParsedKey.
_boardingTime
= *itToken;
67
}
68
}
69
}
70
}
71
}
72
}
73
74
return
oParsedKey;
75
}
76
77
// ////////////////////////////////////////////////////////////////////
78
InventoryKey
BomKeyManager::
79
extractInventoryKey
(
const
std::string& iFullKeyStr) {
80
ParsedKey
lParsedKey =
extractKeys
(iFullKeyStr);
81
82
return
lParsedKey.
getInventoryKey
();
83
}
84
85
// ////////////////////////////////////////////////////////////////////
86
FlightDateKey
BomKeyManager::
87
extractFlightDateKey
(
const
std::string& iFullKeyStr) {
88
ParsedKey
lParsedKey =
extractKeys
(iFullKeyStr);
89
90
return
lParsedKey.
getFlightDateKey
();
91
}
92
93
// ////////////////////////////////////////////////////////////////////
94
SegmentDateKey
BomKeyManager::
95
extractSegmentDateKey
(
const
std::string& iFullKeyStr) {
96
ParsedKey
lParsedKey =
extractKeys
(iFullKeyStr);
97
98
return
lParsedKey.
getSegmentKey
();
99
}
100
101
// ////////////////////////////////////////////////////////////////////
102
LegDateKey
BomKeyManager::
103
extractLegDateKey
(
const
std::string& iFullKeyStr) {
104
ParsedKey
lParsedKey =
extractKeys
(iFullKeyStr);
105
106
return
lParsedKey.
getLegKey
();
107
}
108
}
BasConst_BomDisplay.hpp
BomKeyManager.hpp
FlightDateKey.hpp
InventoryKey.hpp
LegDateKey.hpp
ParsedKey.hpp
SegmentDateKey.hpp
Logger.hpp
stdair_exceptions.hpp
stdair
Handle on the StdAir library context.
Definition
BasChronometer.cpp:9
stdair::DEFAULT_KEY_TOKEN_DELIMITER
const boost::char_separator< char > DEFAULT_KEY_TOKEN_DELIMITER
stdair::Tokeniser_T
boost::tokenizer< boost::char_separator< char > > Tokeniser_T
Definition
BomKeyManager.cpp:28
stdair::BomKeyManager::extractFlightDateKey
static FlightDateKey extractFlightDateKey(const std::string &iFullKeyStr)
Definition
BomKeyManager.cpp:87
stdair::BomKeyManager::extractSegmentDateKey
static SegmentDateKey extractSegmentDateKey(const std::string &iFullKeyStr)
Definition
BomKeyManager.cpp:95
stdair::BomKeyManager::extractInventoryKey
static InventoryKey extractInventoryKey(const std::string &iFullKeyStr)
Definition
BomKeyManager.cpp:79
stdair::BomKeyManager::extractKeys
static ParsedKey extractKeys(const std::string &iFullKeyStr)
Definition
BomKeyManager.cpp:31
stdair::BomKeyManager::extractLegDateKey
static LegDateKey extractLegDateKey(const std::string &iFullKeyStr)
Definition
BomKeyManager.cpp:103
stdair::FlightDateKey
Key of a given flight-date, made of a flight number and a departure date.
Definition
FlightDateKey.hpp:28
stdair::InventoryKey
Key of a given inventory, made of the airline code.
Definition
InventoryKey.hpp:26
stdair::LegDateKey
Definition
LegDateKey.hpp:16
stdair::ParsedKey
Definition
ParsedKey.hpp:22
stdair::ParsedKey::_boardingPoint
std::string _boardingPoint
Definition
ParsedKey.hpp:80
stdair::ParsedKey::_flightNumber
std::string _flightNumber
Definition
ParsedKey.hpp:78
stdair::ParsedKey::getSegmentKey
SegmentDateKey getSegmentKey() const
Definition
ParsedKey.cpp:98
stdair::ParsedKey::getInventoryKey
InventoryKey getInventoryKey() const
Definition
ParsedKey.cpp:51
stdair::ParsedKey::_departureDate
std::string _departureDate
Definition
ParsedKey.hpp:79
stdair::ParsedKey::_fullKey
std::string _fullKey
Definition
ParsedKey.hpp:76
stdair::ParsedKey::_airlineCode
std::string _airlineCode
Definition
ParsedKey.hpp:77
stdair::ParsedKey::_offPoint
std::string _offPoint
Definition
ParsedKey.hpp:81
stdair::ParsedKey::getLegKey
LegDateKey getLegKey() const
Definition
ParsedKey.cpp:84
stdair::ParsedKey::_boardingTime
std::string _boardingTime
Definition
ParsedKey.hpp:82
stdair::ParsedKey::getFlightDateKey
FlightDateKey getFlightDateKey() const
Definition
ParsedKey.cpp:62
stdair::SegmentDateKey
Key of a given segment-date, made of an origin and a destination airports.
Definition
SegmentDateKey.hpp:24
Generated for StdAir by
1.17.0