From: <den...@us...> - 2010-02-15 12:35:13
|
Revision: 135 http://stdair.svn.sourceforge.net/stdair/?rev=135&view=rev Author: denis_arnaud Date: 2010-02-15 12:35:06 +0000 (Mon, 15 Feb 2010) Log Message: ----------- [Dev] Suppressed the duplicated bom/StructAbstract (as there is already one in the basic layer). Modified Paths: -------------- trunk/stdair/stdair/basic/PassengerType.cpp trunk/stdair/stdair/basic/PassengerType.hpp trunk/stdair/stdair/bom/AirlineStruct.hpp trunk/stdair/stdair/bom/BookingRequestStruct.hpp trunk/stdair/stdair/bom/DoWStruct.hpp trunk/stdair/stdair/bom/EventQueue.hpp trunk/stdair/stdair/bom/TravelSolutionStruct.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/command/DBManagerForAirlines.cpp Removed Paths: ------------- trunk/stdair/stdair/bom/StructAbstract.hpp Modified: trunk/stdair/stdair/basic/PassengerType.cpp =================================================================== --- trunk/stdair/stdair/basic/PassengerType.cpp 2010-02-15 01:22:24 UTC (rev 134) +++ trunk/stdair/stdair/basic/PassengerType.cpp 2010-02-15 12:35:06 UTC (rev 135) @@ -47,11 +47,18 @@ } // ////////////////////////////////////////////////////////////////////// - char PassengerType::getTypeLabel(const EN_PassengerType& iType) { + char PassengerType::getTypeLabel (const EN_PassengerType& iType) { return _typeLabels[iType]; } // ////////////////////////////////////////////////////////////////////// + std::string PassengerType::getTypeLabelAsString(const EN_PassengerType& iType){ + std::ostringstream oStr; + oStr << _typeLabels[iType]; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// std::string PassengerType::describeLabels() { std::ostringstream ostr; for (unsigned short idx = 0; idx != LAST_VALUE; ++idx) { @@ -69,10 +76,22 @@ } // ////////////////////////////////////////////////////////////////////// + std::string PassengerType::getTypeAsString() const { + std::ostringstream oStr; + oStr << _typeLabels[_type]; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// const std::string PassengerType::describe() const { std::ostringstream ostr; ostr << _labels[_type]; return ostr.str(); } + // ////////////////////////////////////////////////////////////////////// + bool PassengerType::operator== (const EN_PassengerType& iType) const { + return (_type == iType); + } + } Modified: trunk/stdair/stdair/basic/PassengerType.hpp =================================================================== --- trunk/stdair/stdair/basic/PassengerType.hpp 2010-02-15 01:22:24 UTC (rev 134) +++ trunk/stdair/stdair/basic/PassengerType.hpp 2010-02-15 12:35:06 UTC (rev 135) @@ -7,7 +7,7 @@ // STL #include <string> // StdAir -#include <stdair/bom/StructAbstract.hpp> +#include <stdair/basic/StructAbstract.hpp> namespace stdair { @@ -21,21 +21,30 @@ LAST_VALUE } EN_PassengerType; - /** Get the label as a string. */ + /** Get the label as a string (e.g., "Leisure" or "Business"). */ static const std::string& getLabel (const EN_PassengerType&); - /** Get the label as a single char. */ + /** Get the label as a single char (e.g., 'L' or 'B'). */ static char getTypeLabel (const EN_PassengerType&); + /** Get the label as a single char (e.g., 'L' or 'B'). */ + static std::string getTypeLabelAsString (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). */ + /** Get the enumerated value as a short string (e.g., 'L' or 'B'). */ + std::string getTypeAsString() const; + + /** Give a description of the structure (e.g., "Leisure" or "Business"). */ const std::string describe() const; + public: + /** Comparison operator. */ + bool operator== (const EN_PassengerType&) const; public: /** Constructor. */ Modified: trunk/stdair/stdair/bom/AirlineStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/AirlineStruct.hpp 2010-02-15 01:22:24 UTC (rev 134) +++ trunk/stdair/stdair/bom/AirlineStruct.hpp 2010-02-15 12:35:06 UTC (rev 135) @@ -10,7 +10,7 @@ #include <vector> // StdAir #include <stdair/STDAIR_Types.hpp> -#include <stdair/bom/StructAbstract.hpp> +#include <stdair/basic/StructAbstract.hpp> namespace stdair { Modified: trunk/stdair/stdair/bom/BookingRequestStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingRequestStruct.hpp 2010-02-15 01:22:24 UTC (rev 134) +++ trunk/stdair/stdair/bom/BookingRequestStruct.hpp 2010-02-15 12:35:06 UTC (rev 135) @@ -9,8 +9,8 @@ #include <string> // StdAir #include <stdair/STDAIR_Types.hpp> +#include <stdair/basic/StructAbstract.hpp> #include <stdair/basic/PassengerType.hpp> -#include <stdair/bom/StructAbstract.hpp> namespace stdair { Modified: trunk/stdair/stdair/bom/DoWStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/DoWStruct.hpp 2010-02-15 01:22:24 UTC (rev 134) +++ trunk/stdair/stdair/bom/DoWStruct.hpp 2010-02-15 12:35:06 UTC (rev 135) @@ -8,7 +8,7 @@ #include <string> #include <vector> // STDAIR -#include <stdair/bom/StructAbstract.hpp> +#include <stdair/basic/StructAbstract.hpp> namespace stdair { Modified: trunk/stdair/stdair/bom/EventQueue.hpp =================================================================== --- trunk/stdair/stdair/bom/EventQueue.hpp 2010-02-15 01:22:24 UTC (rev 134) +++ trunk/stdair/stdair/bom/EventQueue.hpp 2010-02-15 12:35:06 UTC (rev 135) @@ -4,9 +4,11 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STDAIR +// STL +#include <iosfwd> +// StdAir #include <stdair/STDAIR_Types.hpp> -#include <stdair/bom/StructAbstract.hpp> +#include <stdair/basic/StructAbstract.hpp> #include <stdair/bom/EventTypes.hpp> namespace stdair { Deleted: trunk/stdair/stdair/bom/StructAbstract.hpp =================================================================== --- trunk/stdair/stdair/bom/StructAbstract.hpp 2010-02-15 01:22:24 UTC (rev 134) +++ trunk/stdair/stdair/bom/StructAbstract.hpp 2010-02-15 12:35:06 UTC (rev 135) @@ -1,83 +0,0 @@ -#ifndef __STDAIR_BOM_STRUCTABSTRACT_HPP -#define __STDAIR_BOM_STRUCTABSTRACT_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <iosfwd> - -namespace stdair { - - /** Base class for the Structures of the Business Object Model (BOM) - layer. */ - struct StructAbstract { - public: - - /** Destructor. */ - virtual ~StructAbstract() {} - - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - void toStream (std::ostream& ioOut) const { - ioOut << describe(); - } - - /** Read a Business Object from an input stream. - @param istream& the input stream. */ - virtual void fromStream (std::istream& ioIn) {} - - /** Display of the structure. */ - virtual const std::string describe() const = 0; - - protected: - /** Protected Default Constructor to ensure this class is abtract. */ - StructAbstract() {} - }; -} - -/** - Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing - Output Operators" (p653) of his book "The C++ Standard Library: A Tutorial - and Reference", published by Addison-Wesley. -*/ -template <class charT, class traits> -inline -std::basic_ostream<charT, traits>& -operator<< (std::basic_ostream<charT, traits>& ioOut, - const stdair::StructAbstract& iStruct) { - /** - string stream: - - with same format - - without special field width - */ - std::basic_ostringstream<charT,traits> ostr; - ostr.copyfmt (ioOut); - ostr.width (0); - - // Fill string stream - iStruct.toStream (ostr); - - // Print string stream - ioOut << ostr.str(); - - return ioOut; -} - -/** - Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing - Output Operators" (pp655-657) of his book "The C++ Standard Library: - A Tutorial and Reference", published by Addison-Wesley. -*/ -template <class charT, class traits> -inline -std::basic_istream<charT, traits>& -operator>> (std::basic_istream<charT, traits>& ioIn, - stdair::StructAbstract& ioStruct) { - // Fill the Structure object with the input stream. - ioStruct.fromStream (ioIn); - return ioIn; - -} - -#endif // __STDAIR_BOM_STRUCTABSTRACT_HPP Modified: trunk/stdair/stdair/bom/TravelSolutionStruct.hpp =================================================================== --- trunk/stdair/stdair/bom/TravelSolutionStruct.hpp 2010-02-15 01:22:24 UTC (rev 134) +++ trunk/stdair/stdair/bom/TravelSolutionStruct.hpp 2010-02-15 12:35:06 UTC (rev 135) @@ -9,7 +9,7 @@ #include <string> #include <vector> // StdAir -#include <stdair/bom/StructAbstract.hpp> +#include <stdair/basic/StructAbstract.hpp> #include <stdair/bom/BookingClassTypes.hpp> namespace stdair { Modified: trunk/stdair/stdair/bom/sources.mk =================================================================== --- trunk/stdair/stdair/bom/sources.mk 2010-02-15 01:22:24 UTC (rev 134) +++ trunk/stdair/stdair/bom/sources.mk 2010-02-15 12:35:06 UTC (rev 135) @@ -1,5 +1,4 @@ bom_h_sources = \ - $(top_srcdir)/stdair/bom/StructAbstract.hpp \ $(top_srcdir)/stdair/bom/BomList.hpp \ $(top_srcdir)/stdair/bom/BomMap.hpp \ $(top_srcdir)/stdair/bom/BomKey.hpp \ Modified: trunk/stdair/stdair/command/DBManagerForAirlines.cpp =================================================================== --- trunk/stdair/stdair/command/DBManagerForAirlines.cpp 2010-02-15 01:22:24 UTC (rev 134) +++ trunk/stdair/stdair/command/DBManagerForAirlines.cpp 2010-02-15 12:35:06 UTC (rev 135) @@ -143,14 +143,14 @@ prepareSelectOnAirlineCodeStatement (ioSociSession, lSelectStatement, iAirlineCode, ioAirline); - const bool shouldDoReset = true; + // const bool shouldDoReset = true; bool hasStillData = iterateOnStatement (lSelectStatement, ioAirline); if (hasStillData == true) { oHasRetrievedAirline = true; } // Sanity check - const bool shouldNotDoReset = false; + // const bool shouldNotDoReset = false; hasStillData = iterateOnStatement (lSelectStatement, ioAirline); // Debug This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |