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