StdAir Logo  1.00.8
C++ Standard Airline IT Object Library
InventoryKey.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
14 
15 namespace stdair {
16 
17  // ////////////////////////////////////////////////////////////////////
18  InventoryKey::InventoryKey() : _airlineCode (DEFAULT_AIRLINE_CODE) {
19  assert (false);
20  }
21 
22  // ////////////////////////////////////////////////////////////////////
23  InventoryKey::InventoryKey (const AirlineCode_T& iAirlineCode)
24  : _airlineCode (iAirlineCode) {
25  }
26 
27  // ////////////////////////////////////////////////////////////////////
28  InventoryKey::InventoryKey (const InventoryKey& iKey)
29  : _airlineCode (iKey._airlineCode) {
30  }
31 
32  // ////////////////////////////////////////////////////////////////////
34  }
35 
36  // ////////////////////////////////////////////////////////////////////
37  void InventoryKey::toStream (std::ostream& ioOut) const {
38  ioOut << "InventoryKey: " << toString();
39  }
40 
41  // ////////////////////////////////////////////////////////////////////
42  void InventoryKey::fromStream (std::istream& ioIn) {
43  }
44 
45  // ////////////////////////////////////////////////////////////////////
46  const std::string InventoryKey::toString() const {
47  std::ostringstream oStr;
48  oStr << _airlineCode;
49  return oStr.str();
50  }
51 
52  // ////////////////////////////////////////////////////////////////////
53  void InventoryKey::serialisationImplementationExport() const {
54  std::ostringstream oStr;
55  boost::archive::text_oarchive oa (oStr);
56  oa << *this;
57  }
58 
59  // ////////////////////////////////////////////////////////////////////
60  void InventoryKey::serialisationImplementationImport() {
61  std::istringstream iStr;
62  boost::archive::text_iarchive ia (iStr);
63  ia >> *this;
64  }
65 
66  // ////////////////////////////////////////////////////////////////////
67  template<class Archive>
68  void InventoryKey::serialize (Archive& ioArchive,
69  const unsigned int iFileVersion) {
70  ioArchive & _airlineCode;
71  }
72 
73  // ////////////////////////////////////////////////////////////////////
74  // Explicit template instantiation
75  namespace ba = boost::archive;
76  template void InventoryKey::serialize<ba::text_oarchive> (ba::text_oarchive&,
77  unsigned int);
78  template void InventoryKey::serialize<ba::text_iarchive> (ba::text_iarchive&,
79  unsigned int);
80  // ////////////////////////////////////////////////////////////////////
81 
82 }
stdair::InventoryKey::fromStream
void fromStream(std::istream &ioIn)
Definition: InventoryKey.cpp:42
stdair::AirlineCode_T
std::string AirlineCode_T
Definition: stdair_basic_types.hpp:31
boost::archive
Definition: FlightDate.hpp:21
stdair::InventoryKey::toString
const std::string toString() const
Definition: InventoryKey.cpp:46
stdair::DEFAULT_AIRLINE_CODE
const AirlineCode_T DEFAULT_AIRLINE_CODE
stdair::InventoryKey::toStream
void toStream(std::ostream &ioOut) const
Definition: InventoryKey.cpp:37
stdair
Handle on the StdAir library context.
Definition: BasChronometer.cpp:9
BasConst_Inventory.hpp
InventoryKey.hpp
stdair::InventoryKey::serialize
void serialize(Archive &ar, const unsigned int iFileVersion)
Definition: InventoryKey.cpp:68
stdair::InventoryKey
Key of a given inventory, made of the airline code.
Definition: InventoryKey.hpp:26
stdair::InventoryKey::~InventoryKey
~InventoryKey()
Definition: InventoryKey.cpp:33