StdAir Logo  0.44.0
C++ Standard Airline IT Object Library
SegmentDate.hpp
Go to the documentation of this file.
00001 #ifndef __STDAIR_BOM_SEGMENTDATE_HPP
00002 #define __STDAIR_BOM_SEGMENTDATE_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/SegmentDateKey.hpp>
00014 #include <stdair/bom/SegmentDateTypes.hpp>
00015 
00017 namespace boost {
00018   namespace serialization {
00019     class access;
00020   }
00021 }
00022 
00023 namespace stdair {
00024 
00026   struct SegmentCabinKey;
00027   class SegmentCabin;
00028 
00033   class SegmentDate : public BomAbstract {
00034     template <typename BOM> friend class FacBom;
00035     friend class FacBomManager;
00036     friend class boost::serialization::access;
00037     
00038   public:
00039     // ////////// Type definitions ////////////
00043     typedef SegmentDateKey Key_T;
00044 
00045 
00046   public:
00047     // /////////// Getters /////////////
00049     const Key_T& getKey() const {
00050       return _key;
00051     }
00052 
00054     BomAbstract* const getParent() const {
00055       return _parent;
00056     }
00057     
00059     const AirportCode_T& getBoardingPoint() const {
00060       return _key.getBoardingPoint();
00061     }
00062 
00064     const AirportCode_T& getOffPoint() const {
00065       return _key.getOffPoint();
00066     }
00067 
00069     const HolderMap_T& getHolderMap() const {
00070       return _holderMap;
00071     }
00072 
00074     const Date_T& getBoardingDate() const {
00075       return _boardingDate;
00076     }
00077 
00079     const Duration_T& getBoardingTime() const {
00080       return _boardingTime;
00081     }
00082 
00084     const Date_T& getOffDate() const {
00085       return _offDate;
00086     }
00087 
00089     const Duration_T& getOffTime() const {
00090       return _offTime;
00091     }
00092 
00094     const Duration_T& getElapsedTime() const {
00095       return _elapsedTime;
00096     }
00097 
00099     const Distance_T& getDistance() const {
00100       return _distance;
00101     }
00102 
00104     const DateOffset_T getDateOffset() const {
00105       return _offDate - _boardingDate;
00106     }
00107 
00116     const Duration_T getTimeOffset() const;
00117 
00121     SegmentDate* getOperatingSegmentDate () const {
00122       return _operatingSegmentDate;
00123     }
00124     
00128     const SegmentDateList_T& getMarketingSegmentDateList () const {
00129       return _marketingSegmentDateList;
00130     }
00131     
00132   public:
00133     // ///////// Setters //////////
00135     void setBoardingDate (const Date_T& iBoardingDate) {
00136       _boardingDate = iBoardingDate;
00137     }
00138 
00140     void setBoardingTime (const Duration_T& iBoardingTime) {
00141       _boardingTime = iBoardingTime;
00142     }
00143 
00145     void setOffDate (const Date_T& iOffDate) {
00146       _offDate = iOffDate;
00147     }
00148 
00150     void setOffTime (const Duration_T& iOffTime) {
00151       _offTime = iOffTime;
00152     }
00153 
00155     void setElapsedTime (const Duration_T& iElapsedTime) {
00156       _elapsedTime = iElapsedTime;
00157     }
00158 
00160     void setDistance (const Distance_T& iDistance) {
00161       _distance = iDistance;
00162     }
00163     
00165     void linkWithOperating (SegmentDate& iSegmentDate) {
00166       _operatingSegmentDate = &iSegmentDate;
00167     }
00168 
00169   public:
00170     // /////////// Display support methods /////////
00176     void toStream (std::ostream& ioOut) const {
00177       ioOut << toString();
00178     }
00179 
00185     void fromStream (std::istream& ioIn) {
00186     }
00187 
00191     std::string toString() const;
00192     
00196     const std::string describeKey() const {
00197       return _key.toString();
00198     }
00199 
00200     
00201   public:
00202     // /////////// (Boost) Serialisation support methods /////////
00206     template<class Archive>
00207     void serialize (Archive& ar, const unsigned int iFileVersion);
00208 
00209   private:
00217     void serialisationImplementationExport() const;
00218     void serialisationImplementationImport();
00219 
00220 
00221   protected:
00222     // ////////// Constructors and destructors /////////
00226     SegmentDate (const Key_T&);
00227 
00231     virtual ~SegmentDate();
00232 
00233   private:
00237     SegmentDate();
00238 
00242     SegmentDate (const SegmentDate&);
00243 
00244 
00245   protected:
00246     // ////////// Attributes /////////
00250     Key_T _key;
00251 
00255     BomAbstract* _parent;
00256     
00260     HolderMap_T _holderMap;
00261 
00268     SegmentDate* _operatingSegmentDate;
00269 
00276     SegmentDateList_T _marketingSegmentDateList;
00277 
00281     Date_T _boardingDate;
00282 
00286     Duration_T _boardingTime;
00287 
00291     Date_T _offDate;
00292 
00296     Duration_T _offTime;
00297 
00301     Duration_T _elapsedTime;
00302 
00306     Distance_T _distance;
00307   };
00308 
00309 }
00310 #endif // __STDAIR_BOM_SEGMENTDATE_HPP
00311