From: <gsa...@us...> - 2010-10-13 16:04:06
|
Revision: 342 http://stdair.svn.sourceforge.net/stdair/?rev=342&view=rev Author: gsabatier Date: 2010-10-13 16:04:00 +0000 (Wed, 13 Oct 2010) Log Message: ----------- Added the FareFamily class Modified Paths: -------------- trunk/stdair/stdair/bom/sources.mk Added Paths: ----------- trunk/stdair/stdair/bom/FareFamily.cpp trunk/stdair/stdair/bom/FareFamily.hpp trunk/stdair/stdair/bom/FareFamilyKey.cpp trunk/stdair/stdair/bom/FareFamilyKey.hpp trunk/stdair/stdair/bom/FareFamilyTypes.hpp Added: trunk/stdair/stdair/bom/FareFamily.cpp =================================================================== --- trunk/stdair/stdair/bom/FareFamily.cpp (rev 0) +++ trunk/stdair/stdair/bom/FareFamily.cpp 2010-10-13 16:04:00 UTC (rev 342) @@ -0,0 +1,30 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +// STDAIR +#include <stdair/basic/BasConst_Yield.hpp> +#include <stdair/bom/FareFamily.hpp> + +namespace stdair { + + + // //////////////////////////////////////////////////////////////////// + FareFamily::FareFamily (const Key_T& iKey) : _key (iKey), _parent (NULL) { + } + + // //////////////////////////////////////////////////////////////////// + FareFamily::~FareFamily () { + } + + // //////////////////////////////////////////////////////////////////// + std::string FareFamily::toString() const { + std::ostringstream oStr; + oStr << describeKey(); + return oStr.str(); + } + +} + + Added: trunk/stdair/stdair/bom/FareFamily.hpp =================================================================== --- trunk/stdair/stdair/bom/FareFamily.hpp (rev 0) +++ trunk/stdair/stdair/bom/FareFamily.hpp 2010-10-13 16:04:00 UTC (rev 342) @@ -0,0 +1,71 @@ +#ifndef __STDAIR_BOM_FAREFAMILY_HPP +#define __STDAIR_BOM_FAREFAMILY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/BomAbstract.hpp> +#include <stdair/bom/FareFamilyKey.hpp> +#include <stdair/bom/FareFamilyTypes.hpp> + +namespace stdair { + + /** Class representing the actual attributes for a family fare. */ + class FareFamily : public BomAbstract { + template <typename BOM> friend class FacBom; + friend class FacBomManager; + + public: + // Type definitions. + /** Definition allowing to retrieve the associated BOM key type. */ + typedef FareFamilyKey Key_T; + + public: + // /////////// Getters //////////// + /** Get the family fare key. */ + const Key_T& getKey() const { return _key; } + + /** Get the family fare code (part of the primary key). */ + const FamilyCode_T& getFamilyCode() const { return _key.getFamilyCode(); } + + /** Get the parent object. */ + BomAbstract* const getParent() const { return _parent; } + + /** Get the map of children holders. */ + const HolderMap_T& getHolderMap() const { return _holderMap; } + + public: + // /////////// Display support methods ///////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream& ioOut) const { ioOut << toString(); } + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream& ioIn) { } + + /** Get the serialised version of the Business Object. */ + std::string toString() const; + + /** Get a string describing the key. */ + const std::string describeKey() const { return _key.toString(); } + + protected: + /** Default constructors. */ + FareFamily (const Key_T&); + FareFamily (const FareFamily&); + /** Destructor. */ + ~FareFamily(); + + public: + // Attributes + Key_T _key; + BomAbstract* _parent; + HolderMap_T _holderMap; + + }; + +} +#endif // __STDAIR_BOM_FAREFAMILY_HPP + Added: trunk/stdair/stdair/bom/FareFamilyKey.cpp =================================================================== --- trunk/stdair/stdair/bom/FareFamilyKey.cpp (rev 0) +++ trunk/stdair/stdair/bom/FareFamilyKey.cpp 2010-10-13 16:04:00 UTC (rev 342) @@ -0,0 +1,34 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/FareFamilyKey.hpp> + +namespace stdair { + + // //////////////////////////////////////////////////////////////////// + FareFamilyKey::FareFamilyKey (const FamilyCode_T& iFamilyCode) + : _familyCode (iFamilyCode) { + } + + // //////////////////////////////////////////////////////////////////// + FareFamilyKey::~FareFamilyKey () { + } + + // //////////////////////////////////////////////////////////////////// + void FareFamilyKey::toStream (std::ostream& ioOut) const { + ioOut << "FareFamilyKey: " << toString() << std::endl; + } + + // //////////////////////////////////////////////////////////////////// + void FareFamilyKey::fromStream (std::istream& ioIn) { + } + + // //////////////////////////////////////////////////////////////////// + const std::string FareFamilyKey::toString() const { + std::ostringstream oStr; + oStr << _familyCode; + return oStr.str(); + } + +} Added: trunk/stdair/stdair/bom/FareFamilyKey.hpp =================================================================== --- trunk/stdair/stdair/bom/FareFamilyKey.hpp (rev 0) +++ trunk/stdair/stdair/bom/FareFamilyKey.hpp 2010-10-13 16:04:00 UTC (rev 342) @@ -0,0 +1,49 @@ +#ifndef __STDAIR_BOM_FAREFAMILYKEY_HPP +#define __STDAIR_BOM_FAREFAMILYKEY_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STDAIR +#include <stdair/bom/KeyAbstract.hpp> + +namespace stdair { + /** Key of fare family. */ + struct FareFamilyKey : public KeyAbstract { + + public: + // /////////// Construction /////////// + /** Constructor. */ + FareFamilyKey (const FamilyCode_T& iFamilyCode); + /** Destructor. */ + ~FareFamilyKey (); + + // /////////// Getters ////////// + /** Get the family code. */ + const FamilyCode_T& getFamilyCode () const { + return _familyCode; + } + + // /////////// 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. + */ + const std::string toString() const; + + private: + // Attributes + /** Family code. */ + FamilyCode_T _familyCode; + }; + +} +#endif // __STDAIR_BOM_FAREFAMILYKEY_HPP Added: trunk/stdair/stdair/bom/FareFamilyTypes.hpp =================================================================== --- trunk/stdair/stdair/bom/FareFamilyTypes.hpp (rev 0) +++ trunk/stdair/stdair/bom/FareFamilyTypes.hpp 2010-10-13 16:04:00 UTC (rev 342) @@ -0,0 +1,25 @@ +// ////////////////////////////////////////////////////////////////////// +#ifndef __STDAIR_BOM_FAREFAMILYTYPES_HPP +#define __STDAIR_BOM_FAREFAMILYTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <map> +#include <list> +// STDAIR +#include <stdair/STDAIR_Types.hpp> + +namespace stdair { + + // Forward declarations. + class FareFamily; + + /** Define the fare family list. */ + typedef std::list<FareFamily*> FareFamilyList_T; + + /** Define the fare family map. */ + typedef std::map<const MapKey_T, FareFamily*> FareFamilyMap_T; +} +#endif // __STDAIR_BOM_FAREFAMILYTYPES_HPP Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-10-13 13:28:20 UTC (rev 341) +++ trunk/stdair/stdair/bom/sources.mk 2010-10-13 16:04:00 UTC (rev 342) @@ -11,6 +11,7 @@ $(top_srcdir)/stdair/bom/LegCabinKey.hpp \ $(top_srcdir)/stdair/bom/SegmentDateKey.hpp \ $(top_srcdir)/stdair/bom/SegmentCabinKey.hpp \ + $(top_srcdir)/stdair/bom/FareFamilyKey.hpp \ $(top_srcdir)/stdair/bom/BookingClassKey.hpp \ $(top_srcdir)/stdair/bom/BucketKey.hpp \ $(top_srcdir)/stdair/bom/FlightPeriodKey.hpp \ @@ -21,6 +22,7 @@ $(top_srcdir)/stdair/bom/SegmentDateTypes.hpp \ $(top_srcdir)/stdair/bom/LegDateTypes.hpp \ $(top_srcdir)/stdair/bom/SegmentCabinTypes.hpp \ + $(top_srcdir)/stdair/bom/FareFamilyTypes.hpp \ $(top_srcdir)/stdair/bom/LegCabinTypes.hpp \ $(top_srcdir)/stdair/bom/BookingClassTypes.hpp \ $(top_srcdir)/stdair/bom/BucketTypes.hpp \ @@ -38,6 +40,7 @@ $(top_srcdir)/stdair/bom/SegmentDate.hpp \ $(top_srcdir)/stdair/bom/LegDate.hpp \ $(top_srcdir)/stdair/bom/SegmentCabin.hpp \ + $(top_srcdir)/stdair/bom/FareFamily.hpp \ $(top_srcdir)/stdair/bom/LegCabin.hpp \ $(top_srcdir)/stdair/bom/BookingClass.hpp \ $(top_srcdir)/stdair/bom/Bucket.hpp \ @@ -64,6 +67,7 @@ $(top_srcdir)/stdair/bom/LegCabinKey.cpp \ $(top_srcdir)/stdair/bom/SegmentDateKey.cpp \ $(top_srcdir)/stdair/bom/SegmentCabinKey.cpp \ + $(top_srcdir)/stdair/bom/FareFamilyKey.cpp \ $(top_srcdir)/stdair/bom/BookingClassKey.cpp \ $(top_srcdir)/stdair/bom/BucketKey.cpp \ $(top_srcdir)/stdair/bom/FlightPeriodKey.cpp \ @@ -75,6 +79,7 @@ $(top_srcdir)/stdair/bom/SegmentDate.cpp \ $(top_srcdir)/stdair/bom/LegDate.cpp \ $(top_srcdir)/stdair/bom/SegmentCabin.cpp \ + $(top_srcdir)/stdair/bom/FareFamily.cpp \ $(top_srcdir)/stdair/bom/LegCabin.cpp \ $(top_srcdir)/stdair/bom/BookingClass.cpp \ $(top_srcdir)/stdair/bom/Bucket.cpp \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |