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