00001 #ifndef __STDAIR_BOM_LEGDATE_HPP 00002 #define __STDAIR_BOM_LEGDATE_HPP 00003 00004 // ////////////////////////////////////////////////////////////////////// 00005 // Import section 00006 // ////////////////////////////////////////////////////////////////////// 00007 // STL 00008 #include <iosfwd> 00009 #include <string> 00010 // StdAir 00011 #include <stdair/stdair_inventory_types.hpp> 00012 #include <stdair/bom/BomAbstract.hpp> 00013 #include <stdair/bom/LegDateKey.hpp> 00014 #include <stdair/bom/LegDateTypes.hpp> 00015 00016 namespace stdair { 00017 00019 struct LegCabinKey; 00020 class LegCabin; 00021 00025 class LegDate : public BomAbstract { 00026 template <typename BOM> friend class FacBom; 00027 friend class FacBomManager; 00028 00029 public: 00030 // ////////// Type definitions //////////// 00032 typedef LegDateKey Key_T; 00033 00034 00035 public: 00036 // /////////// Getters ///////////// 00038 const Key_T& getKey() const { 00039 return _key; 00040 } 00041 00043 BomAbstract* const getParent() const { 00044 return _parent; 00045 } 00046 00048 const AirportCode_T& getBoardingPoint() const { 00049 return _key.getBoardingPoint(); 00050 } 00051 00059 const AirlineCode_T& getAirlineCode() const; 00060 00064 const HolderMap_T& getHolderMap() const { 00065 return _holderMap; 00066 } 00067 00078 LegCabin* getLegCabin (const std::string& iLegCabinKeyStr) const; 00079 00090 LegCabin* getLegCabin (const LegCabinKey&) const; 00091 00093 const AirportCode_T& getOffPoint() const { 00094 return _offPoint; 00095 } 00096 00098 const Date_T& getBoardingDate() const { 00099 return _boardingDate; 00100 } 00101 00103 const Duration_T& getBoardingTime() const { 00104 return _boardingTime; 00105 } 00106 00108 const Date_T& getOffDate() const { 00109 return _offDate; 00110 } 00111 00113 const Duration_T& getOffTime() const { 00114 return _offTime; 00115 } 00116 00118 const Duration_T& getElapsedTime() const { 00119 return _elapsedTime; 00120 } 00121 00123 const Distance_T& getDistance() const { 00124 return _distance; 00125 } 00126 00128 const CabinCapacity_T& getCapacity() const { 00129 return _capacity; 00130 } 00131 00133 const DateOffset_T getDateOffset() const { 00134 return _offDate - _boardingDate; 00135 } 00136 00141 const Duration_T getTimeOffset() const; 00142 00143 00144 public: 00145 // ///////// Setters ////////// 00147 void setOffPoint (const AirportCode_T& iOffPoint) { 00148 _offPoint = iOffPoint; 00149 } 00150 00152 void setBoardingDate (const Date_T& iBoardingDate) { 00153 _boardingDate = iBoardingDate; 00154 } 00155 00157 void setBoardingTime (const Duration_T& iBoardingTime) { 00158 _boardingTime = iBoardingTime; 00159 } 00160 00162 void setOffDate (const Date_T& iOffDate) { 00163 _offDate = iOffDate; 00164 } 00165 00167 void setOffTime (const Duration_T& iOffTime) { 00168 _offTime = iOffTime; 00169 } 00170 00172 void setElapsedTime (const Duration_T&); 00173 00174 private: 00176 void updateDistanceFromElapsedTime(); 00177 00178 00179 public: 00180 // /////////// Display support methods ///////// 00183 void toStream (std::ostream& ioOut) const { 00184 ioOut << toString(); 00185 } 00186 00189 void fromStream (std::istream& ioIn) { 00190 } 00191 00193 std::string toString() const; 00194 00196 const std::string describeKey() const { 00197 return _key.toString(); 00198 } 00199 00200 00201 protected: 00202 // ////////// Constructors and destructors ///////// 00204 LegDate (const Key_T&); 00206 virtual ~LegDate(); 00207 00208 private: 00210 LegDate(); 00212 LegDate (const LegDate&); 00213 00214 00215 protected: 00216 // ////////// Attributes ///////// 00218 Key_T _key; 00219 00221 BomAbstract* _parent; 00222 00224 HolderMap_T _holderMap; 00225 00227 AirportCode_T _offPoint; 00228 00230 Date_T _boardingDate; 00231 00233 Duration_T _boardingTime; 00234 00236 Date_T _offDate; 00237 00239 Duration_T _offTime; 00240 00242 Duration_T _elapsedTime; 00243 00245 Distance_T _distance; 00246 00248 CabinCapacity_T _capacity; 00249 }; 00250 00251 } 00252 #endif // __STDAIR_BOM_LEGDATE_HPP 00253