StdAir Logo  0.44.0
C++ Standard Airline IT Object Library
BucketKey.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/bom/BucketKey.hpp>
00013 
00014 namespace stdair {
00015 
00016   // ////////////////////////////////////////////////////////////////////
00017   BucketKey::BucketKey() {
00018     assert (false);
00019   }
00020 
00021   // ////////////////////////////////////////////////////////////////////
00022   BucketKey::BucketKey (const SeatIndex_T& iSeatIndex)
00023     : _seatIndex (iSeatIndex) {
00024   }
00025 
00026   // ////////////////////////////////////////////////////////////////////
00027   BucketKey::BucketKey (const BucketKey& iBucketKey)
00028     : _seatIndex (iBucketKey._seatIndex) {
00029   }
00030 
00031   // ////////////////////////////////////////////////////////////////////
00032   BucketKey::~BucketKey() {
00033   }
00034 
00035   // ////////////////////////////////////////////////////////////////////
00036   void BucketKey::toStream (std::ostream& ioOut) const {
00037     ioOut << "BucketKey: " << toString() << std::endl;
00038   }
00039 
00040   // ////////////////////////////////////////////////////////////////////
00041   void BucketKey::fromStream (std::istream& ioIn) {
00042   }
00043 
00044   // ////////////////////////////////////////////////////////////////////
00045   const std::string BucketKey::toString() const {
00046     std::ostringstream oStr;
00047     oStr << _seatIndex;
00048     return oStr.str();
00049   }
00050 
00051   // ////////////////////////////////////////////////////////////////////
00052   void BucketKey::serialisationImplementationExport() const {
00053     std::ostringstream oStr;
00054     boost::archive::text_oarchive oa (oStr);
00055     oa << *this;
00056   }
00057 
00058   // ////////////////////////////////////////////////////////////////////
00059   void BucketKey::serialisationImplementationImport() {
00060     std::istringstream iStr;
00061     boost::archive::text_iarchive ia (iStr);
00062     ia >> *this;
00063   }
00064 
00065   // ////////////////////////////////////////////////////////////////////
00066   template<class Archive>
00067   void BucketKey::serialize (Archive& ioArchive,
00068                                  const unsigned int iFileVersion) {
00069     ioArchive & _seatIndex;
00070   }
00071 
00072   // ////////////////////////////////////////////////////////////////////
00073   // Explicit template instantiation
00074   namespace ba = boost::archive;
00075   template void BucketKey::serialize<ba::text_oarchive> (ba::text_oarchive&,
00076                                                          unsigned int);
00077   template void BucketKey::serialize<ba::text_iarchive> (ba::text_iarchive&,
00078                                                          unsigned int);
00079   // ////////////////////////////////////////////////////////////////////
00080 
00081 }