Go to the documentation of this file.00001
00002
00003
00004
00005 #include <cassert>
00006 #include <sstream>
00007
00008 #include <boost/date_time/gregorian/formatters.hpp>
00009
00010 #include <boost/archive/text_iarchive.hpp>
00011 #include <boost/archive/text_oarchive.hpp>
00012 #include <boost/serialization/access.hpp>
00013
00014 #include <stdair/basic/BasConst_Inventory.hpp>
00015 #include <stdair/basic/BasConst_BomDisplay.hpp>
00016 #include <stdair/bom/FlightDateKey.hpp>
00017
00018 namespace stdair {
00019
00020
00021 FlightDateKey::FlightDateKey()
00022 : _flightNumber (DEFAULT_FLIGHT_NUMBER),
00023 _departureDate (DEFAULT_DEPARTURE_DATE) {
00024 assert (false);
00025 }
00026
00027
00028 FlightDateKey::FlightDateKey (const FlightNumber_T& iFlightNumber,
00029 const Date_T& iFlightDate)
00030 : _flightNumber (iFlightNumber), _departureDate (iFlightDate) {
00031 }
00032
00033
00034 FlightDateKey::FlightDateKey (const FlightDateKey& iKey)
00035 : _flightNumber (iKey._flightNumber), _departureDate (iKey._departureDate) {
00036 }
00037
00038
00039 FlightDateKey::~FlightDateKey() {
00040 }
00041
00042
00043 void FlightDateKey::toStream (std::ostream& ioOut) const {
00044 ioOut << "FlightDateKey: " << toString();
00045 }
00046
00047
00048 void FlightDateKey::fromStream (std::istream& ioIn) {
00049 }
00050
00051
00052 const std::string FlightDateKey::toString() const {
00053 std::ostringstream oStr;
00054 const std::string& lDepartureDateStr =
00055 boost::gregorian::to_simple_string (_departureDate);
00056 oStr << _flightNumber
00057 << DEFAULT_KEY_SUB_FLD_DELIMITER << " " << lDepartureDateStr;
00058 return oStr.str();
00059 }
00060
00061
00062 void FlightDateKey::serialisationImplementationExport() const {
00063 std::ostringstream oStr;
00064 boost::archive::text_oarchive oa (oStr);
00065 oa << *this;
00066 }
00067
00068
00069 void FlightDateKey::serialisationImplementationImport() {
00070 std::istringstream iStr;
00071 boost::archive::text_iarchive ia (iStr);
00072 ia >> *this;
00073 }
00074
00075
00076 template<class Archive>
00077 void FlightDateKey::serialize (Archive& ioArchive,
00078 const unsigned int iFileVersion) {
00083 std::string lDepartureDateStr =
00084 boost::gregorian::to_simple_string (_departureDate);
00085 ioArchive & _flightNumber & lDepartureDateStr;
00086 }
00087
00088
00089
00090 namespace ba = boost::archive;
00091 template void FlightDateKey::serialize<ba::text_oarchive> (ba::text_oarchive&,
00092 unsigned int);
00093 template void FlightDateKey::serialize<ba::text_iarchive> (ba::text_iarchive&,
00094 unsigned int);
00095
00096
00097 }