StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
NestingStructureKey.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  NestingStructureKey::NestingStructureKey() : _nestingStructureCode (DEFAULT_NESTING_STRUCTURE_CODE) {
19  assert (false);
20  }
21 
22  // ////////////////////////////////////////////////////////////////////
23  NestingStructureKey::NestingStructureKey (const NestingStructureKey& iNestingStructureKey)
24  : _nestingStructureCode (iNestingStructureKey._nestingStructureCode) {
25  }
26 
27  // ////////////////////////////////////////////////////////////////////
28  NestingStructureKey::NestingStructureKey (const NestingStructureCode_T& iNestingStructureCode)
29  : _nestingStructureCode (iNestingStructureCode) {
30  }
31 
32  // ////////////////////////////////////////////////////////////////////
34  }
35 
36  // ////////////////////////////////////////////////////////////////////
37  void NestingStructureKey::toStream (std::ostream& ioOut) const {
38  ioOut << "NestingStructureKey: " << toString();
39  }
40 
41  // ////////////////////////////////////////////////////////////////////
42  void NestingStructureKey::fromStream (std::istream& ioIn) {
43  }
44 
45  // ////////////////////////////////////////////////////////////////////
46  const std::string NestingStructureKey::toString() const {
47  std::ostringstream oStr;
48  oStr << _nestingStructureCode;
49  return oStr.str();
50  }
51 
52  // ////////////////////////////////////////////////////////////////////
53  void NestingStructureKey::serialisationImplementationExport() const {
54  std::ostringstream oStr;
55  boost::archive::text_oarchive oa (oStr);
56  oa << *this;
57  }
58 
59  // ////////////////////////////////////////////////////////////////////
60  void NestingStructureKey::serialisationImplementationImport() {
61  std::istringstream iStr;
62  boost::archive::text_iarchive ia (iStr);
63  ia >> *this;
64  }
65 
66  // ////////////////////////////////////////////////////////////////////
67  template<class Archive>
68  void NestingStructureKey::serialize (Archive& ioArchive,
69  const unsigned int iFileVersion) {
74  ioArchive & _nestingStructureCode;
75  }
76 
77  // ////////////////////////////////////////////////////////////////////
78  // Explicit template instantiation
79  namespace ba = boost::archive;
80  template void NestingStructureKey::serialize<ba::text_oarchive> (ba::text_oarchive&,
81  unsigned int);
82  template void NestingStructureKey::serialize<ba::text_iarchive> (ba::text_iarchive&,
83  unsigned int);
84  // ////////////////////////////////////////////////////////////////////
85 
86 }
void toStream(std::ostream &ioOut) const
void fromStream(std::istream &ioIn)
Handle on the StdAir library context.
Key of a given policy, made of a policy code.
std::string NestingStructureCode_T
const NestingStructureCode_T DEFAULT_NESTING_STRUCTURE_CODE
const std::string toString() const
void serialize(Archive &ar, const unsigned int iFileVersion)