StdAir Logo  1.00.13
C++ Standard Airline IT Object Library
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
23
24namespace 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 // ////////////////////////////////////////////////////////////////////
44 }
45
46 // ////////////////////////////////////////////////////////////////////
48 assert(_OnDStringList.empty() == false);
49 const OnDString_T& lFrontOnDString = _OnDStringList.front();
51 }
52
53 // ////////////////////////////////////////////////////////////////////
55 assert(_OnDStringList.empty() == false);
56 const OnDString_T& lFrontOnDString = _OnDStringList.front();
58 }
59
60 // ////////////////////////////////////////////////////////////////////
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) {
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}
Handle on the StdAir library context.
boost::gregorian::date Date_T
const OnDStringList_T DEFAULT_OND_STRING_LIST
Definition BasConst.cpp:727
std::list< OnDString_T > OnDStringList_T
std::string OnDString_T
LocationCode_T AirportCode_T
static FlightDateKey extractFlightDateKey(const std::string &iFullKeyStr)
static SegmentDateKey extractSegmentDateKey(const std::string &iFullKeyStr)
const Date_T & getDepartureDate() const
Key of a given O&D-date, made of a list of OnD strings. a OnD string contains the airline code,...
void serialize(Archive &ar, const unsigned int iFileVersion)
void toStream(std::ostream &ioOut) const
void fromStream(std::istream &ioIn)
const std::string toString() const
const Date_T getDate() const
const AirportCode_T getDestination() const
const AirportCode_T getOrigin() const
const AirportCode_T & getOffPoint() const
const AirportCode_T & getBoardingPoint() const