StdAir Logo  0.43.0
C++ Standard Airline IT Library
BomRootKey.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_General.hpp>
00013 #include <stdair/bom/BomRootKey.hpp>
00014 
00015 namespace stdair {
00016 
00017   // ////////////////////////////////////////////////////////////////////
00018   BomRootKey::BomRootKey()
00019     : _id (DEFAULT_BOM_ROOT_KEY) {
00020   }
00021 
00022   // ////////////////////////////////////////////////////////////////////
00023   BomRootKey::BomRootKey (const BomRootKey& iBomRootKey)
00024     : _id (iBomRootKey._id) {
00025   }
00026 
00027   // ////////////////////////////////////////////////////////////////////
00028   BomRootKey::BomRootKey (const std::string& iIdentification)
00029     : _id (iIdentification) {
00030   }
00031 
00032   // ////////////////////////////////////////////////////////////////////
00033   BomRootKey::~BomRootKey() {
00034   }
00035 
00036   // ////////////////////////////////////////////////////////////////////
00037   void BomRootKey::toStream (std::ostream& ioOut) const {
00038     ioOut << "BomRootKey: " << toString() << std::endl;
00039   }
00040   
00041   // ////////////////////////////////////////////////////////////////////
00042   void BomRootKey::fromStream (std::istream& ioIn) {
00043   }
00044   
00045   // ////////////////////////////////////////////////////////////////////
00046   const std::string BomRootKey::toString() const {
00047     std::ostringstream oStr;
00048     oStr << _id;
00049     return oStr.str();
00050   }
00051   
00052   // ////////////////////////////////////////////////////////////////////
00053   void BomRootKey::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 BomRootKey::serialize (Archive& ioArchive,
00066                               const unsigned int iFileVersion) {
00067     ioArchive & _id;
00068   }
00069 
00070   // ////////////////////////////////////////////////////////////////////
00071   // Explicit template instantiation
00072   namespace ba = boost::archive;
00073   template void BomRootKey::serialize<ba::text_oarchive> (ba::text_oarchive&,
00074                                                           unsigned int);
00075   template void BomRootKey::serialize<ba::text_iarchive> (ba::text_iarchive&,
00076                                                           unsigned int);
00077   // ////////////////////////////////////////////////////////////////////
00078 
00079 }