StdAir Logo  0.43.0
C++ Standard Airline IT 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::serialisationImplementation() {
00053     std::ostringstream oStr;
00054     boost::archive::text_oarchive oa (oStr);
00055     oa << *this;
00056 
00057     std::istringstream iStr;
00058     boost::archive::text_iarchive ia (iStr);
00059     ia >> *this;
00060   }
00061 
00062   // ////////////////////////////////////////////////////////////////////
00063   template<class Archive>
00064   void BucketKey::serialize (Archive& ioArchive,
00065                                  const unsigned int iFileVersion) {
00066     ioArchive & _seatIndex;
00067   }
00068 
00069   // ////////////////////////////////////////////////////////////////////
00070   // Explicit template instantiation
00071   namespace ba = boost::archive;
00072   template void BucketKey::serialize<ba::text_oarchive> (ba::text_oarchive&,
00073                                                          unsigned int);
00074   template void BucketKey::serialize<ba::text_iarchive> (ba::text_iarchive&,
00075                                                          unsigned int);
00076   // ////////////////////////////////////////////////////////////////////
00077 
00078 }