AirTSP Logo  1.01.0
C++ Simulated Airline Travel Solution Provider Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AIRTSP::SegmentPathPeriod Class Reference

Class representing a segment/path. More...

#include <airtsp/bom/SegmentPathPeriod.hpp>

+ Inheritance diagram for AIRTSP::SegmentPathPeriod:

Public Types

typedef SegmentPathPeriodKey Key_T
 

Public Member Functions

const Key_TgetKey () const
 
stdair::BomAbstract *const getParent () const
 
const stdair::PeriodStruct & getDeparturePeriod () const
 
const DateOffsetList_TgetBoardingDateOffsetList () const
 
const stdair::NbOfSegments_T getNbOfSegments () const
 
const stdair::NbOfAirlines_T & getNbOfAirlines () const
 
const stdair::Duration_T & getElapsedTime () const
 
const stdair::Duration_T & getBoardingTime () const
 
const stdair::HolderMap_T & getHolderMap () const
 
stdair::SegmentPeriod * getLastSegmentPeriod () const
 
stdair::SegmentPeriod * getFirstSegmentPeriod () const
 
const stdair::AirportCode_T & getDestination () const
 
Key_T connectWithAnotherSegment (const SegmentPathPeriod &) const
 
bool checkCircle (const stdair::AirportCode_T &) const
 
bool isAirlineFlown (const stdair::AirlineCode_T &) const
 
bool isDepartureDateValid (const stdair::Date_T &) const
 
void toStream (std::ostream &ioOut) const
 
void fromStream (std::istream &ioIn)
 
std::string toString () const
 
const std::string describeKey () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int iFileVersion)
 

Protected Member Functions

 SegmentPathPeriod (const Key_T &)
 
 ~SegmentPathPeriod ()
 

Protected Attributes

Key_T _key
 
stdair::BomAbstract * _parent
 
stdair::HolderMap_T _holderMap
 

Friends

template<typename BOM >
class stdair::FacBom
 
class stdair::FacBomManager
 
class boost::serialization::access
 

Detailed Description

Class representing a segment/path.

It corresponds to an actual travel solution from the origin to the destination, that is, a path that a traveller can take with actual scheduled flights.

Definition at line 39 of file SegmentPathPeriod.hpp.

Member Typedef Documentation

Definition allowing to retrieve the associated BOM key type.

Definition at line 52 of file SegmentPathPeriod.hpp.

Constructor & Destructor Documentation

AIRTSP::SegmentPathPeriod::SegmentPathPeriod ( const Key_T iKey)
protected

Main constructor.

Definition at line 43 of file SegmentPathPeriod.cpp.

AIRTSP::SegmentPathPeriod::~SegmentPathPeriod ( )
protected

Destructor.

Definition at line 48 of file SegmentPathPeriod.cpp.

Member Function Documentation

const Key_T& AIRTSP::SegmentPathPeriod::getKey ( ) const
inline

Get the primary key (destination airport).

Definition at line 60 of file SegmentPathPeriod.hpp.

References _key.

stdair::BomAbstract* const AIRTSP::SegmentPathPeriod::getParent ( ) const
inline

Get the parent (i.e., OriginDestinationSet) object.

Definition at line 67 of file SegmentPathPeriod.hpp.

References _parent.

const stdair::PeriodStruct& AIRTSP::SegmentPathPeriod::getDeparturePeriod ( ) const
inline

Get the departure period (part of the primary key).

Definition at line 72 of file SegmentPathPeriod.hpp.

References _key, and AIRTSP::SegmentPathPeriodKey::getPeriod().

Referenced by connectWithAnotherSegment(), and isDepartureDateValid().

const DateOffsetList_T& AIRTSP::SegmentPathPeriod::getBoardingDateOffsetList ( ) const
inline

Get the boarding date offset list (part of the primary key).

Definition at line 77 of file SegmentPathPeriod.hpp.

References _key, and AIRTSP::SegmentPathPeriodKey::getBoardingDateOffsetList().

Referenced by connectWithAnotherSegment().

const stdair::NbOfSegments_T AIRTSP::SegmentPathPeriod::getNbOfSegments ( ) const
inline

Get the number of segments (part of the primary key).

Definition at line 82 of file SegmentPathPeriod.hpp.

References _key, and AIRTSP::SegmentPathPeriodKey::getNbOfSegments().

Referenced by connectWithAnotherSegment().

const stdair::NbOfAirlines_T& AIRTSP::SegmentPathPeriod::getNbOfAirlines ( ) const
inline

Get the number of airlines (part of the primary key).

Definition at line 87 of file SegmentPathPeriod.hpp.

References _key, and AIRTSP::SegmentPathPeriodKey::getNbOfAirlines().

const stdair::Duration_T& AIRTSP::SegmentPathPeriod::getElapsedTime ( ) const
inline

Get the elapsed time (part of the primary key).

Definition at line 92 of file SegmentPathPeriod.hpp.

References _key, and AIRTSP::SegmentPathPeriodKey::getElapsedTime().

Referenced by connectWithAnotherSegment().

const stdair::Duration_T& AIRTSP::SegmentPathPeriod::getBoardingTime ( ) const
inline

Get the boarding time (part of the primary key).

Definition at line 97 of file SegmentPathPeriod.hpp.

References _key, and AIRTSP::SegmentPathPeriodKey::getBoardingTime().

Referenced by connectWithAnotherSegment().

const stdair::HolderMap_T& AIRTSP::SegmentPathPeriod::getHolderMap ( ) const
inline

Get the map of children holders (SegmentPeriod objects).

Definition at line 104 of file SegmentPathPeriod.hpp.

References _holderMap.

stdair::SegmentPeriod * AIRTSP::SegmentPathPeriod::getLastSegmentPeriod ( ) const

Get the last SegmentPeriod object of the list.

Return a NULL pointer if the list is empty.

Definition at line 91 of file SegmentPathPeriod.cpp.

Referenced by connectWithAnotherSegment(), and getDestination().

stdair::SegmentPeriod * AIRTSP::SegmentPathPeriod::getFirstSegmentPeriod ( ) const

Get the first SegmentPeriod object of the list.

Return a NULL pointer if the list is empty.

Definition at line 109 of file SegmentPathPeriod.cpp.

Referenced by connectWithAnotherSegment().

const stdair::AirportCode_T & AIRTSP::SegmentPathPeriod::getDestination ( ) const

Get the destination of the segment path (i.e., the destination of the last segment.

Definition at line 127 of file SegmentPathPeriod.cpp.

References getLastSegmentPeriod().

SegmentPathPeriodKey AIRTSP::SegmentPathPeriod::connectWithAnotherSegment ( const SegmentPathPeriod iSingleSegmentPath) const

Check whether the (i-1)-length segment path period can be merged with the single segment path period in order to create an i-length segment path period. The function will return a valid or non-valid segment path period key.

The two segment path period above can be fused (and will produce a valid new segment path period key) if:

  1. A passenger can connect from the last segment of the first segment path and the first segment of the next segment path. These two segments should not create another segment.
  2. There is no circle within the new segment path.
  3. The intersection of the two periods is non-empty.

Definition at line 163 of file SegmentPathPeriod.cpp.

References checkCircle(), getBoardingDateOffsetList(), getBoardingTime(), getDeparturePeriod(), getElapsedTime(), getFirstSegmentPeriod(), getLastSegmentPeriod(), getNbOfSegments(), AIRTSP::SegmentPathPeriodKey::setBoardingDateOffsetList(), AIRTSP::SegmentPathPeriodKey::setBoardingTime(), AIRTSP::SegmentPathPeriodKey::setElapsedTime(), and AIRTSP::SegmentPathPeriodKey::setPeriod().

bool AIRTSP::SegmentPathPeriod::checkCircle ( const stdair::AirportCode_T &  ) const

Check whether the given destination airport is also the departure point of one of the other segment members. If yes, a circle exists.

Definition at line 289 of file SegmentPathPeriod.cpp.

Referenced by connectWithAnotherSegment().

bool AIRTSP::SegmentPathPeriod::isAirlineFlown ( const stdair::AirlineCode_T &  iAirlineCode) const

State whether or not the given airline is flown by (at least) one of the segments of the internal list.

Definition at line 135 of file SegmentPathPeriod.cpp.

bool AIRTSP::SegmentPathPeriod::isDepartureDateValid ( const stdair::Date_T &  iDepartureDate) const

Check whether the given departure date is included in the departure period of the segment path.

Definition at line 308 of file SegmentPathPeriod.cpp.

References getDeparturePeriod().

void AIRTSP::SegmentPathPeriod::toStream ( std::ostream &  ioOut) const
inline

Dump a Business Object into an output stream.

Parameters
ostream&the output stream.

Definition at line 176 of file SegmentPathPeriod.hpp.

References toString().

void AIRTSP::SegmentPathPeriod::fromStream ( std::istream &  ioIn)
inline

Read a Business Object from an input stream.

Parameters
istream&the input stream.

Definition at line 185 of file SegmentPathPeriod.hpp.

std::string AIRTSP::SegmentPathPeriod::toString ( ) const

Get the serialised version of the Business Object.

Definition at line 52 of file SegmentPathPeriod.cpp.

References _key, and AIRTSP::SegmentPathPeriodKey::toString().

Referenced by toStream().

const std::string AIRTSP::SegmentPathPeriod::describeKey ( ) const
inline

Get a string describing the key.

Definition at line 196 of file SegmentPathPeriod.hpp.

References _key, and AIRTSP::SegmentPathPeriodKey::toString().

template<class Archive >
void AIRTSP::SegmentPathPeriod::serialize ( Archive &  ar,
const unsigned int  iFileVersion 
)

Serialisation.

Definition at line 74 of file SegmentPathPeriod.cpp.

References _key.

Friends And Related Function Documentation

template<typename BOM >
friend class stdair::FacBom
friend

Friend classes.

Definition at line 43 of file SegmentPathPeriod.hpp.

friend class stdair::FacBomManager
friend

Definition at line 44 of file SegmentPathPeriod.hpp.

friend class boost::serialization::access
friend

Definition at line 45 of file SegmentPathPeriod.hpp.

Member Data Documentation

Key_T AIRTSP::SegmentPathPeriod::_key
protected

Primary key (segment/path characteristics: scheduled period, number of segments, number of airlines, elapsed time, boarding time).

Definition at line 249 of file SegmentPathPeriod.hpp.

Referenced by describeKey(), getBoardingDateOffsetList(), getBoardingTime(), getDeparturePeriod(), getElapsedTime(), getKey(), getNbOfAirlines(), getNbOfSegments(), serialize(), and toString().

stdair::BomAbstract* AIRTSP::SegmentPathPeriod::_parent
protected

Pointer on the parent (OriginDestinationSet) object.

Definition at line 254 of file SegmentPathPeriod.hpp.

Referenced by getParent().

stdair::HolderMap_T AIRTSP::SegmentPathPeriod::_holderMap
protected

Map holding the children (SegmentPeriod objects).

Note
The SegmentPeriod objects themselves have for parent the FlightPeriod class (not the SegmentPathPeriod class).

Definition at line 262 of file SegmentPathPeriod.hpp.

Referenced by getHolderMap().


The documentation for this class was generated from the following files: