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

stdair/bom/LegDate.hpp

Go to the documentation of this file.
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     template <typename BOM> friend class FacCloneBom;
00028     friend class FacBomManager;
00029 
00030   public:
00031     // ////////// Type definitions ////////////
00033     typedef LegDateKey Key_T;
00034 
00035 
00036   public:
00037     // /////////// Getters /////////////
00039     const Key_T& getKey() const {
00040       return _key;
00041     }
00042 
00044     BomAbstract* const getParent() const {
00045       return _parent;
00046     }
00047 
00049     const AirportCode_T& getBoardingPoint() const {
00050       return _key.getBoardingPoint();
00051     }
00052 
00060     const AirlineCode_T& getAirlineCode() const;
00061 
00065     const HolderMap_T& getHolderMap() const {
00066       return _holderMap;
00067     }
00068     
00079     LegCabin* getLegCabin (const std::string& iLegCabinKeyStr) const;
00080 
00091     LegCabin* getLegCabin (const LegCabinKey&) const;
00092 
00094     const AirportCode_T& getOffPoint() const {
00095       return _offPoint;
00096     }
00097 
00099     const Date_T& getBoardingDate() const {
00100       return _boardingDate;
00101     }
00102 
00104     const Duration_T& getBoardingTime() const {
00105       return _boardingTime;
00106     }
00107 
00109     const Date_T& getOffDate() const {
00110       return _offDate;
00111     }
00112 
00114     const Duration_T& getOffTime() const {
00115       return _offTime;
00116     }
00117 
00119     const Duration_T& getElapsedTime() const {
00120       return _elapsedTime;
00121     }
00122 
00124     const Distance_T& getDistance() const {
00125       return _distance;
00126     }
00127 
00129     const CabinCapacity_T& getCapacity() const {
00130       return _capacity;
00131     }
00132 
00134     const DateOffset_T getDateOffset() const {
00135       return _offDate - _boardingDate;
00136     }
00137 
00142     const Duration_T getTimeOffset() const;
00143 
00144 
00145   public:
00146     // ///////// Setters //////////
00148     void setOffPoint (const AirportCode_T& iOffPoint) {
00149       _offPoint = iOffPoint;
00150     }
00151 
00153     void setBoardingDate (const Date_T& iBoardingDate) {
00154       _boardingDate = iBoardingDate;
00155     }
00156 
00158     void setBoardingTime (const Duration_T& iBoardingTime) {
00159       _boardingTime = iBoardingTime;
00160     }
00161 
00163     void setOffDate (const Date_T& iOffDate) {
00164       _offDate = iOffDate;
00165     }
00166 
00168     void setOffTime (const Duration_T& iOffTime) {
00169       _offTime = iOffTime;
00170     }
00171 
00173     void setElapsedTime (const Duration_T&);  
00174 
00176     void setOperatingAirlineCode (const AirlineCode_T& iAirlineCode) {
00177       _operatingAirlineCode = iAirlineCode;
00178     }  
00179 
00181     void setOperatingFlightNumber (const FlightNumber_T& iFlightNumber) {
00182       _operatingFlightNumber = iFlightNumber;
00183     }
00184 
00185   private:
00187     void updateDistanceFromElapsedTime();
00188     
00189 
00190   public:
00191     // /////////// Display support methods /////////
00194     void toStream (std::ostream& ioOut) const {
00195       ioOut << toString();
00196     }
00197 
00200     void fromStream (std::istream& ioIn) {
00201     }
00202 
00204     std::string toString() const;
00205     
00207     const std::string describeKey() const {
00208       return _key.toString();
00209     } 
00210 
00212     const std::string describeRoutingKey() const;
00213 
00214   protected:
00215     // ////////// Constructors and destructors /////////
00217     LegDate (const Key_T&);
00219     virtual ~LegDate();
00220 
00221   private:
00223     LegDate();
00225     LegDate (const LegDate&);
00226 
00227 
00228   protected:
00229     // ////////// Attributes /////////
00231     Key_T _key;
00232 
00234     BomAbstract* _parent;
00235 
00237     HolderMap_T _holderMap;
00238 
00240     AirportCode_T _offPoint;
00241 
00243     Date_T _boardingDate;
00244 
00246     Duration_T _boardingTime;
00247 
00249     Date_T _offDate;
00250 
00252     Duration_T _offTime;
00253 
00255     Duration_T _elapsedTime;
00256 
00258     Distance_T _distance;
00259 
00261     CabinCapacity_T _capacity;   
00262 
00264     AirlineCode_T _operatingAirlineCode;
00265 
00267     FlightNumber_T _operatingFlightNumber;
00268   };
00269 
00270 }
00271 #endif // __STDAIR_BOM_LEGDATE_HPP
00272