StdAir Logo  0.43.0
C++ Standard Airline IT Library
FareFamilyKey.cpp
Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 #include <sstream>
00007 // Boost.Serialization
00008 #include <boost/archive/text_iarchive.hpp>
00009 #include <boost/archive/text_oarchive.hpp>
00010 #include <boost/serialization/access.hpp>
00011 // StdAir
00012 #include <stdair/basic/BasConst_Inventory.hpp>
00013 #include <stdair/bom/FareFamilyKey.hpp>
00014 
00015 namespace stdair {
00016 
00017   // ////////////////////////////////////////////////////////////////////
00018   FareFamilyKey::FareFamilyKey() : _familyCode (DEFAULT_FARE_FAMILY_CODE) {
00019     assert (false);
00020   }
00021 
00022   // ////////////////////////////////////////////////////////////////////
00023   FareFamilyKey::FareFamilyKey (const FareFamilyKey& iFareFamilyKey)
00024     : _familyCode (iFareFamilyKey._familyCode) {
00025   }
00026 
00027   // ////////////////////////////////////////////////////////////////////
00028   FareFamilyKey::FareFamilyKey (const FamilyCode_T& iFamilyCode)
00029     : _familyCode (iFamilyCode) {
00030   }
00031 
00032   // ////////////////////////////////////////////////////////////////////
00033   FareFamilyKey::~FareFamilyKey() {
00034   }
00035 
00036   // ////////////////////////////////////////////////////////////////////
00037   void FareFamilyKey::toStream (std::ostream& ioOut) const {
00038     ioOut << "FareFamilyKey: " << toString();
00039   }
00040 
00041   // ////////////////////////////////////////////////////////////////////
00042   void FareFamilyKey::fromStream (std::istream& ioIn) {
00043   }
00044 
00045   // ////////////////////////////////////////////////////////////////////
00046   const std::string FareFamilyKey::toString() const {
00047     std::ostringstream oStr;
00048     oStr << _familyCode;
00049     return oStr.str();
00050   }
00051 
00052   // ////////////////////////////////////////////////////////////////////
00053   void FareFamilyKey::serialisationImplementation() {
00054     std::ostringstream oStr;
00055     boost::archive::text_oarchive oa (oStr);
00056     oa << *this;
00057 
00058     std::istringstream iStr;
00059     boost::archive::text_iarchive ia (iStr);
00060     ia >> *this;
00061   }
00062 
00063   // ////////////////////////////////////////////////////////////////////
00064   template<class Archive>
00065   void FareFamilyKey::serialize (Archive& ioArchive,
00066                                    const unsigned int iFileVersion) {
00071     ioArchive & _familyCode;
00072   }
00073 
00074   // ////////////////////////////////////////////////////////////////////
00075   // Explicit template instantiation
00076   namespace ba = boost::archive;
00077   template void FareFamilyKey::serialize<ba::text_oarchive> (ba::text_oarchive&,
00078                                                              unsigned int);
00079   template void FareFamilyKey::serialize<ba::text_iarchive> (ba::text_iarchive&,
00080                                                              unsigned int);
00081   // ////////////////////////////////////////////////////////////////////
00082 
00083 }