$treeview $search $mathjax
StdAir Logo  1.00.2
$projectbrief
$projectbrief
$searchbox

stdair/bom/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 
00029   // Define the routing leg keys list type.
00030   typedef std::list<std::string> RoutingLegKeyList_T;
00031 
00036   class SegmentDate : public BomAbstract {
00037     template <typename BOM> friend class FacBom;  
00038     template <typename BOM> friend class FacCloneBom;
00039     friend class FacBomManager;
00040     friend class boost::serialization::access;
00041     
00042   public:
00043     // ////////// Type definitions ////////////
00047     typedef SegmentDateKey Key_T;
00048 
00049 
00050   public:
00051     // /////////// Getters /////////////
00055     const Key_T& getKey() const {
00056       return _key;
00057     }
00058 
00062     BomAbstract* const getParent() const {
00063       return _parent;
00064     }
00065     
00069     const AirportCode_T& getBoardingPoint() const {
00070       return _key.getBoardingPoint();
00071     }
00072 
00076     const AirportCode_T& getOffPoint() const {
00077       return _key.getOffPoint();
00078     }
00079 
00083     const HolderMap_T& getHolderMap() const {
00084       return _holderMap;
00085     }
00086 
00090     const Date_T& getBoardingDate() const {
00091       return _boardingDate;
00092     }
00093 
00097     const Duration_T& getBoardingTime() const {
00098       return _boardingTime;
00099     }
00100 
00104     const Date_T& getOffDate() const {
00105       return _offDate;
00106     }
00107 
00111     const Duration_T& getOffTime() const {
00112       return _offTime;
00113     }
00114 
00118     const Duration_T& getElapsedTime() const {
00119       return _elapsedTime;
00120     }
00121 
00125     const Distance_T& getDistance() const {
00126       return _distance;
00127     }
00128 
00132     const DateOffset_T getDateOffset() const {
00133       return _offDate - _boardingDate;
00134     }
00135 
00144     const Duration_T getTimeOffset() const;
00145 
00149     SegmentDate* getOperatingSegmentDate () const {
00150       return _operatingSegmentDate;
00151     }
00152     
00156     const SegmentDateList_T& getMarketingSegmentDateList () const {
00157       return _marketingSegmentDateList;
00158     }
00159     
00163     const RoutingLegKeyList_T& getLegKeyList () const {
00164       return _routingLegKeyList;
00165     }
00166     
00167   public:
00168     // ///////// Setters //////////
00172     void setBoardingDate (const Date_T& iBoardingDate) {
00173       _boardingDate = iBoardingDate;
00174     }
00175 
00179     void setBoardingTime (const Duration_T& iBoardingTime) {
00180       _boardingTime = iBoardingTime;
00181     }
00182 
00186     void setOffDate (const Date_T& iOffDate) {
00187       _offDate = iOffDate;
00188     }
00189 
00193     void setOffTime (const Duration_T& iOffTime) {
00194       _offTime = iOffTime;
00195     }
00196 
00200     void setElapsedTime (const Duration_T& iElapsedTime) {
00201       _elapsedTime = iElapsedTime;
00202     }
00203 
00207     void setDistance (const Distance_T& iDistance) {
00208       _distance = iDistance;
00209     }
00210 
00214     void addLegKey (const std::string& iLegKey) {
00215       _routingLegKeyList.push_back(iLegKey);
00216     }
00217 
00218   private:
00222     void linkWithOperating (SegmentDate& iSegmentDate) {
00223       _operatingSegmentDate = &iSegmentDate;
00224     }
00225 
00226   public:
00227     // /////////// Display support methods /////////
00233     void toStream (std::ostream& ioOut) const {
00234       ioOut << toString();
00235     }
00236 
00242     void fromStream (std::istream& ioIn) {
00243     }
00244 
00248     std::string toString() const;
00249     
00253     const std::string describeKey() const {
00254       return _key.toString();
00255     }
00256 
00257     
00258   public:
00259     // /////////// (Boost) Serialisation support methods /////////
00263     template<class Archive>
00264     void serialize (Archive& ar, const unsigned int iFileVersion);
00265 
00266   private:
00274     void serialisationImplementationExport() const;
00275     void serialisationImplementationImport();
00276 
00277 
00278   protected:
00279     // ////////// Constructors and destructors /////////
00283     SegmentDate (const Key_T&);
00284 
00288     virtual ~SegmentDate();
00289 
00290   private:
00294     SegmentDate();
00295 
00299     SegmentDate (const SegmentDate&);
00300 
00301 
00302   protected:
00303     // ////////// Attributes /////////
00307     Key_T _key;
00308 
00312     BomAbstract* _parent;
00313     
00317     HolderMap_T _holderMap;
00318 
00325     SegmentDate* _operatingSegmentDate;
00326 
00333     SegmentDateList_T _marketingSegmentDateList;
00334 
00338     Date_T _boardingDate;
00339 
00343     Duration_T _boardingTime;
00344 
00348     Date_T _offDate;
00349 
00353     Duration_T _offTime;
00354 
00358     Duration_T _elapsedTime;
00359 
00363     Distance_T _distance;
00364 
00368     RoutingLegKeyList_T _routingLegKeyList;
00369   };
00370 
00371 }
00372 #endif // __STDAIR_BOM_SEGMENTDATE_HPP
00373