$treeview $search $mathjax
00001 // ////////////////////////////////////////////////////////////////////// 00002 // Import section 00003 // ////////////////////////////////////////////////////////////////////// 00004 // STL 00005 #include <cassert> 00006 #include <sstream> 00007 // StdAir 00008 #include <stdair/basic/BasConst_BookingClass.hpp> 00009 #include <stdair/basic/BasConst_Inventory.hpp> 00010 #include <stdair/bom/BomManager.hpp> 00011 #include <stdair/bom/SegmentDate.hpp> 00012 #include <stdair/bom/SegmentCabin.hpp> 00013 00014 namespace stdair { 00015 00016 // //////////////////////////////////////////////////////////////////// 00017 SegmentDate::SegmentDate() 00018 : _key (DEFAULT_ORIGIN, DEFAULT_DESTINATION), _parent (NULL), 00019 _operatingSegmentDate (NULL) { 00020 assert (false); 00021 } 00022 00023 // //////////////////////////////////////////////////////////////////// 00024 SegmentDate::SegmentDate (const SegmentDate& iSegmentDate) 00025 : _key (iSegmentDate._key), 00026 _parent (NULL), 00027 _operatingSegmentDate (NULL), 00028 _boardingDate (iSegmentDate._boardingDate), 00029 _boardingTime (iSegmentDate._boardingTime), 00030 _offDate (iSegmentDate._offDate), 00031 _offTime (iSegmentDate._offTime), 00032 _elapsedTime (iSegmentDate._elapsedTime), 00033 _distance (iSegmentDate._distance), 00034 _routingLegKeyList (iSegmentDate._routingLegKeyList) { 00035 } 00036 00037 // //////////////////////////////////////////////////////////////////// 00038 SegmentDate::SegmentDate (const Key_T& iKey) 00039 : _key (iKey), _parent (NULL) , 00040 _operatingSegmentDate (NULL) { 00041 } 00042 00043 // //////////////////////////////////////////////////////////////////// 00044 SegmentDate::~SegmentDate() { 00045 } 00046 00047 // //////////////////////////////////////////////////////////////////// 00048 std::string SegmentDate::toString() const { 00049 std::ostringstream oStr; 00050 oStr << describeKey(); 00051 return oStr.str(); 00052 } 00053 00054 // //////////////////////////////////////////////////////////////////// 00055 const Duration_T SegmentDate::getTimeOffset() const { 00056 // TimeOffset = (OffTime - BoardingTime) + (OffDate - BoardingDate) * 24 00057 // - ElapsedTime 00058 Duration_T oTimeOffset = (_offTime - _boardingTime); 00059 const DateOffset_T& lDateOffset = getDateOffset(); 00060 const Duration_T lDateOffsetInHours (lDateOffset.days() * 24, 0, 0); 00061 oTimeOffset += lDateOffsetInHours - _elapsedTime; 00062 return oTimeOffset; 00063 } 00064 } 00065