AirSched Logo  0.1.4
C++ Simulated Airline Schedule Manager Library
SegmentPathPeriod.hpp
Go to the documentation of this file.
00001 #ifndef __AIRSCHED_BOM_SEGMENTPATHPERIOD_HPP
00002 #define __AIRSCHED_BOM_SEGMENTPATHPERIOD_HPP
00003 
00004 // //////////////////////////////////////////////////////////////////////
00005 // Import section
00006 // //////////////////////////////////////////////////////////////////////
00007 // STL
00008 #include <iosfwd>
00009 #include <string>
00010 // StdAir
00011 #include <stdair/bom/BomAbstract.hpp>
00012 // AirSched
00013 #include <airsched/bom/SegmentPathPeriodKey.hpp>
00014 #include <airsched/bom/SegmentPathPeriodTypes.hpp>
00015 
00017 namespace boost {
00018   namespace serialization {
00019     class access;
00020   }
00021 }
00022 
00024 namespace stdair {
00025   template <typename BOM> class FacBom;
00026   class FacBomManager;
00027   class SegmentPeriod;
00028 }
00029 
00030 namespace AIRSCHED {
00031 
00039   class SegmentPathPeriod : public stdair::BomAbstract {
00043     template <typename BOM> friend class stdair::FacBom;
00044     friend  class stdair::FacBomManager;
00045     friend class boost::serialization::access;
00046 
00047   public:
00048     // ////////// Type definitions ////////////
00052     typedef SegmentPathPeriodKey Key_T;
00053 
00054 
00055   public:
00056     // /////////// Getters /////////////
00060     const Key_T& getKey() const {
00061       return _key;
00062     }
00063 
00067     stdair::BomAbstract* const getParent() const {
00068       return _parent;
00069     }
00070 
00072     const stdair::PeriodStruct& getDeparturePeriod() const {
00073       return _key.getPeriod();
00074     }
00075 
00077     const DateOffsetList_T& getBoardingDateOffsetList () const {
00078       return _key.getBoardingDateOffsetList();
00079     }
00080 
00082     const stdair::NbOfSegments_T getNbOfSegments() const {
00083       return _key.getNbOfSegments();
00084     }
00085 
00087     const stdair::NbOfAirlines_T& getNbOfAirlines() const {
00088       return _key.getNbOfAirlines();
00089     }
00090 
00092     const stdair::Duration_T& getElapsedTime() const {
00093       return _key.getElapsedTime();
00094     }
00095 
00097     const stdair::Duration_T& getBoardingTime() const {
00098       return _key.getBoardingTime();
00099     }
00100 
00104     const stdair::HolderMap_T& getHolderMap() const {
00105       return _holderMap;
00106     }
00107 
00113     stdair::SegmentPeriod* getLastSegmentPeriod() const;
00114 
00120     stdair::SegmentPeriod* getFirstSegmentPeriod() const;
00121 
00126     const stdair::AirportCode_T& getDestination() const;
00127 
00128 
00129   public:
00130     // ////////////// Business methods ////////////////
00148     Key_T connectWithAnotherSegment (const SegmentPathPeriod&) const;
00149 
00155     bool checkCircle (const stdair::AirportCode_T&) const;
00156 
00161     bool isAirlineFlown (const stdair::AirlineCode_T&) const;
00162 
00167     bool isDepartureDateValid (const stdair::Date_T&) const;
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:
00214     void serialisationImplementationExport() const;
00215     void serialisationImplementationImport();
00216 
00217 
00218   protected:
00219     // ////////// Constructors and destructors /////////
00223     SegmentPathPeriod (const Key_T&);
00224 
00228     ~SegmentPathPeriod();
00229 
00230   private:
00234     SegmentPathPeriod();
00235 
00239     SegmentPathPeriod (const SegmentPathPeriod&);
00240 
00241 
00242   protected:
00243     // ////////// Attributes /////////
00249     Key_T _key;
00250 
00254     stdair::BomAbstract* _parent;
00255 
00262     stdair::HolderMap_T _holderMap;
00263   };
00264 
00265 }
00266 #endif // __AIRSCHED_BOM_SEGMENTPATHPERIOD_HPP
00267