From: <den...@us...> - 2009-03-08 17:51:41
|
Revision: 174 http://rmol.svn.sourceforge.net/rmol/?rev=174&view=rev Author: denis_arnaud Date: 2009-03-08 17:51:26 +0000 (Sun, 08 Mar 2009) Log Message: ----------- [Release 0.18.0] Added Logging service. Modified Paths: -------------- trunk/rmol/configure.ac trunk/rmol/po/POTFILES.in trunk/rmol/rmol/RMOL_Service.hpp trunk/rmol/rmol/RmolTypes.hpp trunk/rmol/rmol/bom/BomAbstract.cpp trunk/rmol/rmol/bom/BomAbstract.hpp trunk/rmol/rmol/bom/Bucket.cpp trunk/rmol/rmol/bom/Bucket.hpp trunk/rmol/rmol/bom/BucketHolder.cpp trunk/rmol/rmol/bom/BucketHolder.hpp trunk/rmol/rmol/bom/Demand.cpp trunk/rmol/rmol/bom/Demand.hpp trunk/rmol/rmol/bom/Overbooking.cpp trunk/rmol/rmol/bom/Overbooking.hpp trunk/rmol/rmol/bom/PartialSumHolder.cpp trunk/rmol/rmol/bom/PartialSumHolder.hpp trunk/rmol/rmol/bom/PartialSumHolderHolder.cpp trunk/rmol/rmol/bom/PartialSumHolderHolder.hpp trunk/rmol/rmol/factory/FacBucket.hpp trunk/rmol/rmol/factory/FacBucketHolder.hpp trunk/rmol/rmol/factory/FacDemand.hpp trunk/rmol/rmol/factory/FacOverbooking.hpp trunk/rmol/rmol/factory/FacPartialSumHolder.hpp trunk/rmol/rmol/factory/FacPartialSumHolderHolder.hpp trunk/rmol/rmol/factory/FacSupervisor.cpp trunk/rmol/rmol/factory/FacSupervisor.hpp trunk/rmol/rmol/factory/sources.mk trunk/rmol/rmol/field/FldDistributionParameters.cpp trunk/rmol/rmol/field/FldDistributionParameters.hpp trunk/rmol/rmol/field/FldOverbookingPolicy.cpp trunk/rmol/rmol/field/FldOverbookingPolicy.hpp trunk/rmol/rmol/field/FldYieldRange.cpp trunk/rmol/rmol/field/FldYieldRange.hpp trunk/rmol/rmol/field/sources.mk trunk/rmol/rmol/rmol.cpp trunk/rmol/rmol/service/RMOL_Service.cpp trunk/rmol/rmol/service/sources.mk trunk/rmol/rmol.spec.in trunk/rmol/test/Makefile.am trunk/rmol/test/testLib.sh Added Paths: ----------- trunk/rmol/config/cppunit.m4 trunk/rmol/rmol/factory/FacBomAbstract.cpp trunk/rmol/rmol/factory/FacBomAbstract.hpp trunk/rmol/rmol/factory/FacRmolServiceContext.cpp trunk/rmol/rmol/factory/FacRmolServiceContext.hpp trunk/rmol/rmol/field/FldAbstract.cpp trunk/rmol/rmol/field/FldAbstract.hpp trunk/rmol/rmol/service/Logger.cpp trunk/rmol/rmol/service/Logger.hpp trunk/rmol/rmol/service/RMOL_ServiceContext.cpp trunk/rmol/rmol/service/RMOL_ServiceContext.hpp trunk/rmol/test/OptimiseTestSuite.cpp trunk/rmol/test/OptimiseTestSuite.hpp trunk/rmol/test/SimulateTestSuite.cpp trunk/rmol/test/SimulateTestSuite.hpp trunk/rmol/test/com/ trunk/rmol/test/com/CppUnitCore.cpp trunk/rmol/test/com/CppUnitCore.hpp trunk/rmol/test/com/Makefile.am trunk/rmol/test/com/XmlOutputterHookForCC.cpp trunk/rmol/test/com/XmlOutputterHookForCC.hpp trunk/rmol/test/com/sources.mk Removed Paths: ------------- trunk/rmol/rmol/factory/FacAbstract.cpp trunk/rmol/rmol/factory/FacAbstract.hpp trunk/rmol/rmol/factory/FacServiceContext.cpp trunk/rmol/rmol/factory/FacServiceContext.hpp trunk/rmol/rmol/service/ServiceContext.cpp trunk/rmol/rmol/service/ServiceContext.hpp trunk/rmol/test/optimise.cpp trunk/rmol/test/simulate.cpp Property Changed: ---------------- trunk/rmol/rmol/ trunk/rmol/test/ Added: trunk/rmol/config/cppunit.m4 =================================================================== --- trunk/rmol/config/cppunit.m4 (rev 0) +++ trunk/rmol/config/cppunit.m4 2009-03-08 17:51:26 UTC (rev 174) @@ -0,0 +1,93 @@ +dnl +dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +AC_DEFUN([AM_PATH_CPPUNIT], +[ + +AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)], + cppunit_config_prefix="$withval", cppunit_config_prefix="") +AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)], + cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="") + + if test x$cppunit_config_exec_prefix != x ; then + cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix" + if test x${CPPUNIT_CONFIG+set} != xset ; then + CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config + fi + fi + if test x$cppunit_config_prefix != x ; then + cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix" + if test x${CPPUNIT_CONFIG+set} != xset ; then + CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config + fi + fi + + AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no) + cppunit_version_min=$1 + + AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min) + no_cppunit="" + if test "$CPPUNIT_CONFIG" = "no" ; then + AC_MSG_RESULT(no) + no_cppunit=yes + else + CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags` + CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs` + CPPUNIT_VERSION=`$CPPUNIT_CONFIG --version` + + cppunit_major_version=`echo $CPPUNIT_VERSION | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + cppunit_minor_version=`echo $CPPUNIT_VERSION | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + cppunit_micro_version=`echo $CPPUNIT_VERSION | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + cppunit_major_min=`echo $cppunit_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + if test "x${cppunit_major_min}" = "x" ; then + cppunit_major_min=0 + fi + + cppunit_minor_min=`echo $cppunit_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + if test "x${cppunit_minor_min}" = "x" ; then + cppunit_minor_min=0 + fi + + cppunit_micro_min=`echo $cppunit_version_min | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x${cppunit_micro_min}" = "x" ; then + cppunit_micro_min=0 + fi + + cppunit_version_proper=`expr \ + $cppunit_major_version \> $cppunit_major_min \| \ + $cppunit_major_version \= $cppunit_major_min \& \ + $cppunit_minor_version \> $cppunit_minor_min \| \ + $cppunit_major_version \= $cppunit_major_min \& \ + $cppunit_minor_version \= $cppunit_minor_min \& \ + $cppunit_micro_version \>= $cppunit_micro_min ` + + if test "$cppunit_version_proper" = "1" ; then + AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version]) + else + AC_MSG_RESULT(no) + no_cppunit=yes + fi + fi + + if test "x$no_cppunit" = x ; then + ifelse([$2], , :, [$2]) + else + CPPUNIT_CFLAGS="" + CPPUNIT_LIBS="" + ifelse([$3], , :, [$3]) + fi + + AC_SUBST(CPPUNIT_CFLAGS) + AC_SUBST(CPPUNIT_LIBS) + AC_SUBST(CPPUNIT_VERSION) +]) + + + Modified: trunk/rmol/configure.ac =================================================================== --- trunk/rmol/configure.ac 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/configure.ac 2009-03-08 17:51:26 UTC (rev 174) @@ -7,6 +7,8 @@ AC_CONFIG_SRCDIR([rmol/basic/BasConst.cpp]) AC_CONFIG_AUX_DIR([config]) AM_INIT_AUTOMAKE +AM_PATH_CPPUNIT(1.10) +AM_CONDITIONAL([HAVE_CPPUNIT], [test "x$CPPUNIT_LIBS" != x]) # RPM release number RPM_RELEASE="1" @@ -286,11 +288,19 @@ #endif /* #ifndef CONFIG_H */ ]) + +# -------------------------------------------------------- +# I18n (internationalisation) with GNU Gettext +# -------------------------------------------------------- AM_GNU_GETTEXT([external], [need-formatstring-macros]) AM_GNU_GETTEXT_VERSION([0.14]) - +# Force the usage of the i18n feature: on 64bit architecture, +# as gettext uses conversions from int to char*, there may be +# some issues. However, for regular translation (e.g., to German +# or French), the PO files are correctly transformed into GMO. USE_NLS=yes + # Define configured files AC_CONFIG_FILES( Makefile @@ -317,6 +327,7 @@ doc/sourceforge/howto_release_rmol.html po/Makefile.in test/Makefile + test/com/Makefile win32/Makefile) AC_OUTPUT @@ -376,6 +387,11 @@ o BOOST_PO_LIB .... : ${BOOST_PROGRAM_OPTIONS_LIB} o BOOST_FS_LIB .... : ${BOOST_FILESYSTEM_LIB} + - CPPUNIT ........... : + o CPPUNIT_VERSION . : ${CPPUNIT_VERSION} + o CPPUNIT_CFLAGS .. : ${CPPUNIT_CFLAGS} + o CPPUNIT_LIBS .... : ${CPPUNIT_LIBS} + ------------------------------------------------------------------------------ Now type 'make && make install' to build and install $PACKAGE-$VERSION library ------------------------------------------------------------------------------ Modified: trunk/rmol/po/POTFILES.in =================================================================== --- trunk/rmol/po/POTFILES.in 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/po/POTFILES.in 2009-03-08 17:51:26 UTC (rev 174) @@ -1,14 +1,18 @@ # List of files which contain translatable strings. rmol/service/RMOL_Service.cpp +rmol/service/RMOL_ServiceContext.cpp +rmol/service/Logger.cpp rmol/service/ServiceAbstract.hpp rmol/service/ServiceAbstract.cpp -rmol/service/ServiceContext.cpp -rmol/service/ServiceContext.hpp +rmol/service/RMOL_ServiceContext.hpp +rmol/service/Logger.hpp rmol/RmolTypes.hpp rmol/RMOL_Service.hpp rmol/field/FldYieldRange.hpp rmol/field/FldOverbookingPolicy.hpp +rmol/field/FldAbstract.cpp rmol/field/FldYieldRange.cpp +rmol/field/FldAbstract.hpp rmol/field/FldDistributionParameters.hpp rmol/field/FldOverbookingPolicy.cpp rmol/field/FldDistributionParameters.cpp @@ -18,20 +22,20 @@ rmol/factory/FacServiceAbstract.hpp rmol/factory/FacOverbooking.hpp rmol/factory/FacSupervisor.cpp -rmol/factory/FacServiceContext.cpp rmol/factory/FacDemand.hpp rmol/factory/FacPartialSumHolderHolder.cpp -rmol/factory/FacAbstract.hpp rmol/factory/FacBucketHolder.cpp +rmol/factory/FacBomAbstract.hpp +rmol/factory/FacRmolServiceContext.hpp rmol/factory/FacServiceAbstract.cpp -rmol/factory/FacAbstract.cpp rmol/factory/FacDemand.cpp rmol/factory/FacBucketHolder.hpp +rmol/factory/FacRmolServiceContext.cpp +rmol/factory/FacBomAbstract.cpp rmol/factory/FacPartialSumHolderHolder.hpp rmol/factory/FacPartialSumHolder.cpp rmol/factory/FacSupervisor.hpp rmol/factory/FacBucket.cpp -rmol/factory/FacServiceContext.hpp rmol/basic/BasConst_RMOL_Service.hpp rmol/basic/BasConst.cpp rmol/basic/BasConst_Overbooking.hpp Property changes on: trunk/rmol/rmol ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile Makefile.in config.h config.h.in stamp-h1 rmol + .deps .libs Makefile Makefile.in config.h config.h.in stamp-h1 rmol rmol.log Modified: trunk/rmol/rmol/RMOL_Service.hpp =================================================================== --- trunk/rmol/rmol/RMOL_Service.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/RMOL_Service.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -12,13 +12,14 @@ namespace RMOL { /** Forward declaration. */ - class ServiceContext; + class RMOL_ServiceContext; /** Interface for the RMOL Services. */ class RMOL_Service { public: /** Constructor. */ - RMOL_Service (const ResourceCapacity_T iResourceCapacity); + RMOL_Service (std::ostream& ioLogStream, + const ResourceCapacity_T iResourceCapacity); /** Destructor. */ ~RMOL_Service(); @@ -70,11 +71,20 @@ RMOL_Service (); RMOL_Service (const RMOL_Service&); - /** Initialiser. */ - void initContext (const ResourceCapacity_T iResourceCapacity); + /** Initialise. */ + void init (std::ostream& ioLogStream, + const ResourceCapacity_T iResourceCapacity); + /** Initilise the log. */ + void logInit (const LOG::EN_LogLevel iLogLevel, std::ostream& ioLogStream); + + /** Finaliser. */ + void finalise (); + + private: + // ////////// Service Context ////////// /** Service Context. */ - ServiceContext* _context; + RMOL_ServiceContext* _rmolServiceContext; }; } #endif // __RMOL_SVC_RMOL_SERVICE_HPP Modified: trunk/rmol/rmol/RmolTypes.hpp =================================================================== --- trunk/rmol/rmol/RmolTypes.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/RmolTypes.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -10,6 +10,41 @@ namespace RMOL { + // ///////// Exceptions /////////// + class RootException : public std::exception { + }; + + class FileNotFoundException : public RootException { + }; + + class NonInitialisedServiceException : public RootException { + }; + + class MemoryAllocationException : public RootException { + }; + + class ObjectNotFoundException : public RootException { + }; + + class DocumentNotFoundException : public RootException { + }; + + + // /////////////// Log ///////////// + /** Level of logs. */ + namespace LOG { + typedef enum { + CRITICAL = 0, + ERROR, + NOTIFICATION, + WARNING, + DEBUG, + VERBOSE, + LAST_VALUE + } EN_LogLevel; + } + + // //////// Type definitions ///////// /** Define the capacity. <br>It is a double, as it allows for overbooking. */ typedef double ResourceCapacity_T; Modified: trunk/rmol/rmol/bom/BomAbstract.cpp =================================================================== --- trunk/rmol/rmol/bom/BomAbstract.cpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/BomAbstract.cpp 2009-03-08 17:51:26 UTC (rev 174) @@ -2,7 +2,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // RMOL -#include "BomAbstract.hpp" +#include <rmol/bom/BomAbstract.hpp> namespace RMOL { Modified: trunk/rmol/rmol/bom/BomAbstract.hpp =================================================================== --- trunk/rmol/rmol/bom/BomAbstract.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/BomAbstract.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -1,34 +1,50 @@ -#ifndef __RMOL_BOMABSTRACT_HPP -#define __RMOL_BOMABSTRACT_HPP +#ifndef __RMOL_BOM_BOMABSTRACT_HPP +#define __RMOL_BOM_BOMABSTRACT_HPP // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// // STL -#include <iostream> +#include <istream> +#include <ostream> #include <sstream> +#include <string> namespace RMOL { /** Base class for the Business Object Model (BOM) layer. */ class BomAbstract { + friend class FacBomAbstract; public: - - /** Destructor. */ - virtual ~BomAbstract() {} - + // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @param ostream& the output stream. */ - virtual void toStream (std::ostream& ioOut) const {} + virtual void toStream (std::ostream& ioOut) const = 0; /** Read a Business Object from an input stream. @param istream& the input stream. */ - virtual void fromStream (std::istream& ioIn) {} + virtual void fromStream (std::istream& ioIn) = 0; + /** Get the serialised version of the Business Object. */ + virtual std::string toString() const = 0; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + virtual const std::string describeKey() const = 0; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + virtual const std::string describeShortKey() const = 0; + + protected: /** Protected Default Constructor to ensure this class is abtract. */ BomAbstract() {} - }; + BomAbstract(const BomAbstract&) {} + + /** Destructor. */ + virtual ~BomAbstract() {} + }; } /** @@ -74,4 +90,4 @@ return ioIn; } -#endif // __RMOL_BOMABSTRACT_HPP +#endif // __RMOL_BOM_BOMABSTRACT_HPP Modified: trunk/rmol/rmol/bom/Bucket.cpp =================================================================== --- trunk/rmol/rmol/bom/Bucket.cpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/Bucket.cpp 2009-03-08 17:51:26 UTC (rev 174) @@ -13,15 +13,16 @@ namespace RMOL { // ////////////////////////////////////////////////////////////////////// - Bucket::Bucket () : _yieldRange (), _demand (NULL), - _protection (0.0), _cumulatedProtection (0.0), - _bookingLimit (0.0), _cumulatedBookingLimit (0.0) { + Bucket::Bucket () + : _demand (NULL), + _yieldRange (), _protection (0.0), _cumulatedProtection (0.0), + _bookingLimit (0.0), _cumulatedBookingLimit (0.0) { } // ////////////////////////////////////////////////////////////////////// Bucket::Bucket (const Bucket& iBucket) : + _demand (&iBucket.getDemand()), _yieldRange (iBucket.getYieldRange()), - _demand (&iBucket.getDemand()), _protection (iBucket.getProtection()), _cumulatedProtection (iBucket.getCumulatedProtection()), _bookingLimit (iBucket.getBookingLimit()), @@ -30,8 +31,8 @@ // ////////////////////////////////////////////////////////////////////// Bucket::Bucket (const FldYieldRange& iYieldRange) : - _yieldRange (iYieldRange), _demand (NULL), - _protection (0.0), _cumulatedProtection (0.0), + _demand (NULL), + _yieldRange (iYieldRange), _protection (0.0), _cumulatedProtection (0.0), _bookingLimit (0.0), _cumulatedBookingLimit (0.0) { } @@ -40,21 +41,70 @@ } // ////////////////////////////////////////////////////////////////////// + const std::string Bucket::describeShortKey() const { + std::ostringstream oStr; + oStr << _yieldRange; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Bucket::describeKey() const { + return describeShortKey(); + } + + // ////////////////////////////////////////////////////////////////////// + std::string Bucket::toString() const { + std::ostringstream oStr; + oStr << describeShortKey() << ", "; + const double pj = getUpperYield(); + const double mj = getMean(); + const double sj = getStandardDeviation(); + const double proj = getProtection(); + const double yj = getCumulatedProtection(); + const double bj = getCumulatedBookingLimit(); + oStr << std::fixed << std::setprecision (2) + << pj << "; " << mj << "; " << sj << "; " << proj << "; " << yj + << "; " << bj << std::endl; + + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// void Bucket::toStream (std::ostream& ioOut) const { + ioOut << toString(); + } + + // ////////////////////////////////////////////////////////////////////// + void Bucket::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Bucket::shortDisplay() const { + std::ostringstream oStr; + oStr << describeKey(); const double pj = getUpperYield(); const double mj = getMean(); const double sj = getStandardDeviation(); const double proj = getProtection(); const double yj = getCumulatedProtection(); + const double blj = getBookingLimit(); const double bj = getCumulatedBookingLimit(); - ioOut << std::fixed << std::setprecision (2) - << pj << "; " << mj << "; " << sj << "; " << proj << "; " << yj - << "; " << bj << std::endl; + oStr << std::fixed << std::setprecision (2) + << ", upper yield = " << pj << "; " + << ", mean = " << mj << "; " << ", std_dev = " << sj << "; " + << ", protection = " << proj << "; " + << ", cumulative protection = " << yj << "; " + << ", booking limit = " << blj + << ", cumulative booking limit = " << bj << std::endl; + + return oStr.str(); } // ////////////////////////////////////////////////////////////////////// - void Bucket::display () const { - toStream (std::cout); + const std::string Bucket::display() const { + std::ostringstream oStr; + oStr << shortDisplay(); + return oStr.str(); } // ////////////////////////////////////////////////////////////////////// Modified: trunk/rmol/rmol/bom/Bucket.hpp =================================================================== --- trunk/rmol/rmol/bom/Bucket.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/Bucket.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -52,7 +52,7 @@ friend class FacBucketHolder; public: - // Getters + // ///////// Getters //////// /** Getter for the yield range. */ const FldYieldRange& getYieldRange() const { return _yieldRange; @@ -73,32 +73,42 @@ double getBookingLimit() const { return _bookingLimit; } + /** Getter for the distribution parameters of the demand. */ const FldDistributionParameters& getDistributionParameters() const; + /** Getter for the demand mean. */ const double getMean() const; + /** Getter for the demand standard deviation. */ const double getStandardDeviation() const; + /** Getter for the upper yield. */ const double getUpperYield() const; + /** Getter for the average yield. */ const double getAverageYield() const; + /** Getter for the lower yield. */ const double getLowerYield() const; - // Setters + + // ///////// Setters //////// /** Setter for the protection. */ void setProtection (const double iProtection) { _protection = iProtection; } + /** Setter for the cumulated protection. */ void setCumulatedProtection (const double iProtection) { _cumulatedProtection = iProtection; } + /** Setter for the booking limit. */ void setBookingLimit (const double iBookingLimit) { _bookingLimit = iBookingLimit; } + /** Setter for the cumulated booking limit. */ void setCumulatedBookingLimit (const double iBookingLimit) { _cumulatedBookingLimit = iBookingLimit; @@ -113,34 +123,53 @@ /** Set the demand mean and standard deviation. */ void setDemandParameters (const double, const double); + public: + // ///////// Display methods //////// /** Dump a Business Object into an output stream. - @param ostream& the output stream - @return ostream& the output stream. */ - void toStream (std::ostream& ioOut) const; + @param ostream& the output stream. */ + void toStream (std::ostream&) const; - /** Display on standard output. */ - void display () const; + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream&); - /** Destructors. */ - virtual ~Bucket(); + /** Get the serialised version of the Place object. */ + std::string toString() const; + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const; + + /** Display the full Place context. */ + const std::string display() const; + + /** Display a short Place context. */ + const std::string shortDisplay() const; + + private: /** Constructors. <br>Protected to force the use of the Factory. */ Bucket (); Bucket (const Bucket&); Bucket (const FldYieldRange&); + /** Destructors. */ + virtual ~Bucket(); /** Getter for the demand. */ Demand& getDemand() const; private: - /** Yield range, defined by upper and average yield. */ - FldYieldRange _yieldRange; - /** Demand, defined by (mean, standard deviation) and yield range. */ Demand* _demand; + /** Yield range, defined by upper and average yield. */ + FldYieldRange _yieldRange; + /** Protection. */ double _protection; Modified: trunk/rmol/rmol/bom/BucketHolder.cpp =================================================================== --- trunk/rmol/rmol/bom/BucketHolder.cpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/BucketHolder.cpp 2009-03-08 17:51:26 UTC (rev 174) @@ -35,9 +35,50 @@ } // ////////////////////////////////////////////////////////////////////// + const std::string BucketHolder::describeShortKey() const { + std::ostringstream oStr; + oStr << _cabinCapacity; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string BucketHolder::describeKey() const { + return describeShortKey(); + } + + // ////////////////////////////////////////////////////////////////////// + std::string BucketHolder::toString() const { + std::ostringstream oStr; + oStr << describeShortKey() + << ", " << _totalMeanDemand + << ", " << _demandFactor << ", " << _optimalRevenue + << std::endl; + + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// void BucketHolder::toStream (std::ostream& ioOut) const { + ioOut << toString(); + } + + // ////////////////////////////////////////////////////////////////////// + void BucketHolder::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + const std::string BucketHolder::shortDisplay() const { + std::ostringstream oStr; + oStr << describeKey(); + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string BucketHolder::display() const { + std::ostringstream oStr; + oStr << shortDisplay(); // Generate a CSV (Comma Separated Values) output - ioOut << "Class; Price; Mean; Std Dev; Protection; Cum. Protection; Cum. Bkg Limit; " + oStr << "Class; Price; Mean; Std Dev; Protection; Cum. Protection; Cum. Bkg Limit; " << std::endl; BucketList_T::const_iterator itBucket = _bucketList.begin(); @@ -45,22 +86,17 @@ const Bucket* currentBucket_ptr = *itBucket; assert (currentBucket_ptr != NULL); - ioOut << j << "; " << *currentBucket_ptr; + oStr << j << "; " << currentBucket_ptr->display(); } - ioOut << "Cabin Capacity = " << _cabinCapacity - << "; Total Mean Demand = " << _totalMeanDemand - << "; Demand Factor = " << _demandFactor - << "; Optimal Revenue = " << _optimalRevenue << std::endl; - + oStr << "Cabin Capacity = " << _cabinCapacity + << "; Total Mean Demand = " << _totalMeanDemand + << "; Demand Factor = " << _demandFactor + << "; Optimal Revenue = " << _optimalRevenue << std::endl; + return oStr.str(); } // ////////////////////////////////////////////////////////////////////// - void BucketHolder::display () const { - toStream (std::cout); - } - - // ////////////////////////////////////////////////////////////////////// Bucket& BucketHolder::getCurrentBucket () const { Bucket* resultBucket_ptr = *_itCurrentBucket; assert (resultBucket_ptr != NULL); Modified: trunk/rmol/rmol/bom/BucketHolder.hpp =================================================================== --- trunk/rmol/rmol/bom/BucketHolder.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/BucketHolder.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -43,20 +43,9 @@ /** Get the size of list of buckets/classes. */ const short getSize () const; - /** Dump a Business Object into an output stream. - @param ostream& the output stream - @return ostream& the output stream. */ - void toStream (std::ostream& ioOut) const; - - /** Display on standard output. */ - void display () const; - /** Fill up the vector of cumulated booking limits. */ void fillup (BookingLimitVector_T&) const; - /** Destructor. */ - virtual ~BucketHolder(); - /** Get the current element (bucket/class). */ Bucket& getCurrentBucket () const; @@ -88,6 +77,34 @@ - the booking limits and cumulated booking limits. */ void recalculate (); + public: + // ///////// Display methods //////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream&) const; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream&); + + /** Get the serialised version of the Place object. */ + std::string toString() const; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const; + + /** Display the full Place context. */ + const std::string display() const; + + /** Display a short Place context. */ + const std::string shortDisplay() const; + + private: /** Constructor. <br>Protected to force the use of the Factory. */ @@ -98,6 +115,10 @@ <br>Protected to force the use of the Factory. */ BucketHolder (const double iCabinCapacity); + /** Destructor. */ + virtual ~BucketHolder(); + + private: /** The capacity of the cabin associated to the bucket/class list. */ const double _cabinCapacity; Modified: trunk/rmol/rmol/bom/Demand.cpp =================================================================== --- trunk/rmol/rmol/bom/Demand.cpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/Demand.cpp 2009-03-08 17:51:26 UTC (rev 174) @@ -29,6 +29,51 @@ } // ////////////////////////////////////////////////////////////////////// + const std::string Demand::describeShortKey() const { + std::ostringstream oStr; + oStr << _yieldRange; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Demand::describeKey() const { + return describeShortKey(); + } + + // ////////////////////////////////////////////////////////////////////// + std::string Demand::toString() const { + std::ostringstream oStr; + oStr << describeShortKey() << ", "; + oStr << _distributionParameters; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + void Demand::toStream (std::ostream& ioOut) const { + ioOut << toString(); + } + + // ////////////////////////////////////////////////////////////////////// + void Demand::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Demand::shortDisplay() const { + std::ostringstream oStr; + oStr << describeKey(); + oStr << ", distribution parameters = " << _distributionParameters + << std::endl; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Demand::display() const { + std::ostringstream oStr; + oStr << shortDisplay(); + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// double Demand::getUpperYield() const { return _yieldRange.getUpperYield(); } Modified: trunk/rmol/rmol/bom/Demand.hpp =================================================================== --- trunk/rmol/rmol/bom/Demand.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/Demand.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -21,7 +21,7 @@ friend class FacDemand; public: - // Getters + // ///////// Getters //////// /** Getter for the demand distribution parmaters (i.e., mean and standard deviation). */ const FldDistributionParameters& getDistributionParameters() const { @@ -31,35 +31,69 @@ const FldYieldRange& getYieldRange() const { return _yieldRange; } + /** Getter for the upper yield of the range. */ double getUpperYield() const; + /** Getter for the average yield of the range. */ double getAverageYield() const; + /** Getter for the lower yield of the range. */ double getLowerYield(); + /** Getter for the mean value. */ double getMean() const; + /** Getter for the standard deviation value. */ double getStandardDeviation() const; + /** Getter for the variance value. */ double getVariance() const; - // Setters + + // ///////// Setters //////// /** Set the mean value. */ void setMean (const double); /** set the standard deviation. */ void setSD (const double); + - /** Destructors. */ - virtual ~Demand(); + public: + // ///////// Display methods //////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream&) const; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream&); + + /** Get the serialised version of the Place object. */ + std::string toString() const; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const; + /** Display the full Place context. */ + const std::string display() const; + + /** Display a short Place context. */ + const std::string shortDisplay() const; + private: /** Constructors. <br>Protected to force the use of the Factory. */ Demand (); Demand (const Demand&); Demand (const FldDistributionParameters&, const FldYieldRange&); + /** Destructors. */ + ~Demand(); private: /** Yield range, i.e., upper and lower yields, as well as average yield Modified: trunk/rmol/rmol/bom/Overbooking.cpp =================================================================== --- trunk/rmol/rmol/bom/Overbooking.cpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/Overbooking.cpp 2009-03-08 17:51:26 UTC (rev 174) @@ -70,7 +70,68 @@ Overbooking::~Overbooking() { } + // ////////////////////////////////////////////////////////////////////// + const std::string Overbooking::describeShortKey() const { + std::ostringstream oStr; + oStr << _policy; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Overbooking::describeKey() const { + return describeShortKey(); + } + // ////////////////////////////////////////////////////////////////////// + std::string Overbooking::toString() const { + std::ostringstream oStr; + oStr << describeShortKey() + << ", " << _policy << ", " << _overbookingPercentage + << ", " << _capacity << ", " << _netBookings + << ", " << _loadFactor + << ", " << _noShowDistributionParameters + << ", " << _cancellationDistributionParameters + << ", " << _remainingCancellationDistributionParameters + << ", " << _demandDistributionParameters + << std::endl; + + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + void Overbooking::toStream (std::ostream& ioOut) const { + ioOut << toString(); + } + + // ////////////////////////////////////////////////////////////////////// + void Overbooking::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Overbooking::shortDisplay() const { + std::ostringstream oStr; + oStr << describeKey(); + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string Overbooking::display() const { + std::ostringstream oStr; + oStr << shortDisplay(); + oStr << "Policy = " << _policy + << "; OB% = " << _overbookingPercentage + << "; Capacity = " << _capacity + << "; Net Bookings = " << _netBookings + << "; Load Factor (LF) = " << _loadFactor + << "; No-Show Distrib. Params = " << _noShowDistributionParameters + << "; Cx Distrib. Params = " << _cancellationDistributionParameters + << "; Rem. Cx Distrib. Params = " << _remainingCancellationDistributionParameters + << "; Demand Distrib. Params = " << _demandDistributionParameters + << std::endl; + return oStr.str(); + } + + // ////////////// TODO: REMOVE THOSE CONSTANTS ////////// //Parameters given by RMS User , for the prototype we set at //predefined values Modified: trunk/rmol/rmol/bom/Overbooking.hpp =================================================================== --- trunk/rmol/rmol/bom/Overbooking.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/Overbooking.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -24,9 +24,6 @@ friend class FacOverbooking; public: - /** Destructor. */ - virtual ~Overbooking(); - // ///////// Getters ///////// /** Get the overbooking calculation policy. */ const FldOverbookingPolicy& getPolicy () const { @@ -53,6 +50,7 @@ return _netBookings; } + /** Get the No-Show Distribution Parameters. */ FldDistributionParameters getNoShowDistributionParameters () const { return _noShowDistributionParameters; @@ -116,24 +114,57 @@ } /** Set the net bookings. */ - void getNetBookings (const unsigned int iNetBookings) { + void setNetBookings (const unsigned int iNetBookings) { _netBookings = iNetBookings; } - + // /////////// /** This function return the OB% with its standard deviation following the given choice of method*/ FldDistributionParameters getOverbookingCalculation () const; + /** This function calculates the OB% by the heuristic method */ FldDistributionParameters calculateHeuristic() const; + /** This function calculates the OB% by the cost-based method */ FldDistributionParameters calculateRiskBased() const; + /** This function calculates the OB% by the service level policies */ FldDistributionParameters calculateServiceLevel() const; + /** This function calculates the OB% by the Hybrid policy*/ FldDistributionParameters calculateHybridPolicy() const; + + public: + // ///////// Display methods //////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream&) const; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream&); + + /** Get the serialised version of the Place object. */ + std::string toString() const; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const; + + /** Display the full Place context. */ + const std::string display() const; + + /** Display a short Place context. */ + const std::string shortDisplay() const; + + private: /** Constructors. <br>Protected to force the use of the Factory. */ @@ -141,19 +172,29 @@ Overbooking (const Overbooking&); Overbooking (const FldOverbookingPolicy&); - /** */ + /** Destructor. */ + virtual ~Overbooking(); + + + private: + /** Calculate the booking limit. */ double calculateBookingLimit () const; - /** */ + + /** Calculate the normal probability. */ double probabilityNormal (const int, const double, const double) const; - /** */ + + /** Calculate the binomial probability. */ double binomialProbability_F_b_s (const double, const int, const int) const; - /** */ + /** Calculate the first service level. */ double serviceLevel1 (const double, const int, const int) const; - /** */ + + /** Calculate the fraction of service level 2. */ double fractionServiceLevel2 (const double , const int , const int) const; + private: + // /////// Attributes ////////// /** Overbooking Calculation Policy. */ FldOverbookingPolicy _policy; Modified: trunk/rmol/rmol/bom/PartialSumHolder.cpp =================================================================== --- trunk/rmol/rmol/bom/PartialSumHolder.cpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/PartialSumHolder.cpp 2009-03-08 17:51:26 UTC (rev 174) @@ -26,24 +26,55 @@ } // ////////////////////////////////////////////////////////////////////// + const std::string PartialSumHolder::describeShortKey() const { + std::ostringstream oStr; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string PartialSumHolder::describeKey() const { + return describeShortKey(); + } + + // ////////////////////////////////////////////////////////////////////// + std::string PartialSumHolder::toString() const { + std::ostringstream oStr; + oStr << _partialSumList.size(); + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// void PartialSumHolder::toStream (std::ostream& ioOut) const { + ioOut << toString(); + } + + // ////////////////////////////////////////////////////////////////////// + void PartialSumHolder::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + const std::string PartialSumHolder::shortDisplay() const { + std::ostringstream oStr; + oStr << describeKey(); // Generate a CSV (Comma Separated Values) output - ioOut << "Partial Sum (K = " << _partialSumList.size() << "); " - << std::endl; + oStr << "Partial Sum (K = " << _partialSumList.size() << ")" << std::endl; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string PartialSumHolder::display() const { + std::ostringstream oStr; + oStr << shortDisplay(); PartialSumList_T::const_iterator itPartialSum = _partialSumList.begin(); for (short k=1; itPartialSum != _partialSumList.end(); itPartialSum++,k++){ const double currentPartialSum = *itPartialSum; - ioOut << k << "; " << currentPartialSum; + oStr << k << "; " << currentPartialSum; } + return oStr.str(); } // ////////////////////////////////////////////////////////////////////// - void PartialSumHolder::display () const { - toStream (std::cout); - } - - // ////////////////////////////////////////////////////////////////////// void PartialSumHolder::initSize (const int K) { _partialSumList.reserve (K); } Modified: trunk/rmol/rmol/bom/PartialSumHolder.hpp =================================================================== --- trunk/rmol/rmol/bom/PartialSumHolder.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/PartialSumHolder.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -21,12 +21,13 @@ friend class FacPartialSumHolder; public: + // ///////// Getters ///////// + /** Get the k-th element (partial sum). */ + const double getPartialSum (const int k) const; + /** Reserve the space for K elements (partial sums). */ void initSize (const int K); - /** Get the k-th element (partial sum). */ - const double getPartialSum (const int k) const; - /** Add an element (partial sum). */ void addPartialSum (const double iPartialSum); @@ -35,22 +36,45 @@ complexity of O (N log N): http://www.sgi.com/tech/stl/sort.html . */ void sort (); + public: + // ///////// Display methods //////// /** Dump a Business Object into an output stream. - @param ostream& the output stream - @return ostream& the output stream. */ - void toStream (std::ostream& ioOut) const; + @param ostream& the output stream. */ + void toStream (std::ostream&) const; - /** Display on standard output. */ - void display () const; + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream&); - /** Destructor. */ - virtual ~PartialSumHolder(); + /** Get the serialised version of the Place object. */ + std::string toString() const; + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const; + + /** Display the full Place context. */ + const std::string display() const; + + /** Display a short Place context. */ + const std::string shortDisplay() const; + + private: /** Constructors. */ PartialSumHolder (); PartialSumHolder (const PartialSumHolder&); + /** Destructor. */ + virtual ~PartialSumHolder(); + + + private: + // ///////// Attributes ///////// /** The vector of (K) partial sums. */ PartialSumList_T _partialSumList; }; Modified: trunk/rmol/rmol/bom/PartialSumHolderHolder.cpp =================================================================== --- trunk/rmol/rmol/bom/PartialSumHolderHolder.cpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/PartialSumHolderHolder.cpp 2009-03-08 17:51:26 UTC (rev 174) @@ -4,7 +4,8 @@ // C #include <assert.h> // STL -#include <iostream> +#include <istream> +#include <ostream> // RMOL #include <rmol/bom/PartialSumHolder.hpp> #include <rmol/bom/PartialSumHolderHolder.hpp> @@ -21,36 +22,65 @@ } // ////////////////////////////////////////////////////////////////////// - const short PartialSumHolderHolder::getSize () const { - return _partialSumHolderList.size(); + const std::string PartialSumHolderHolder::describeShortKey() const { + std::ostringstream oStr; + return oStr.str(); } + + // ////////////////////////////////////////////////////////////////////// + const std::string PartialSumHolderHolder::describeKey() const { + return describeShortKey(); + } // ////////////////////////////////////////////////////////////////////// + std::string PartialSumHolderHolder::toString() const { + std::ostringstream oStr; + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// void PartialSumHolderHolder::toStream (std::ostream& ioOut) const { + ioOut << toString(); + } + + // ////////////////////////////////////////////////////////////////////// + void PartialSumHolderHolder::fromStream (std::istream& ioIn) { + } + + // ////////////////////////////////////////////////////////////////////// + const std::string PartialSumHolderHolder::shortDisplay() const { + std::ostringstream oStr; + oStr << describeKey(); + return oStr.str(); + } + + // ////////////////////////////////////////////////////////////////////// + const std::string PartialSumHolderHolder::display() const { + std::ostringstream oStr; + oStr << shortDisplay(); + PartialSumHolderList_T::const_iterator itPartialSumHolder = _partialSumHolderList.begin(); - for (short j=1; itPartialSumHolder != _partialSumHolderList.end(); - itPartialSumHolder++, j++) { - const PartialSumHolder* currentPartialSumHolder_ptr = - *itPartialSumHolder; + for (short j = 1; itPartialSumHolder != _partialSumHolderList.end(); + itPartialSumHolder++, j++) { + const PartialSumHolder* currentPartialSumHolder_ptr = *itPartialSumHolder; assert (currentPartialSumHolder_ptr != NULL); - - ioOut << j << "; " << (*currentPartialSumHolder_ptr); + + oStr << j << "; " << currentPartialSumHolder_ptr->display(); } + return oStr.str(); } // ////////////////////////////////////////////////////////////////////// - void PartialSumHolderHolder::display () const { - toStream (std::cout); + const short PartialSumHolderHolder::getSize () const { + return _partialSumHolderList.size(); } // ////////////////////////////////////////////////////////////////////// PartialSumHolder& PartialSumHolderHolder:: getPreviousPartialSumHolder () const { - PartialSumHolder* resultPartialSumHolder_ptr = - *_itPreviousPartialSumHolder; + PartialSumHolder* resultPartialSumHolder_ptr= *_itPreviousPartialSumHolder; assert (resultPartialSumHolder_ptr != NULL); - return (*resultPartialSumHolder_ptr); } @@ -59,7 +89,6 @@ getCurrentPartialSumHolder () const { PartialSumHolder* resultPartialSumHolder_ptr = *_itCurrentPartialSumHolder; assert (resultPartialSumHolder_ptr != NULL); - return (*resultPartialSumHolder_ptr); } Modified: trunk/rmol/rmol/bom/PartialSumHolderHolder.hpp =================================================================== --- trunk/rmol/rmol/bom/PartialSumHolderHolder.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/bom/PartialSumHolderHolder.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -21,21 +21,11 @@ friend class FacPartialSumHolderHolder; public: + // ///////// Getters ///////// /** Get the size of the internal list (i.e., number of partial sum lists). */ const short getSize () const; - /** Dump a Business Object into an output stream. - @param ostream& the output stream - @return ostream& the output stream. */ - void toStream (std::ostream& ioOut) const; - - /** Display on standard output. */ - void display () const; - - /** Destructor. */ - virtual ~PartialSumHolderHolder(); - /** Get the previous element (partial sum holder/list). */ PartialSumHolder& getPreviousPartialSumHolder () const; @@ -55,19 +45,54 @@ list has been reached. */ bool hasNotReachedEnd () const; + public: + // ///////// Display methods //////// + /** Dump a Business Object into an output stream. + @param ostream& the output stream. */ + void toStream (std::ostream&) const; + + /** Read a Business Object from an input stream. + @param istream& the input stream. */ + void fromStream (std::istream&); + + /** Get the serialised version of the Place object. */ + std::string toString() const; + + /** Get a string describing the whole key (differentiating two objects + at any level). */ + const std::string describeKey() const; + + /** Get a string describing the short key (differentiating two objects + at the same level). */ + const std::string describeShortKey() const; + + /** Display the full Place context. */ + const std::string display() const; + + /** Display a short Place context. */ + const std::string shortDisplay() const; + + private: /** Constructors. */ PartialSumHolderHolder(); /** Reserve the space for iSize elements (partial sum holders). */ PartialSumHolderHolder (const int iSize); + /** Destructor. */ + virtual ~PartialSumHolderHolder(); + + + private: /** Add an element (partial sum holder/list). <br>Note that the Bucket object may be altered by subsequent operations. <br>Protected to force the use of the Factory. */ void addPartialSumHolder (PartialSumHolder&); + private: + // //////// Attributes ///////// /** The vector of (K) partial sums. */ PartialSumHolderList_T _partialSumHolderList; Deleted: trunk/rmol/rmol/factory/FacAbstract.cpp =================================================================== --- trunk/rmol/rmol/factory/FacAbstract.cpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/factory/FacAbstract.cpp 2009-03-08 17:51:26 UTC (rev 174) @@ -1,31 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// C -#include <assert.h> -// RMOL -#include <rmol/bom/BomAbstract.hpp> -#include <rmol/factory/FacAbstract.hpp> - -namespace RMOL { - - // ////////////////////////////////////////////////////////////////////// - FacAbstract::~FacAbstract() { - clean (); - } - - // ////////////////////////////////////////////////////////////////////// - void FacAbstract::clean() { - for (BomPool_T::iterator itBom = _pool.begin(); - itBom != _pool.end(); itBom++) { - BomAbstract* currentBom_ptr = *itBom; - assert (currentBom_ptr != NULL); - - delete (currentBom_ptr); currentBom_ptr = NULL; - } - - // Empty the pool of Factories - _pool.clear(); - } - -} Deleted: trunk/rmol/rmol/factory/FacAbstract.hpp =================================================================== --- trunk/rmol/rmol/factory/FacAbstract.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/factory/FacAbstract.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -1,37 +0,0 @@ -#ifndef __RMOL_FAC_FACABSTRACT_HPP -#define __RMOL_FAC_FACABSTRACT_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <vector> - -namespace RMOL { - - // Forward declarations - class BomAbstract; - - /** Base class for Factory layer. */ - class FacAbstract { - public: - - /** Define the list (pool) of Bom objects. */ - typedef std::vector<BomAbstract*> BomPool_T; - - /** Destructor. */ - virtual ~FacAbstract(); - - /** Destroyed all the object instantiated by this factory. */ - void clean(); - - protected: - /** Default Constructor. - <br>This constructor is protected to ensure the class is abstract. */ - FacAbstract() {} - - /** List of instantiated Business Objects*/ - BomPool_T _pool; - }; -} -#endif // __RMOL_FAC_FACABSTRACT_HPP Copied: trunk/rmol/rmol/factory/FacBomAbstract.cpp (from rev 168, trunk/rmol/rmol/factory/FacAbstract.cpp) =================================================================== --- trunk/rmol/rmol/factory/FacBomAbstract.cpp (rev 0) +++ trunk/rmol/rmol/factory/FacBomAbstract.cpp 2009-03-08 17:51:26 UTC (rev 174) @@ -0,0 +1,31 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// C +#include <assert.h> +// RMOL +#include <rmol/bom/BomAbstract.hpp> +#include <rmol/factory/FacBomAbstract.hpp> + +namespace RMOL { + + // ////////////////////////////////////////////////////////////////////// + FacBomAbstract::~FacBomAbstract() { + clean (); + } + + // ////////////////////////////////////////////////////////////////////// + void FacBomAbstract::clean() { + for (BomPool_T::iterator itBom = _pool.begin(); + itBom != _pool.end(); itBom++) { + BomAbstract* currentBom_ptr = *itBom; + assert (currentBom_ptr != NULL); + + delete (currentBom_ptr); currentBom_ptr = NULL; + } + + // Empty the pool of Factories + _pool.clear(); + } + +} Property changes on: trunk/rmol/rmol/factory/FacBomAbstract.cpp ___________________________________________________________________ Added: svn:mergeinfo + Copied: trunk/rmol/rmol/factory/FacBomAbstract.hpp (from rev 168, trunk/rmol/rmol/factory/FacAbstract.hpp) =================================================================== --- trunk/rmol/rmol/factory/FacBomAbstract.hpp (rev 0) +++ trunk/rmol/rmol/factory/FacBomAbstract.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -0,0 +1,37 @@ +#ifndef __RMOL_FAC_FACBOMABSTRACT_HPP +#define __RMOL_FAC_FACBOMABSTRACT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <vector> + +namespace RMOL { + + // Forward declarations + class BomAbstract; + + /** Base class for Factory layer. */ + class FacBomAbstract { + public: + + /** Define the list (pool) of Bom objects. */ + typedef std::vector<BomAbstract*> BomPool_T; + + /** Destructor. */ + virtual ~FacBomAbstract(); + + /** Destroyed all the object instantiated by this factory. */ + void clean(); + + protected: + /** Default Constructor. + <br>This constructor is protected to ensure the class is abstract. */ + FacBomAbstract() {} + + /** List of instantiated Business Objects*/ + BomPool_T _pool; + }; +} +#endif // __RMOL_FAC_FACBOMABSTRACT_HPP Property changes on: trunk/rmol/rmol/factory/FacBomAbstract.hpp ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/rmol/rmol/factory/FacBucket.hpp =================================================================== --- trunk/rmol/rmol/factory/FacBucket.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/factory/FacBucket.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -5,7 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // RMOL -#include <rmol/factory/FacAbstract.hpp> +#include <rmol/factory/FacBomAbstract.hpp> namespace RMOL { @@ -15,7 +15,7 @@ class Demand; /** Factory for Bucket. */ - class FacBucket : public FacAbstract { + class FacBucket : public FacBomAbstract { public: /** Provide the unique instance. Modified: trunk/rmol/rmol/factory/FacBucketHolder.hpp =================================================================== --- trunk/rmol/rmol/factory/FacBucketHolder.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/factory/FacBucketHolder.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -5,7 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // RMOL -#include <rmol/factory/FacAbstract.hpp> +#include <rmol/factory/FacBomAbstract.hpp> namespace RMOL { @@ -14,7 +14,7 @@ class Bucket; /** Factory for Bucket. */ - class FacBucketHolder : public FacAbstract { + class FacBucketHolder : public FacBomAbstract { public: /** Provide the unique instance. Modified: trunk/rmol/rmol/factory/FacDemand.hpp =================================================================== --- trunk/rmol/rmol/factory/FacDemand.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/factory/FacDemand.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -5,7 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // RMOL -#include <rmol/factory/FacAbstract.hpp> +#include <rmol/factory/FacBomAbstract.hpp> namespace RMOL { @@ -15,7 +15,7 @@ class Demand; /** Factory for Demand. */ - class FacDemand : public FacAbstract { + class FacDemand : public FacBomAbstract { public: /** Provide the unique instance. Modified: trunk/rmol/rmol/factory/FacOverbooking.hpp =================================================================== --- trunk/rmol/rmol/factory/FacOverbooking.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/factory/FacOverbooking.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -5,7 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // RMOL -#include <rmol/factory/FacAbstract.hpp> +#include <rmol/factory/FacBomAbstract.hpp> namespace RMOL { @@ -14,7 +14,7 @@ class Overbooking; /** Factory for Overbooking. */ - class FacOverbooking : public FacAbstract { + class FacOverbooking : public FacBomAbstract { public: /** Provide the unique instance. Modified: trunk/rmol/rmol/factory/FacPartialSumHolder.hpp =================================================================== --- trunk/rmol/rmol/factory/FacPartialSumHolder.hpp 2009-03-08 06:47:19 UTC (rev 173) +++ trunk/rmol/rmol/factory/FacPartialSumHolder.hpp 2009-03-08 17:51:26 UTC (rev 174) @@ -5,7 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // RMOL -#include <rm... [truncated message content] |