StdAir Logo  1.00.17
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
SegmentDateKey.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// STL
5#include <cassert>
6#include <sstream>
7// Boost.Serialization
8#include <boost/archive/text_iarchive.hpp>
9#include <boost/archive/text_oarchive.hpp>
10#include <boost/serialization/access.hpp>
11// StdAir
15
16namespace stdair {
17
18 // ////////////////////////////////////////////////////////////////////
19 SegmentDateKey::SegmentDateKey()
20 : _boardingPoint (DEFAULT_ORIGIN), _offPoint (DEFAULT_DESTINATION) {
21 assert (false);
22 }
23
24 // ////////////////////////////////////////////////////////////////////
25 SegmentDateKey::SegmentDateKey (const AirportCode_T& iBoardingPoint,
26 const AirportCode_T& iOffPoint)
27 : _boardingPoint (iBoardingPoint), _offPoint (iOffPoint) {
28 }
29
30 // ////////////////////////////////////////////////////////////////////
31 SegmentDateKey::SegmentDateKey (const SegmentDateKey& iKey)
32 : _boardingPoint (iKey._boardingPoint), _offPoint (iKey._offPoint) {
33 }
34
35 // ////////////////////////////////////////////////////////////////////
38
39 // ////////////////////////////////////////////////////////////////////
40 void SegmentDateKey::toStream (std::ostream& ioOut) const {
41 ioOut << "SegmentDateKey: " << toString() << std::endl;
42 }
43
44 // ////////////////////////////////////////////////////////////////////
45 void SegmentDateKey::fromStream (std::istream& ioIn) {
46 }
47
48 // ////////////////////////////////////////////////////////////////////
49 const std::string SegmentDateKey::toString() const {
50 std::ostringstream oStr;
51 oStr << _boardingPoint
52 << DEFAULT_KEY_SUB_FLD_DELIMITER << " " << _offPoint;
53 return oStr.str();
54 }
55
56 // ////////////////////////////////////////////////////////////////////
57 void SegmentDateKey::serialisationImplementationExport() const {
58 std::ostringstream oStr;
59 boost::archive::text_oarchive oa (oStr);
60 oa << *this;
61 }
62
63 // ////////////////////////////////////////////////////////////////////
64 void SegmentDateKey::serialisationImplementationImport() {
65 std::istringstream iStr;
66 boost::archive::text_iarchive ia (iStr);
67 ia >> *this;
68 }
69
70 // ////////////////////////////////////////////////////////////////////
71 template<class Archive>
72 void SegmentDateKey::serialize (Archive& ioArchive,
73 const unsigned int iFileVersion) {
74 ioArchive & _boardingPoint & _offPoint;
75 }
76
77 // ////////////////////////////////////////////////////////////////////
78 // Explicit template instantiation
79 namespace ba = boost::archive;
80 template void SegmentDateKey::serialize<ba::text_oarchive>(ba::text_oarchive&,
81 unsigned int);
82 template void SegmentDateKey::serialize<ba::text_iarchive>(ba::text_iarchive&,
83 unsigned int);
84 // ////////////////////////////////////////////////////////////////////
85
86}
Handle on the StdAir library context.
const std::string DEFAULT_KEY_SUB_FLD_DELIMITER
const AirportCode_T DEFAULT_DESTINATION
const AirportCode_T DEFAULT_ORIGIN
LocationCode_T AirportCode_T
void fromStream(std::istream &ioIn)
void toStream(std::ostream &ioOut) const
const std::string toString() const
void serialize(Archive &ar, const unsigned int iFileVersion)