From: <den...@us...> - 2010-02-15 01:20:35
|
Revision: 133 http://stdair.svn.sourceforge.net/stdair/?rev=133&view=rev Author: denis_arnaud Date: 2010-02-15 01:20:27 +0000 (Mon, 15 Feb 2010) Log Message: ----------- [Demand] Added support for Demand-related object creation from the new demand input file parser. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Service.hpp trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/basic/ContinuousAttribute.hpp trunk/stdair/stdair/basic/DemandCharacteristics.cpp trunk/stdair/stdair/basic/DemandCharacteristics.hpp trunk/stdair/stdair/basic/DemandDistribution.cpp trunk/stdair/stdair/basic/DemandDistribution.hpp trunk/stdair/stdair/basic/sources.mk trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BookingRequestStruct.cpp trunk/stdair/stdair/bom/BookingRequestStruct.hpp trunk/stdair/stdair/bom/DemandStream.cpp trunk/stdair/stdair/bom/DemandStream.hpp trunk/stdair/stdair/bom/DemandStreamTypes.hpp trunk/stdair/stdair/bom/EventStruct.cpp trunk/stdair/stdair/bom/EventStruct.hpp trunk/stdair/stdair/bom/InventoryKey.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/command/CmdBomManager.hpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/service/STDAIR_Service.cpp Added Paths: ----------- trunk/stdair/stdair/basic/ArrivalPattern.hpp trunk/stdair/stdair/basic/PassengerType.cpp trunk/stdair/stdair/basic/PassengerType.hpp trunk/stdair/stdair/bom/DemandStreamKey.cpp trunk/stdair/stdair/bom/DemandStreamKey.hpp Modified: trunk/stdair/stdair/STDAIR_Service.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Service.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/STDAIR_Service.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -97,6 +97,10 @@ BomRoot. */ void initAirlineFeatureSet (); + /** Initialise the DemandStreamList object, and attach it to the + BomRoot. */ + void initDemandStreamList (); + /** Finalise. */ void finalise (); Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -47,6 +47,15 @@ class MemoryAllocationException : public RootException { }; + class ParserException : public RootException { + }; + + class CodeConversionException : public ParserException { + }; + + class CodeDuplicationException : public ParserException { + }; + class ObjectNotFoundException : public RootException { }; @@ -438,9 +447,5 @@ /** Real number */ typedef double RealNumber_T; - - // ////////////////////////////////////////////////////////////////////// - // Demand - typedef int DemandStreamKey_T; } #endif // __STDAIR_STDAIR_TYPES_HPP Added: trunk/stdair/stdair/basic/ArrivalPattern.hpp =================================================================== --- trunk/stdair/stdair/basic/ArrivalPattern.hpp (rev 0) +++ trunk/stdair/stdair/basic/ArrivalPattern.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -0,0 +1,27 @@ +#ifndef __STDAIR_BAS_ARRIVALPATTERN_HPP +#define __STDAIR_BAS_ARRIVALPATTERN_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// StdAir +#include <stdair/STDAIR_Types.hpp> +#include <stdair/basic/ContinuousAttribute.hpp> + +namespace stdair { + + /** Type definition for the continuous distribition of the duration + (as a float number). */ + typedef ContinuousAttribute<FloatDuration_T> ContinuousFloatDuration_T; + + /** Type definition for the arrival pattern. */ + typedef ContinuousFloatDuration_T::ContinuousDistribution_T ArrivalPattern_T; + + /** Type definition for the arrival pattern cumulative distribution. */ + typedef std::multimap<FloatDuration_T, Probability_T> ArrivalPatternCumulativeDistribution_T; + + /** Type definition for the arrival pattern inverse cumulative distribution. */ + typedef std::multimap<Probability_T, FloatDuration_T> ArrivalPatternInverseCumulativeDistribution_T; + +} +#endif // __STDAIR_BAS_ARRIVALPATTERN_HPP Modified: trunk/stdair/stdair/basic/ContinuousAttribute.hpp =================================================================== --- trunk/stdair/stdair/basic/ContinuousAttribute.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/basic/ContinuousAttribute.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -9,6 +9,7 @@ #include <map> // STDAIR #include <stdair/STDAIR_Types.hpp> +#include <stdair/service/Logger.hpp> namespace stdair { @@ -17,22 +18,28 @@ template <class T> struct ContinuousAttribute { public: + + // ///////////// Type definitions ////////////// + /** */ + typedef std::multimap<T, Probability_T> ContinuousDistribution_T; + typedef std::multimap<Probability_T, T> ContinuousInverseDistribution_T; + + // ///////////// Getters /////////// /** Get the cumulative distribution. */ - const std::multimap<T,Probability_T>& getCumulativeDistribution() const { + const ContinuousDistribution_T& getCumulativeDistribution() const { return _cumulativeDistribution; } /** Get the inverse cumulative distribution. */ - const std::multimap<Probability_T, T>& - getInverseCumulativeDistribution () const { + const ContinuousInverseDistribution_T& getInverseCumulativeDistribution () const { return _inverseCumulativeDistribution; } public: // ///////////// Setters /////////// /** Set the cumulative distribution */ - void setCumulativeDistribution (const std::multimap<T, Probability_T>& iCumulativeDistribution) { + void setCumulativeDistribution (const ContinuousDistribution_T& iCumulativeDistribution) { _cumulativeDistribution = iCumulativeDistribution; determineInverseCumulativeDistributionFromCumulativeDistribution(); } @@ -40,15 +47,15 @@ public: // /////////////// Business Methods ////////// /** Get value from inverse cumulative distribution. */ - const T getValue(const Probability_T& iCumulativeProbability) const { - typename std::multimap<Probability_T, T>::const_iterator it = + const T getValue (const Probability_T& iCumulativeProbability) const { + typename ContinuousDistribution_T::const_iterator it = _inverseCumulativeDistribution.lower_bound (iCumulativeProbability); Probability_T cumulativeProbabilityNextPoint = it->first; T valueNextPoint = it->second; if (it == _inverseCumulativeDistribution.begin()) { - std::cout << "hello" << std::endl; + STDAIR_LOG_DEBUG ("Last element"); return valueNextPoint; } --it; @@ -75,11 +82,14 @@ /** Display cumulative distribution */ std::string displayCumulativeDistribution() const { std::ostringstream oStr; - for (typename std::multimap<T, Probability_T>::const_iterator it = + unsigned int idx = 0; + for (typename ContinuousDistribution_T::const_iterator it = _cumulativeDistribution.begin(); - it != _cumulativeDistribution.end(); ++it) { - oStr << "value: " << it->first - << " cumulative probability: " << it->second << std::endl; + it != _cumulativeDistribution.end(); ++it, ++idx) { + if (idx != 0) { + oStr << ", "; + } + oStr << it->first << ":" << it->second; } return oStr.str(); } @@ -87,7 +97,7 @@ /** Display inverse cumulative distribution */ std::string displayInverseCumulativeDistribution() const { std::ostringstream oStr; - for (typename std::multimap<Probability_T, T>::const_iterator it = + for (typename ContinuousInverseDistribution_T::const_iterator it = _inverseCumulativeDistribution.begin(); it != _inverseCumulativeDistribution.end(); ++it) { oStr << "cumulative prob: " << it->first @@ -102,7 +112,8 @@ ContinuousAttribute () { } /** Constructor */ - ContinuousAttribute (const std::multimap<T, Probability_T>& iCumulativeDistribution) : _cumulativeDistribution (iCumulativeDistribution) { + ContinuousAttribute (const ContinuousDistribution_T& iCumulativeDistribution) + : _cumulativeDistribution (iCumulativeDistribution) { determineInverseCumulativeDistributionFromCumulativeDistribution(); } @@ -118,13 +129,13 @@ /** Determine inverse cumulative distribution from cumulative distribution (initialisation). */ void determineInverseCumulativeDistributionFromCumulativeDistribution () { - for (typename std::multimap<T, Probability_T>::iterator itCumulativeDistribution = + for (typename ContinuousDistribution_T::iterator itCumulativeDistribution = _cumulativeDistribution.begin(); itCumulativeDistribution != _cumulativeDistribution.end(); ++itCumulativeDistribution) { _inverseCumulativeDistribution. - insert ( std::pair<float, float> (itCumulativeDistribution->second, - itCumulativeDistribution->first) ); + insert (std::pair<float, float> (itCumulativeDistribution->second, + itCumulativeDistribution->first)); } } @@ -132,11 +143,10 @@ // ////////// Attributes ////////// /** Cumulative distribution */ - std::multimap<T, Probability_T> _cumulativeDistribution; + ContinuousDistribution_T _cumulativeDistribution; /** Inverse cumulative distribution */ - std::multimap<Probability_T, T> _inverseCumulativeDistribution; - + ContinuousInverseDistribution_T _inverseCumulativeDistribution; }; } Modified: trunk/stdair/stdair/basic/DemandCharacteristics.cpp =================================================================== --- trunk/stdair/stdair/basic/DemandCharacteristics.cpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/basic/DemandCharacteristics.cpp 2010-02-15 01:20:27 UTC (rev 133) @@ -4,15 +4,21 @@ // STL #include <cassert> #include <sstream> -// STDAIR +// StdAir #include <stdair/STDAIR_Types.hpp> +#include <stdair/basic/BasConst_General.hpp> #include <stdair/basic/DemandCharacteristics.hpp> namespace stdair { // ///////////////////////////////////////////////////// + DemandCharacteristics::DemandCharacteristics (const DemandStreamKey_T& iKey) + : _key (iKey) { + } + + // ///////////////////////////////////////////////////// DemandCharacteristics::DemandCharacteristics () - : _origin ("") { + : _key (DemandStreamKey_T("", "", DEFAULT_DATE, PassengerType::LAST_VALUE)) { } // ///////////////////////////////////////////////////// @@ -22,28 +28,49 @@ // ///////////////////////////////////////////////////// DemandCharacteristics:: DemandCharacteristics (const DemandCharacteristics& iDemandCharacteristics) - : _origin (iDemandCharacteristics._origin), - _destination (iDemandCharacteristics._destination), - _preferredDepartureDate (iDemandCharacteristics._preferredDepartureDate), - _paxType (iDemandCharacteristics._paxType), + : _key (iDemandCharacteristics._key), _arrivalPattern (iDemandCharacteristics._arrivalPattern) { } // ///////////////////////////////////////////////////// + const AirportCode_T& DemandCharacteristics::getOrigin() const { + return _key.getOrigin(); + } + + // ///////////////////////////////////////////////////// + const AirportCode_T& DemandCharacteristics::getDestination() const { + return _key.getDestination(); + } + + // ///////////////////////////////////////////////////// + const Date_T& DemandCharacteristics::getPreferredDepartureDate() const { + return _key.getPreferredDepartureDate(); + } + + // ///////////////////////////////////////////////////// + const PassengerType& DemandCharacteristics::getPaxType() const { + return _key.getPassengerType(); + } + + // ///////////////////////////////////////////////////// std::string DemandCharacteristics::display() const { std::ostringstream oStr; // - oStr << "****************** Demand characteristics ******************"; - oStr << "Origin ........................... : " - << _origin << std::endl; + oStr << "****************** Demand characteristics ******************" + << std::endl; + oStr << "Origin ........................... : " << _key.getOrigin() + << std::endl; + oStr << "Destination ...................... : " << _key.getDestination() + << std::endl; oStr << "Preferred departure date ......... : " - << _preferredDepartureDate << std::endl; - oStr << "Arrival pattern (days from departure, proportion):" - << std::endl; + << _key.getPreferredDepartureDate() << std::endl; + oStr << "Passenger type ................... : " << _key.getPassengerType() + << std::endl; + oStr << "Arrival pattern (days from departure, proportion): "; // - oStr << _arrivalPattern.displayCumulativeDistribution(); + oStr << _arrivalPattern.displayCumulativeDistribution() << std::endl; return oStr.str(); } Modified: trunk/stdair/stdair/basic/DemandCharacteristics.hpp =================================================================== --- trunk/stdair/stdair/basic/DemandCharacteristics.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/basic/DemandCharacteristics.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -6,9 +6,10 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <string> -// STDAIR +// StdAir #include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/ContinuousAttribute.hpp> +#include <stdair/basic/ArrivalPattern.hpp> +#include <stdair/bom/DemandStreamKey.hpp> namespace stdair { @@ -17,58 +18,37 @@ public: // ///////////// Getters /////////// - /** Get the origin. */ - const AirportCode_T& getOrigin() const { - return _origin; + /** Get the key. */ + const DemandStreamKey_T& getKey() const { + return _key; } + /** Get the origin. */ + const AirportCode_T& getOrigin() const; + /** Get the destination. */ - const AirportCode_T& getDestination() const { - return _destination; - } + const AirportCode_T& getDestination() const; /** Get the preferred departure date. */ - const Date_T& getPreferredDepartureDate() const { - return _preferredDepartureDate; - } + const Date_T& getPreferredDepartureDate() const; /** Get the passenger type. */ - const PassengerType_T& getPaxType() const { - return _paxType; - } + const PassengerType& getPaxType() const; /** Get the arrival pattern. */ - const ContinuousAttribute<FloatDuration_T>& getArrivalPattern() const { + const ContinuousFloatDuration_T& getArrivalPattern() const { return _arrivalPattern; } + public: // ///////////// Setters /////////// - /** Set the origin. */ - void setOrigin (const AirportCode_T& iOrigin) { - _origin = iOrigin; - } - - /** Set the destination. */ - void setDestination (const AirportCode_T& iDestination) { - _destination = iDestination; - } - - /** Set the preferred departure date. */ - void setPreferredDepartureDate (const Date_T& iPreferredDepartureDate) { - _preferredDepartureDate = iPreferredDepartureDate; - } - - /** Set the passenger type. */ - void setPaxType (const PassengerType_T& iPaxType) { - _paxType = iPaxType; - } - /** Set the arrival pattern. */ - void setArrivalPattern (const ContinuousAttribute<FloatDuration_T>& iArrivalPattern) { + void setArrivalPattern (const ContinuousFloatDuration_T& iArrivalPattern) { _arrivalPattern = iArrivalPattern; } + public: // ////////////// Display Support Methods ////////// /** Display demand characteristics */ @@ -77,34 +57,30 @@ public: // ////////// Constructors and destructors ///////// - /** Constructor by default */ + /** Default constructor. */ + DemandCharacteristics (const DemandStreamKey_T& iKey); + + /** Default constructor. */ + // TODO: That copy constructor should be private DemandCharacteristics (); - /** Copy constructor */ - DemandCharacteristics (const DemandCharacteristics&); // Should be private, but well... + /** Copy constructor. */ + // TODO: That copy constructor should be private + DemandCharacteristics (const DemandCharacteristics&); /** Destructor */ virtual ~DemandCharacteristics (); - + private: - // ////////// Attributes ////////// - /** Origin */ - AirportCode_T _origin; + // //////////////////// Attributes ///////////////////// + /** DemandStream Key */ + const DemandStreamKey_T& _key; - /** Origin */ - AirportCode_T _destination; - - /** Preferred departure date */ - Date_T _preferredDepartureDate; - - /** Passenger type. */ - PassengerType_T _paxType; - /** Arrival pattern (cumulative distribution of timing of arrival of requests (negative number of days between departure date - and request date)*/ - ContinuousAttribute<FloatDuration_T> _arrivalPattern; + and request date). */ + ContinuousFloatDuration_T _arrivalPattern; /** Trip type probability mass */ // CategoricalAttribute<TripType_T> _tripTypeProbabilityMass; Modified: trunk/stdair/stdair/basic/DemandDistribution.cpp =================================================================== --- trunk/stdair/stdair/basic/DemandDistribution.cpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/basic/DemandDistribution.cpp 2010-02-15 01:20:27 UTC (rev 133) @@ -9,6 +9,14 @@ #include <stdair/basic/DemandDistribution.hpp> namespace stdair { + + // ///////////////////////////////////////////////////// + DemandDistribution:: + DemandDistribution (const NbOfRequests_T& iMean, + const StandardDeviationValue_T& iStandardDeviation) + : _meanNumberOfRequests (iMean), + _standardDeviationNumberOfRequests (iStandardDeviation){ + } // ///////////////////////////////////////////////////// DemandDistribution::DemandDistribution () { @@ -20,10 +28,9 @@ // ///////////////////////////////////////////////////// DemandDistribution:: - DemandDistribution (const DemandDistribution& iDemandDistribution) { - _meanNumberOfRequests = iDemandDistribution._meanNumberOfRequests; - _standardDeviationNumberOfRequests = - iDemandDistribution._standardDeviationNumberOfRequests; + DemandDistribution (const DemandDistribution& iDemandDistribution) + : _meanNumberOfRequests (iDemandDistribution._meanNumberOfRequests), + _standardDeviationNumberOfRequests (iDemandDistribution._standardDeviationNumberOfRequests) { } // ///////////////////////////////////////////////////// @@ -31,11 +38,11 @@ std::ostringstream oStr; oStr << "****************** Demand distribution ******************" - << std::endl; + << std::endl; oStr << "Mean number of requests .......... : " - << _meanNumberOfRequests << std::endl; + << _meanNumberOfRequests << std::endl; oStr << "Std dev of number of requests .... : " - << _standardDeviationNumberOfRequests << std::endl; + << _standardDeviationNumberOfRequests << std::endl; return oStr.str(); } Modified: trunk/stdair/stdair/basic/DemandDistribution.hpp =================================================================== --- trunk/stdair/stdair/basic/DemandDistribution.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/basic/DemandDistribution.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -18,24 +18,24 @@ // ///////////// Getters /////////// /** Get the mean number of requests. */ - const RealNumber_T& getMeanNumberOfRequests() const { + const NbOfRequests_T& getMeanNumberOfRequests() const { return _meanNumberOfRequests; } /** Get the standard deviation of number of requests. */ - const RealNumber_T& getStandardDeviationNumberOfRequests() const { + const StandardDeviationValue_T& getStandardDeviationNumberOfRequests() const { return _standardDeviationNumberOfRequests; } public: // ///////////// Setters /////////// /** Set the mean number of requests. */ - void setMeanNumberOfRequests (const RealNumber_T& iMean) { + void setMeanNumberOfRequests (const NbOfRequests_T& iMean) { _meanNumberOfRequests = iMean; } /** Set the standard deviation of number of requests. */ - void setStandardDeviationNumberOfRequests (const RealNumber_T& iStandardDeviation) { + void setStandardDeviationNumberOfRequests (const StandardDeviationValue_T& iStandardDeviation) { _standardDeviationNumberOfRequests = iStandardDeviation; } @@ -47,23 +47,29 @@ public: // ////////// Constructors and destructors ///////// - /** Constructor by default */ + /** Constructor. */ + DemandDistribution (const NbOfRequests_T& iMean, + const StandardDeviationValue_T& iStandardDeviation); + + /** Default constructor. */ + // TODO: That constructor should be private DemandDistribution (); - /** Copy constructor */ - DemandDistribution (const DemandDistribution&); // Should be private, but well... + /** Copy constructor. */ + // TODO: That constructor should be private + DemandDistribution (const DemandDistribution&); - /** Destructor */ + /** Destructor. */ virtual ~DemandDistribution (); - - + + private: // ////////// Attributes ////////// /** Mean number of requests */ - RealNumber_T _meanNumberOfRequests; + NbOfRequests_T _meanNumberOfRequests; /** Standard deviation of number of requests */ - RealNumber_T _standardDeviationNumberOfRequests; + StandardDeviationValue_T _standardDeviationNumberOfRequests; }; } Added: trunk/stdair/stdair/basic/PassengerType.cpp =================================================================== --- trunk/stdair/stdair/basic/PassengerType.cpp (rev 0) +++ trunk/stdair/stdair/basic/PassengerType.cpp 2010-02-15 01:20:27 UTC (rev 133) @@ -0,0 +1,78 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <sstream> +// StdAir +#include <stdair/service/Logger.hpp> +// Stdair +#include <stdair/STDAIR_Types.hpp> +#include <stdair/basic/PassengerType.hpp> + +namespace stdair { + + // ////////////////////////////////////////////////////////////////////// + const std::string PassengerType::_labels[LAST_VALUE] = + { "Leisure", "Business", "First" }; + + const char PassengerType::_typeLabels[LAST_VALUE] = { 'L', 'B', 'F' }; + + + // ////////////////////////////////////////////////////////////////////// + PassengerType::PassengerType (const EN_PassengerType& iPassengerType) + : _type (iPassengerType) { + } + + // ////////////////////////////////////////////////////////////////////// + PassengerType::PassengerType (const char iType) { + switch (iType) { + case 'L': _type = LEISURE; break; + case 'B': _type = BUSINESS; break; + case 'F': _type = FIRST; break; + default: _type = LAST_VALUE; break; + } + + if (_type == LAST_VALUE) { + const std::string& lLabels = describeLabels(); + STDAIR_LOG_ERROR ("The passenger type '" << iType + << "' is not known. Known passenger types: " << lLabels); + throw CodeConversionException(); + } + } + + // ////////////////////////////////////////////////////////////////////// + const std::string& PassengerType::getLabel (const EN_PassengerType& iType) { + return _labels[iType]; + } + + // ////////////////////////////////////////////////////////////////////// + char PassengerType::getTypeLabel(const EN_PassengerType& iType) { + return _typeLabels[iType]; + } + + // ////////////////////////////////////////////////////////////////////// + std::string PassengerType::describeLabels() { + std::ostringstream ostr; + for (unsigned short idx = 0; idx != LAST_VALUE; ++idx) { + if (idx != 0) { + ostr << ", "; + } + ostr << _labels[idx]; + } + return ostr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + PassengerType::EN_PassengerType PassengerType::getType() const { + return _type; + } + + // ////////////////////////////////////////////////////////////////////// + const std::string PassengerType::describe() const { + std::ostringstream ostr; + ostr << _labels[_type]; + return ostr.str(); + } + +} Added: trunk/stdair/stdair/basic/PassengerType.hpp =================================================================== --- trunk/stdair/stdair/basic/PassengerType.hpp (rev 0) +++ trunk/stdair/stdair/basic/PassengerType.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -0,0 +1,61 @@ +#ifndef __STDAIR_BAS_PASSENGERTYPE_HPP +#define __STDAIR_BAS_PASSENGERTYPE_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +// StdAir +#include <stdair/bom/StructAbstract.hpp> + +namespace stdair { + + /** Enumeration of Frequent Flyer types. */ + struct PassengerType : public StructAbstract { + public: + typedef enum { + LEISURE = 0, + BUSINESS, + FIRST, + LAST_VALUE + } EN_PassengerType; + + /** Get the label as a string. */ + static const std::string& getLabel (const EN_PassengerType&); + + /** Get the label as a single char. */ + static char getTypeLabel (const EN_PassengerType&); + + /** List the labels. */ + static std::string describeLabels(); + + /** Get the enumerated value. */ + EN_PassengerType getType() const; + + /** Give a description of the structure (for display purposes). */ + const std::string describe() const; + + + public: + /** Constructor. */ + PassengerType (const EN_PassengerType&); + /** Constructor. */ + PassengerType (const char iType); + + + private: + /** String version of the enumeration. */ + static const std::string _labels[LAST_VALUE]; + /** Type version of the enumeration. */ + static const char _typeLabels[LAST_VALUE]; + + + private: + // //////// Attributes ///////// + /** Frequent flyer type. */ + EN_PassengerType _type; + }; + +} +#endif // __STDAIR_BAS_PASSENGERTYPE_HPP Modified: trunk/stdair/stdair/basic/sources.mk =================================================================== --- trunk/stdair/stdair/basic/sources.mk 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/basic/sources.mk 2010-02-15 01:20:27 UTC (rev 133) @@ -11,7 +11,9 @@ $(top_srcdir)/stdair/basic/BasFileMgr.hpp \ $(top_srcdir)/stdair/basic/BasLogParams.hpp \ $(top_srcdir)/stdair/basic/BasDBParams.hpp \ + $(top_srcdir)/stdair/basic/PassengerType.hpp \ $(top_srcdir)/stdair/basic/ContinuousAttribute.hpp \ + $(top_srcdir)/stdair/basic/ArrivalPattern.hpp \ $(top_srcdir)/stdair/basic/CategoricalAttribute.hpp \ $(top_srcdir)/stdair/basic/DemandCharacteristics.hpp \ $(top_srcdir)/stdair/basic/DemandDistribution.hpp \ @@ -23,6 +25,7 @@ $(top_srcdir)/stdair/basic/BasFileMgr.cpp \ $(top_srcdir)/stdair/basic/BasLogParams.cpp \ $(top_srcdir)/stdair/basic/BasDBParams.cpp \ + $(top_srcdir)/stdair/basic/PassengerType.cpp \ $(top_srcdir)/stdair/basic/DemandCharacteristics.cpp \ $(top_srcdir)/stdair/basic/DemandDistribution.cpp \ $(top_srcdir)/stdair/basic/RandomGeneration.cpp \ Modified: trunk/stdair/stdair/bom/BomRoot.cpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.cpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/BomRoot.cpp 2010-02-15 01:20:27 UTC (rev 133) @@ -10,6 +10,8 @@ #include <stdair/bom/BomMap.hpp> #include <stdair/bom/Inventory.hpp> #include <stdair/bom/Network.hpp> +#include <stdair/bom/DemandStream.hpp> +#include <stdair/service/Logger.hpp> namespace stdair { @@ -75,5 +77,31 @@ assert (_airlineFeatureSet != NULL); return *_airlineFeatureSet; } + + // //////////////////////////////////////////////////////////////////// + DemandStreamList_T& BomRoot::getDemandStreamListRef() const { + // TODO: check that the Boost smart pointer is not NULL + STDAIR_LOG_ERROR ("!!!!TODO: check that the Boost smart pointer is not NULL!!!!"); + return *_demandStreamList; + } + // //////////////////////////////////////////////////////////////////// + void BomRoot::addDemandStream (const DemandStreamKeyStr_T& iKeyStr, + DemandStream& ioDemandStream) { + // TODO: check that the Boost smart pointer is not NULL + STDAIR_LOG_ERROR ("!!!!TODO: check that the Boost smart pointer is not NULL!!!!"); + + // Insert the reference on the given DemandStream object into the + // dedicated list + const bool hasInsertBeenSuccessfull = + _demandStreamList->insert (DemandStreamList_T:: + value_type (iKeyStr, &ioDemandStream)).second; + if (hasInsertBeenSuccessfull == false) { + STDAIR_LOG_ERROR ("The DemandStream object with key: " << iKeyStr + << " can not be inserted into the dedicated list"); + STDAIR_LOG_ERROR ("DemandStream object: " << ioDemandStream); + assert (false); + } + } + } Modified: trunk/stdair/stdair/bom/BomRoot.hpp =================================================================== --- trunk/stdair/stdair/bom/BomRoot.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/BomRoot.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -12,6 +12,7 @@ #include <stdair/bom/BomRootTypes.hpp> #include <stdair/bom/InventoryTypes.hpp> #include <stdair/bom/NetworkTypes.hpp> +#include <stdair/bom/DemandStreamTypes.hpp> namespace stdair { // Forward declarations. @@ -102,6 +103,7 @@ at the same level). */ const std::string describeShortKey() const { return std::string (""); } + public: // /////////// Getters ///////////// /** Get a InventoryList_T for iteration methods. */ @@ -119,6 +121,14 @@ /** Get the reference of the AirlineFeatureSet object. */ AirlineFeatureSet& getAirlineFeatureSet() const; + /** Get the reference of the list of DemandStream objects. */ + DemandStreamListPtr_T getDemandStreamList() const { + return _demandStreamList; + } + + /** Get the reference of the list of DemandStream objects. */ + DemandStreamList_T& getDemandStreamListRef() const; + /** Retrieve, if existing, the Inventory corresponding to the given airline code (Inventory key). <br>If not existing, return the NULL pointer. */ @@ -128,6 +138,7 @@ given airline code (Network key). <br>If not existing, return the NULL pointer. */ Network* getNetwork (const NetworkID_T&) const; + public: // //////////// Setters ////////////// @@ -136,6 +147,17 @@ _airlineFeatureSet = ioAirlineFeatureSet_ptr; } + /** Set the reference to the DemandStreamList object. */ + void setDemandStreamList (DemandStreamListPtr_T ioDemandStreamList_ptr) { + _demandStreamList = ioDemandStreamList_ptr; + } + + /** Add a demand stream object to the dedicated list. + @param const DemandStreamKeyStr_T& (String) Key of the DemandStream + object to be added. + @param DemandStreamList_T& List of DemandStream objects. */ + void addDemandStream (const DemandStreamKeyStr_T&, DemandStream&); + private: /** Retrieve the BOM structure object. */ BomStructure_T& getBomStructure () { @@ -157,8 +179,11 @@ /** Reference structure. */ BomStructure_T& _bomRootStructure; - /** Set of all AirlineFeatures.*/ + /** Set of all AirlineFeatures. */ AirlineFeatureSet* _airlineFeatureSet; + + /** Set of all DemandStream objects. */ + DemandStreamListPtr_T _demandStreamList; }; } Modified: trunk/stdair/stdair/bom/BookingRequestStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingRequestStruct.cpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/BookingRequestStruct.cpp 2010-02-15 01:20:27 UTC (rev 133) @@ -16,7 +16,7 @@ const AirportCode_T& iDestination, const Date_T& iDepartureDate, const DateTime_T& iRequestDateTime, - const PassengerType_T& iPaxType, + const PassengerType& iPaxType, const NbOfSeats_T& iPartySize) : _origin (iOrigin), _destination (iDestination), _preferredDepartureDate (iDepartureDate), Modified: trunk/stdair/stdair/bom/BookingRequestStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingRequestStruct.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/BookingRequestStruct.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -8,14 +8,14 @@ #include <iosfwd> #include <string> // StdAir +#include <stdair/STDAIR_Types.hpp> +#include <stdair/basic/PassengerType.hpp> #include <stdair/bom/StructAbstract.hpp> -#include <stdair/STDAIR_Types.hpp> namespace stdair { /** Structure holding the elements of a booking request. */ struct BookingRequestStruct : public StructAbstract { - public: // /////////////// Getters ///////////////// /** Get the requested origin. */ @@ -39,7 +39,7 @@ } /** Get the passenger type. */ - const PassengerType_T& getPaxType() const { + const PassengerType& getPaxType() const { return _paxType; } @@ -71,7 +71,7 @@ } /** Set the passenger type. */ - void setPaxType (const PassengerType_T& iPaxType) { + void setPaxType (const PassengerType& iPaxType) { _paxType = iPaxType; } @@ -93,15 +93,20 @@ /** Display of the structure. */ const std::string describe() const; + // /////////////// Constructors and Destructors ///////////////// public : + /** Constructor. */ BookingRequestStruct (const AirportCode_T&, const AirportCode_T&, const Date_T&, const DateTime_T&, - const PassengerType_T&, const NbOfSeats_T&); + const PassengerType&, const NbOfSeats_T&); public : + /** Default constructor. */ BookingRequestStruct (); + /** Copy constructor. */ BookingRequestStruct (const BookingRequestStruct&); public: + /** Destructor. */ ~BookingRequestStruct(); @@ -120,7 +125,7 @@ DateTime_T _requestDateTime; /** Passenger type. */ - PassengerType_T _paxType; + PassengerType _paxType; /** Party size. */ NbOfSeats_T _partySize; Modified: trunk/stdair/stdair/bom/DemandStream.cpp =================================================================== --- trunk/stdair/stdair/bom/DemandStream.cpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/DemandStream.cpp 2010-02-15 01:20:27 UTC (rev 133) @@ -47,19 +47,22 @@ // ////////////////////////////////////////////////////////////////////// void DemandStream::init() { // Generate the number of requests - const RealNumber_T lMu = - _demandDistribution.getMeanNumberOfRequests (); + const RealNumber_T lMu = _demandDistribution.getMeanNumberOfRequests (); const RealNumber_T lSigma = _demandDistribution.getStandardDeviationNumberOfRequests (); + const RealNumber_T lRealNumberOfRequestsToBeGenerated = _numberOfRequestsRandomGenerator.generateNormal (lMu, lSigma); - Count_T lIntegerNumberOfRequestsToBeGenerated = 0; + + NbOfRequests_T lIntegerNumberOfRequestsToBeGenerated = 0; if (lRealNumberOfRequestsToBeGenerated < 0.5) { lIntegerNumberOfRequestsToBeGenerated = 0; + } else { - lIntegerNumberOfRequestsToBeGenerated = - static_cast<Count_T> (lRealNumberOfRequestsToBeGenerated + 0.5); + lIntegerNumberOfRequestsToBeGenerated = + static_cast<NbOfRequests_T> (lRealNumberOfRequestsToBeGenerated + 0.5); } + _totalNumberOfRequestsToBeGenerated = lIntegerNumberOfRequestsToBeGenerated; } Modified: trunk/stdair/stdair/bom/DemandStream.hpp =================================================================== --- trunk/stdair/stdair/bom/DemandStream.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/DemandStream.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -16,6 +16,7 @@ #include <stdair/basic/RandomGenerationContext.hpp> #include <stdair/bom/BomContent.hpp> #include <stdair/bom/BookingRequestTypes.hpp> +#include <stdair/bom/DemandStreamKey.hpp> #include <stdair/bom/DemandStreamTypes.hpp> namespace stdair { @@ -32,7 +33,7 @@ } /** Get the total number of requests to be generated. */ - const Count_T& getTotalNumberOfRequestsToBeGenerated() const { + const NbOfRequests_T& getTotalNumberOfRequestsToBeGenerated() const { return _totalNumberOfRequestsToBeGenerated; } @@ -52,22 +53,22 @@ } /** Get the passenger type. */ - const PassengerType_T& getPaxType() const { + const PassengerType& getPaxType() const { return _demandCharacteristics.getPaxType(); } /** Get the arrival pattern. */ - const ContinuousAttribute<FloatDuration_T>& getArrivalPattern() const { + const ContinuousFloatDuration_T& getArrivalPattern() const { return _demandCharacteristics.getArrivalPattern(); } /** Get the mean number of requests. */ - const RealNumber_T& getMeanNumberOfRequests() const { + const NbOfRequests_T& getMeanNumberOfRequests() const { return _demandDistribution.getMeanNumberOfRequests(); } /** Get the standard deviation of number of requests. */ - const RealNumber_T& getStandardDeviationNumberOfRequests() const { + const StandardDeviationValue_T& getStandardDeviationNumberOfRequests() const { return _demandDistribution.getStandardDeviationNumberOfRequests(); } @@ -185,10 +186,11 @@ protected: // ////////// Constructors and destructors ///////// /** Constructor by default */ - DemandStream (const DemandStreamKey_T&, - const DemandCharacteristics&, - const DemandDistribution&, const RandomSeed_T&, - const RandomSeed_T&, const RandomSeed_T&); + DemandStream (const DemandStreamKey_T&, const DemandCharacteristics&, + const DemandDistribution&, + const RandomSeed_T& iNumberOfRequestsSeed, + const RandomSeed_T& iRequestDateTimeSeed, + const RandomSeed_T& iDemandCharacteristicsSeed); /** Default constructors. */ DemandStream (); DemandStream (const DemandStream&); @@ -210,7 +212,7 @@ DemandDistribution _demandDistribution; /** Total number of requests to be generated*/ - Count_T _totalNumberOfRequestsToBeGenerated; + NbOfRequests_T _totalNumberOfRequestsToBeGenerated; /** Random generation context */ RandomGenerationContext _randomGenerationContext; Copied: trunk/stdair/stdair/bom/DemandStreamKey.cpp (from rev 129, trunk/stdair/stdair/bom/FlightDateKey.cpp) =================================================================== --- trunk/stdair/stdair/bom/DemandStreamKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/DemandStreamKey.cpp 2010-02-15 01:20:27 UTC (rev 133) @@ -0,0 +1,58 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/DemandStreamKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + DemandStreamKey_T::DemandStreamKey_T () + : _paxType (PassengerType::LAST_VALUE) { + } + + // //////////////////////////////////////////////////////////////////// + DemandStreamKey_T::DemandStreamKey_T (const AirportCode_T& iOrigin, + const AirportCode_T& iDestination, + const Date_T& iPreferredDepartureDate, + const PassengerType& iPaxType) + : _origin (iOrigin), _destination (iDestination), + _preferredDepartureDate (iPreferredDepartureDate), _paxType (iPaxType) { + } + + // //////////////////////////////////////////////////////////////////// + DemandStreamKey_T::DemandStreamKey_T (const DemandStreamKey_T& iKey) + : _origin (iKey._origin), _destination (iKey._destination), + _preferredDepartureDate (iKey._preferredDepartureDate), + _paxType (iKey._paxType) { + } + + // //////////////////////////////////////////////////////////////////// + DemandStreamKey_T::~DemandStreamKey_T () { + } + + // //////////////////////////////////////////////////////////////////// + void DemandStreamKey_T::toStream (std::ostream& ioOut) const { + ioOut << "DemandStreamKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void DemandStreamKey_T::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string DemandStreamKey_T::toString() const { + std::ostringstream oStr; + oStr << _origin << "-" << _destination << " " << _preferredDepartureDate + << " " << _paxType; + return oStr.str(); + } + + // //////////////////////////////////////////////////////////////////// + const std::string DemandStreamKey_T::describe() const { + std::ostringstream oStr; + oStr << toString(); + return oStr.str(); + } + +} Copied: trunk/stdair/stdair/bom/DemandStreamKey.hpp (from rev 129, trunk/stdair/stdair/bom/FlightDateKey.hpp) =================================================================== --- trunk/stdair/stdair/bom/DemandStreamKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/DemandStreamKey.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -0,0 +1,97 @@ +#ifndef __STDAIR_BOM_DEMANDSTREAMKEY_HPP +#define __STDAIR_BOM_DEMANDSTREAMKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// StdAir +#include <stdair/STDAIR_Types.hpp> +#include <stdair/basic/PassengerType.hpp> +#include <stdair/bom/BomKey.hpp> +#include <stdair/bom/BomRootKey.hpp> + +namespace stdair { + + /** Key of demand-stream. */ + struct DemandStreamKey_T : public BomKey_T { + public: + // /////////// Typedefs //////////// + /** Definition allowing to retrieve the parent key type. */ + typedef BomRootKey_T ParentKey_T; + + public: + // /////////// Construction /////////// + /** Constructors. */ + DemandStreamKey_T (const AirportCode_T& iOrigin, + const AirportCode_T& iDestination, + const Date_T& iPreferredDepartureDate, + const PassengerType& iPaxType); + DemandStreamKey_T (const DemandStreamKey_T&); + + /** Destructor. */ + ~DemandStreamKey_T (); + + public: + /** Default constructor */ + // TODO: that constructor should be private + DemandStreamKey_T (); + + + // /////////// Getters ////////// + /** Get the origin. */ + const AirportCode_T& getOrigin() const { + return _origin; + } + + /** Get the destination. */ + const AirportCode_T& getDestination() const { + return _destination; + } + + /** Get the preferred departure date. */ + const Date_T& getPreferredDepartureDate () const { + return _preferredDepartureDate; + } + + /** Get the passenger type. */ + const PassengerType& getPassengerType() const { + return _paxType; + } + + + // /////////// Display support methods ///////// + /** Dump a Business Object Key into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const; + + /** Read a Business Object Key from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn); + + /** Get the serialised version of the Business Object Key. + <br>That string is unique, at the level of a given Business Object, + when among children of a given parent Business Object. + <br>For instance, "H" and "K" allow to differentiate among two + marketing classes for the same segment-stream. */ + const std::string toString() const; + + /** Display of the key. */ + const std::string describe() const; + + private: + // Attributes + /** Origin */ + AirportCode_T _origin; + + /** Origin */ + AirportCode_T _destination; + + /** Preferred departure date */ + Date_T _preferredDepartureDate; + + /** Passenger type. */ + PassengerType _paxType; + }; + +} +#endif // __STDAIR_BOM_DEMANDSTREAMKEY_HPP Modified: trunk/stdair/stdair/bom/DemandStreamTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/DemandStreamTypes.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/DemandStreamTypes.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -6,6 +6,8 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <map> +// Boost +#include <boost/shared_ptr.hpp> // STDAIR #include <stdair/STDAIR_Types.hpp> @@ -13,9 +15,14 @@ // Forward declaration class DemandStream; + + /** Type definition for the hashed key of the DemandStreamKey object. */ + typedef std::string DemandStreamKeyStr_T; /** Define a map of demand strams. */ - typedef std::map<const DemandStreamKey_T, DemandStream*> DemandStreamList_T; + typedef std::map<const DemandStreamKeyStr_T, DemandStream*> DemandStreamList_T; + /** Type definition for a reference on a list of DemandStream objects. */ + typedef boost::shared_ptr<DemandStreamList_T> DemandStreamListPtr_T; } #endif // __STDAIR_BOM_DEMANDSTREAMTYPES_HPP Modified: trunk/stdair/stdair/bom/EventStruct.cpp =================================================================== --- trunk/stdair/stdair/bom/EventStruct.cpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/EventStruct.cpp 2010-02-15 01:20:27 UTC (rev 133) @@ -13,8 +13,7 @@ EventStruct(const EventType_T& iEventType, const DateTime_T& iDateTime, const DemandStreamKey_T& iDemandStreamKey, BookingRequestPtr_T ioRequestPtr) - : _eventType (iEventType), - _eventDateTime (iDateTime), + : _eventType (iEventType), _eventDateTime (iDateTime), _demandStreamKey (iDemandStreamKey) { _request = ioRequestPtr; } @@ -30,9 +29,8 @@ // ////////////////////////////////////////////////////////////////////// EventStruct::EventStruct (const DateTime_T& iDateTime) - : _eventType (""), - _eventDateTime (iDateTime), - _demandStreamKey (-1) { + : _eventType (""), _eventDateTime (iDateTime), + _demandStreamKey ("", "", DEFAULT_DATE, PassengerType::LAST_VALUE) { } // ////////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/EventStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/EventStruct.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/EventStruct.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -7,6 +7,7 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/bom/BookingRequestTypes.hpp> +#include <stdair/bom/DemandStreamKey.hpp> namespace stdair { Modified: trunk/stdair/stdair/bom/InventoryKey.hpp =================================================================== --- trunk/stdair/stdair/bom/InventoryKey.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/InventoryKey.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -10,10 +10,10 @@ #include <stdair/bom/BomRootKey.hpp> namespace stdair { + /** Key of inventory. */ struct InventoryKey_T : public BomKey_T { friend struct FlightDateKey_T; - public: // /////////// Typedefs //////////// /** Definition allowing to retrieve the parent key type. */ Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/bom/sources.mk 2010-02-15 01:20:27 UTC (rev 133) @@ -17,6 +17,7 @@ $(top_srcdir)/stdair/bom/OutboundPathKey.hpp \ $(top_srcdir)/stdair/bom/AirlineFeatureSetKey.hpp \ $(top_srcdir)/stdair/bom/AirlineFeatureKey.hpp \ + $(top_srcdir)/stdair/bom/DemandStreamKey.hpp \ $(top_srcdir)/stdair/bom/BomRootTypes.hpp \ $(top_srcdir)/stdair/bom/BomRoot.hpp \ $(top_srcdir)/stdair/bom/BomContent.hpp \ @@ -107,6 +108,7 @@ $(top_srcdir)/stdair/bom/OutboundPathKey.cpp \ $(top_srcdir)/stdair/bom/AirlineFeatureSetKey.cpp \ $(top_srcdir)/stdair/bom/AirlineFeatureKey.cpp \ + $(top_srcdir)/stdair/bom/DemandStreamKey.cpp \ $(top_srcdir)/stdair/bom/BomRoot.cpp \ $(top_srcdir)/stdair/bom/BomRootContent.cpp \ $(top_srcdir)/stdair/bom/Inventory.cpp \ Modified: trunk/stdair/stdair/command/CmdBomManager.cpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.cpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/command/CmdBomManager.cpp 2010-02-15 01:20:27 UTC (rev 133) @@ -3,10 +3,13 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <cassert> +// Boost +#include <boost/make_shared.hpp> // StdAir #include <stdair/bom/BomRoot.hpp> #include <stdair/bom/AirlineFeatureSet.hpp> #include <stdair/bom/AirlineFeature.hpp> +#include <stdair/bom/DemandStreamTypes.hpp> // Inventory: child of BomRoot, needed for creation of BomRoot #include <stdair/bom/Inventory.hpp> // Network: child of BomRoot, needed for creation of BomRoot @@ -30,9 +33,8 @@ } // ////////////////////////////////////////////////////////////////////// - void CmdBomManager:: - addAirlineFeature (BomRoot& ioBomRoot, - const AirlineCode_T& iAirlineCode) { + void CmdBomManager::addAirlineFeature (BomRoot& ioBomRoot, + const AirlineCode_T& iAirlineCode) { // Initialise an AirlineFeature object AirlineFeatureKey_T lAirlineFeatureKey (iAirlineCode); @@ -48,6 +50,16 @@ } // ////////////////////////////////////////////////////////////////////// + void CmdBomManager::initDemandStreamList (BomRoot& ioBomRoot) { + // Initialise the set of required airline features + DemandStreamListPtr_T lDemandStreamList_ptr = + boost::make_shared<DemandStreamList_T>(); + + // Set the AirlineFeatureSet for the BomRoot. + ioBomRoot.setDemandStreamList (lDemandStreamList_ptr); + } + + // ////////////////////////////////////////////////////////////////////// Inventory& CmdBomManager:: createInventoryInternal (BomRoot& ioBomRoot, const AirlineCode_T& iAirlineCode) { Modified: trunk/stdair/stdair/command/CmdBomManager.hpp =================================================================== --- trunk/stdair/stdair/command/CmdBomManager.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/command/CmdBomManager.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -30,8 +30,7 @@ created . */ static Inventory& getOrCreateInventory (BomRoot&, const AirlineCode_T&); - /** Initialise the AirlineFeatureSet object, and attach it to the - BomRoot. + /** Initialise the AirlineFeatureSet object, and attach it to the BomRoot. @param BomRoot& Root of the BOM tree. */ static void initAirlineFeatureSet (BomRoot&); @@ -41,6 +40,11 @@ @param const AirlineCode_T& Airline code for the inventory to be created . */ static void addAirlineFeature (BomRoot&, const AirlineCode_T& iAirlineCode); + + /** Initialise the DemandStreamList object, and attach it to the BomRoot. + @param BomRoot& Root of the BOM tree. */ + static void initDemandStreamList (BomRoot&); + private: // ///////////////////// Internal support methods //////////////////////// Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-02-15 01:20:27 UTC (rev 133) @@ -24,6 +24,7 @@ struct OptimizerStruct_T; struct DemandCharacteristics; struct DemandDistribution; + struct DemandStreamKey_T; /** Base class for Factory layer. */ class FacBomContent { Modified: trunk/stdair/stdair/service/STDAIR_Service.cpp =================================================================== --- trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-02-14 16:21:47 UTC (rev 132) +++ trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-02-15 01:20:27 UTC (rev 133) @@ -38,6 +38,8 @@ // Initialise the AirlineFeatureSet object, and attach it to the BomRoot initAirlineFeatureSet (); + // Initialise the DemandStreamList object, and attach it to the BomRoot + initDemandStreamList (); // Set the log file logInit (iLogParams); @@ -55,6 +57,8 @@ // Initialise the AirlineFeatureSet object, and attach it to the BomRoot initAirlineFeatureSet (); + // Initialise the DemandStreamList object, and attach it to the BomRoot + initDemandStreamList (); // Set the log file logInit (iLogParams); @@ -91,6 +95,12 @@ // Delegate to the dedicated command CmdBomManager::initAirlineFeatureSet (_bomRoot); } + + // ////////////////////////////////////////////////////////////////////// + void STDAIR_Service::initDemandStreamList () { + // Delegate to the dedicated command + CmdBomManager::initDemandStreamList (_bomRoot); + } // ////////////////////////////////////////////////////////////////////// void STDAIR_Service:: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |