1.00.26
C++ Standard Airline IT Object Library
Toggle main menu visibility
Loading...
Searching...
No Matches
OnDDateKey.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
#include <sstream>
7
// Boost Date-Time
8
#include <boost/date_time/gregorian/formatters.hpp>
9
// Boost.Serialization
10
#include <boost/archive/text_iarchive.hpp>
11
#include <boost/archive/text_oarchive.hpp>
12
#include <boost/serialization/access.hpp>
13
// StdAir
14
#include <
stdair/basic/BasConst_Inventory.hpp
>
15
#include <
stdair/basic/BasConst_BomDisplay.hpp
>
16
#include <
stdair/basic/BasConst_General.hpp
>
17
#include <
stdair/bom/OnDDateKey.hpp
>
18
#include <
stdair/bom/BomKeyManager.hpp
>
19
#include <
stdair/bom/Inventory.hpp
>
20
#include <
stdair/bom/FlightDate.hpp
>
21
#include <
stdair/bom/SegmentDate.hpp
>
22
#include <
stdair/bom/BomDisplay.hpp
>
23
24
namespace
stdair
{
25
26
// ////////////////////////////////////////////////////////////////////
27
OnDDateKey::OnDDateKey()
28
: _OnDStringList (
DEFAULT_OND_STRING_LIST
) {
29
assert (
false
);
30
}
31
32
// ////////////////////////////////////////////////////////////////////
33
OnDDateKey::OnDDateKey (
const
OnDStringList_T
& iOnDStringList)
34
: _OnDStringList (iOnDStringList) {
35
}
36
37
// ////////////////////////////////////////////////////////////////////
38
OnDDateKey::OnDDateKey (
const
OnDDateKey& iKey)
39
: _OnDStringList (iKey._OnDStringList) {
40
}
41
42
// ////////////////////////////////////////////////////////////////////
43
OnDDateKey::~OnDDateKey
() {
44
}
45
46
// ////////////////////////////////////////////////////////////////////
47
const
Date_T
OnDDateKey::getDate
()
const
{
48
assert(_OnDStringList.empty() ==
false
);
49
const
OnDString_T
& lFrontOnDString = _OnDStringList.front();
50
return
BomKeyManager::extractFlightDateKey
(lFrontOnDString).
getDepartureDate
();
51
}
52
53
// ////////////////////////////////////////////////////////////////////
54
const
AirportCode_T
OnDDateKey::getOrigin
()
const
{
55
assert(_OnDStringList.empty() ==
false
);
56
const
OnDString_T
& lFrontOnDString = _OnDStringList.front();
57
return
BomKeyManager::extractSegmentDateKey
(lFrontOnDString).
getBoardingPoint
();
58
}
59
60
// ////////////////////////////////////////////////////////////////////
61
const
AirportCode_T
OnDDateKey::getDestination
()
const
{
62
assert(_OnDStringList.empty() ==
false
);
63
const
OnDString_T
& lLastOnDString = _OnDStringList.back();
64
return
BomKeyManager::extractSegmentDateKey
(lLastOnDString).
getOffPoint
();
65
}
66
67
// ////////////////////////////////////////////////////////////////////
68
void
OnDDateKey::toStream
(std::ostream& ioOut)
const
{
69
ioOut <<
"OnDDateKey: "
<<
toString
();
70
}
71
72
// ////////////////////////////////////////////////////////////////////
73
void
OnDDateKey::fromStream
(std::istream& ioIn) {
74
}
75
76
// ////////////////////////////////////////////////////////////////////
77
const
std::string
OnDDateKey::toString
()
const
{
78
std::ostringstream oStr;
79
for
(OnDStringList_T::const_iterator itOnDString = _OnDStringList.begin();
80
itOnDString != _OnDStringList.end(); ++itOnDString){
81
oStr << *itOnDString <<
" "
;
82
}
83
return
oStr.str();
84
}
85
86
// ////////////////////////////////////////////////////////////////////
87
void
OnDDateKey::serialisationImplementationExport()
const
{
88
std::ostringstream oStr;
89
boost::archive::text_oarchive oa (oStr);
90
oa << *
this
;
91
}
92
93
// ////////////////////////////////////////////////////////////////////
94
void
OnDDateKey::serialisationImplementationImport() {
95
std::istringstream iStr;
96
boost::archive::text_iarchive ia (iStr);
97
ia >> *
this
;
98
}
99
100
// ////////////////////////////////////////////////////////////////////
101
template
<
class
Archive>
102
void
OnDDateKey::serialize
(Archive& ioArchive,
103
const
unsigned
int
iFileVersion) {
108
109
}
110
111
// ////////////////////////////////////////////////////////////////////
112
// Explicit template instantiation
113
namespace
ba =
boost::archive
;
114
template
void
OnDDateKey::serialize<ba::text_oarchive>
(ba::text_oarchive&,
115
unsigned
int
);
116
template
void
OnDDateKey::serialize<ba::text_iarchive>
(ba::text_iarchive&,
117
unsigned
int
);
118
// ////////////////////////////////////////////////////////////////////
119
120
}
BasConst_BomDisplay.hpp
BasConst_General.hpp
BasConst_Inventory.hpp
BomDisplay.hpp
BomKeyManager.hpp
FlightDate.hpp
Inventory.hpp
OnDDateKey.hpp
SegmentDate.hpp
stdair
Handle on the StdAir library context.
Definition
BasChronometer.cpp:9
stdair::Date_T
boost::gregorian::date Date_T
Definition
stdair_date_time_types.hpp:20
stdair::DEFAULT_OND_STRING_LIST
const OnDStringList_T DEFAULT_OND_STRING_LIST
Definition
BasConst.cpp:727
stdair::OnDStringList_T
std::list< OnDString_T > OnDStringList_T
Definition
stdair_demand_types.hpp:120
stdair::OnDString_T
std::string OnDString_T
Definition
stdair_demand_types.hpp:117
stdair::AirportCode_T
LocationCode_T AirportCode_T
Definition
stdair_basic_types.hpp:22
boost::archive
Definition
FlightDate.hpp:21
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::FlightDateKey::getDepartureDate
const Date_T & getDepartureDate() const
Definition
FlightDateKey.hpp:63
stdair::OnDDateKey::serialize
void serialize(Archive &ar, const unsigned int iFileVersion)
Definition
OnDDateKey.cpp:102
stdair::OnDDateKey::toStream
void toStream(std::ostream &ioOut) const
Definition
OnDDateKey.cpp:68
stdair::OnDDateKey::fromStream
void fromStream(std::istream &ioIn)
Definition
OnDDateKey.cpp:73
stdair::OnDDateKey::toString
const std::string toString() const
Definition
OnDDateKey.cpp:77
stdair::OnDDateKey::~OnDDateKey
~OnDDateKey()
Definition
OnDDateKey.cpp:43
stdair::OnDDateKey::getDate
const Date_T getDate() const
Definition
OnDDateKey.cpp:47
stdair::OnDDateKey::getDestination
const AirportCode_T getDestination() const
Definition
OnDDateKey.cpp:61
stdair::OnDDateKey::getOrigin
const AirportCode_T getOrigin() const
Definition
OnDDateKey.cpp:54
stdair::SegmentDateKey::getOffPoint
const AirportCode_T & getOffPoint() const
Definition
SegmentDateKey.hpp:56
stdair::SegmentDateKey::getBoardingPoint
const AirportCode_T & getBoardingPoint() const
Definition
SegmentDateKey.hpp:51
Generated for StdAir by
1.17.0