|
From: <den...@us...> - 2009-12-24 16:05:37
|
Revision: 20
http://dsim.svn.sourceforge.net/dsim/?rev=20&view=rev
Author: denis_arnaud
Date: 2009-12-24 16:05:27 +0000 (Thu, 24 Dec 2009)
Log Message:
-----------
[Dev] Now delegates the booking sell to the SimCRS and AirInv services.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
trunk/dsim/dsim/command/Simulator.hpp
trunk/dsim/dsim/service/Makefile.am
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2009-12-24 15:32:19 UTC (rev 19)
+++ trunk/dsim/dsim/command/Simulator.cpp 2009-12-24 16:05:27 UTC (rev 20)
@@ -31,6 +31,9 @@
// Make a booking
ioSIMCRS_Service.sell (lAirlineCode, lPartySize);
+ // DEBUG
+ DSIM_LOG_DEBUG ("The simulation has ended");
+
} catch (const std::exception& lStdError) {
DSIM_LOG_ERROR ("Error: " << lStdError.what());
throw SimulationException();
Modified: trunk/dsim/dsim/command/Simulator.hpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.hpp 2009-12-24 15:32:19 UTC (rev 19)
+++ trunk/dsim/dsim/command/Simulator.hpp 2009-12-24 16:05:27 UTC (rev 20)
@@ -20,7 +20,7 @@
private:
/** Perform a simulation. */
- static void simulate (SIMCRS::SIMCRS_Service& lSIMCRS_Service);
+ static void simulate (SIMCRS::SIMCRS_Service&);
private:
/** Constructors. */
Modified: trunk/dsim/dsim/service/Makefile.am
===================================================================
--- trunk/dsim/dsim/service/Makefile.am 2009-12-24 15:32:19 UTC (rev 19)
+++ trunk/dsim/dsim/service/Makefile.am 2009-12-24 16:05:27 UTC (rev 20)
@@ -5,7 +5,7 @@
noinst_LTLIBRARIES= libsvc.la
libsvc_la_SOURCES= $(svc_h_sources) $(svc_cc_sources)
-libsvc_la_CXXFLAGS = $(SOCI_CFLAGS)
+libsvc_la_CXXFLAGS = $(BOOST_CFLAGS)
#pkgincludedir = $(includedir)/@PACKAGE@/service
#pkginclude_HEADERS = $(svc_h_sources)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2009-12-30 10:37:43
|
Revision: 35
http://dsim.svn.sourceforge.net/dsim/?rev=35&view=rev
Author: quannaus
Date: 2009-12-30 10:37:35 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[Dev] Reordered some parts in the header files.
Modified Paths:
--------------
trunk/dsim/dsim/DSIM_Service.hpp
trunk/dsim/dsim/bom/ConfigurationParameters.hpp
trunk/dsim/dsim/bom/RDSParameters.hpp
trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
Modified: trunk/dsim/dsim/DSIM_Service.hpp
===================================================================
--- trunk/dsim/dsim/DSIM_Service.hpp 2009-12-30 10:14:40 UTC (rev 34)
+++ trunk/dsim/dsim/DSIM_Service.hpp 2009-12-30 10:37:35 UTC (rev 35)
@@ -18,12 +18,12 @@
/** Interface for the DSIM Services. */
class DSIM_Service {
+ public:
+ // /////////// Business Methods /////////////
+ /** Perform a simulation. */
+ void simulate();
- private:
- // ///////// Service Context /////////
- /** Dsim context. */
- DSIM_ServiceContext* _dsimServiceContext;
-
+
public:
// ////////// Constructors and destructors //////////
/** Constructor.
@@ -47,10 +47,11 @@
/** Finalise. */
void finalise ();
- public:
- // /////////// Business Methods /////////////
- /** Perform a simulation. */
- void simulate();
+
+ private:
+ // ///////// Service Context /////////
+ /** Dsim context. */
+ DSIM_ServiceContext* _dsimServiceContext;
};
}
Modified: trunk/dsim/dsim/bom/ConfigurationParameters.hpp
===================================================================
--- trunk/dsim/dsim/bom/ConfigurationParameters.hpp 2009-12-30 10:14:40 UTC (rev 34)
+++ trunk/dsim/dsim/bom/ConfigurationParameters.hpp 2009-12-30 10:37:35 UTC (rev 35)
@@ -11,10 +11,15 @@
/** Structure wrapping the configuration parameters. */
struct ConfigurationParameters : public StructAbstract {
-
public:
- // ///////// Attributes //////////
+ // //////// GETTERS /////////
+ // //////// SETTERS /////////
+
+ /////////// DISPLAY METHOD ///////////
+ const std::string describe() const;
+
+
public:
/** Costructor. */
ConfigurationParameters ();
@@ -23,15 +28,8 @@
/** Destructor. */
~ConfigurationParameters ();
-
public:
- // //////// GETTERS /////////
-
- // //////// SETTERS /////////
-
- /////////// DISPLAY METHOD ///////////
- const std::string describe() const;
-
+ // ///////// Attributes //////////
};
}
Modified: trunk/dsim/dsim/bom/RDSParameters.hpp
===================================================================
--- trunk/dsim/dsim/bom/RDSParameters.hpp 2009-12-30 10:14:40 UTC (rev 34)
+++ trunk/dsim/dsim/bom/RDSParameters.hpp 2009-12-30 10:37:35 UTC (rev 35)
@@ -13,19 +13,6 @@
struct RDSParameters : public StructAbstract {
public:
- // ////////// Attributes ///////////
- /** Schedule input filename. */
- std::string _scheduleInputFilename;
-
- public:
- /** Costructor. */
- RDSParameters ();
- RDSParameters (const RDSParameters&);
-
- /** Destructor. */
- ~RDSParameters ();
-
- public:
// //////// GETTERS /////////
/** Get the schedule input filename. */
const std::string& getScheduleInputFilename () const {
@@ -41,6 +28,19 @@
/////////// DISPLAY METHOD ///////////
const std::string describe() const;
+
+ public:
+ /** Costructor. */
+ RDSParameters ();
+ RDSParameters (const RDSParameters&);
+
+ /** Destructor. */
+ ~RDSParameters ();
+
+ public:
+ // ////////// Attributes ///////////
+ /** Schedule input filename. */
+ std::string _scheduleInputFilename;
};
}
Modified: trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2009-12-30 10:14:40 UTC (rev 34)
+++ trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2009-12-30 10:37:35 UTC (rev 35)
@@ -28,33 +28,6 @@
/** Class holding the context of the Dsim services. */
class DSIM_ServiceContext : public ServiceAbstract {
friend class FacDsimServiceContext;
-
- private:
- // ///////////// Children ////////////
- /** CRS Service Handler. */
- SIMCRS_ServicePtr_T _simcrsService;
-
- private:
- // //////////// Attributes //////////////////
- /** Simulator ID. */
- SimulatorID_T _simulatorID;
-
- /** Configuration parameters. */
- ConfigurationParameters _configurationParameters;
-
- /** Reference Data Set parameters. */
- RDSParameters _rdsParameters;
-
- private:
- // /////// Construction / initialisation ////////
- /** Constructors. */
- DSIM_ServiceContext ();
- DSIM_ServiceContext (const SimulatorID_T&);
- DSIM_ServiceContext (const DSIM_ServiceContext&);
-
- /** Destructor. */
- ~DSIM_ServiceContext();
-
public:
// ///////// Getters //////////
/** Get the simulator ID. */
@@ -106,5 +79,31 @@
const std::string display() const;
};
+ private:
+ // /////// Construction / initialisation ////////
+ /** Constructors. */
+ DSIM_ServiceContext ();
+ DSIM_ServiceContext (const SimulatorID_T&);
+ DSIM_ServiceContext (const DSIM_ServiceContext&);
+
+ /** Destructor. */
+ ~DSIM_ServiceContext();
+
+ private:
+ // ///////////// Children ////////////
+ /** CRS Service Handler. */
+ SIMCRS_ServicePtr_T _simcrsService;
+
+ private:
+ // //////////// Attributes //////////////////
+ /** Simulator ID. */
+ SimulatorID_T _simulatorID;
+
+ /** Configuration parameters. */
+ ConfigurationParameters _configurationParameters;
+
+ /** Reference Data Set parameters. */
+ RDSParameters _rdsParameters;
+
}
#endif // __DSIM_SVC_DSIMSERVICECONTEXT_HPP
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2009-12-30 11:28:36
|
Revision: 34
http://dsim.svn.sourceforge.net/dsim/?rev=34&view=rev
Author: quannaus
Date: 2009-12-30 10:14:40 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[Dev] Added the ConfigurationParameters and the RDSParameters holders.
Modified Paths:
--------------
trunk/dsim/dsim/DSIM_Service.hpp
trunk/dsim/dsim/bom/sources.mk
trunk/dsim/dsim/service/DSIM_Service.cpp
trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
Added Paths:
-----------
trunk/dsim/dsim/bom/ConfigurationParameters.cpp
trunk/dsim/dsim/bom/ConfigurationParameters.hpp
trunk/dsim/dsim/bom/RDSParameters.cpp
trunk/dsim/dsim/bom/RDSParameters.hpp
trunk/dsim/dsim/bom/StructAbstract.hpp
Modified: trunk/dsim/dsim/DSIM_Service.hpp
===================================================================
--- trunk/dsim/dsim/DSIM_Service.hpp 2009-12-30 10:13:43 UTC (rev 33)
+++ trunk/dsim/dsim/DSIM_Service.hpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -14,20 +14,21 @@
// Forward declaration
class DSIM_ServiceContext;
-
+ struct RDSParameters;
/** Interface for the DSIM Services. */
class DSIM_Service {
+
+ private:
+ // ///////// Service Context /////////
+ /** Dsim context. */
+ DSIM_ServiceContext* _dsimServiceContext;
+
public:
- // /////////// Business Methods /////////////
- /** Perform a simulation. */
- void simulate();
-
-
// ////////// Constructors and destructors //////////
/** Constructor.
@param std::ostream& Output log stream (for instance, std::cout). */
- DSIM_Service (std::ostream& ioLogStream);
+ DSIM_Service (const std::string&, std::ostream& ioLogStream);
/** Destructor. */
~DSIM_Service();
@@ -41,16 +42,16 @@
DSIM_Service (const DSIM_Service&);
/** Initialise. */
- void init (std::ostream& ioLogStream);
+ void init (const std::string&, std::ostream& ioLogStream);
/** Finalise. */
void finalise ();
-
- private:
- // ///////// Service Context /////////
- /** Dsim context. */
- DSIM_ServiceContext* _dsimServiceContext;
+ public:
+ // /////////// Business Methods /////////////
+ /** Perform a simulation. */
+ void simulate();
+
};
}
#endif // __DSIM_SVC_DSIM_SERVICE_HPP
Added: trunk/dsim/dsim/bom/ConfigurationParameters.cpp
===================================================================
--- trunk/dsim/dsim/bom/ConfigurationParameters.cpp (rev 0)
+++ trunk/dsim/dsim/bom/ConfigurationParameters.cpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -0,0 +1,39 @@
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <sstream>
+#include <cassert>
+// DSIM
+#include <dsim/bom/ConfigurationParameters.hpp>
+#include <dsim/service/Logger.hpp>
+
+namespace DSIM {
+
+ // ////////////////////////////////////////////////////////////////////
+ ConfigurationParameters::ConfigurationParameters () {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ ConfigurationParameters::
+ ConfigurationParameters (const ConfigurationParameters& iConfigurationParameters) {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ ConfigurationParameters::~ConfigurationParameters () {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ const std::string ConfigurationParameters::describe() const {
+ // Store current formatting flags of std::cout
+ std::ios::fmtflags oldFlags = std::cout.flags();
+
+ std::ostringstream ostr;
+
+ // Reset formatting flags of std::cout
+ std::cout.flags (oldFlags);
+
+ return ostr.str();
+ }
+
+}
Added: trunk/dsim/dsim/bom/ConfigurationParameters.hpp
===================================================================
--- trunk/dsim/dsim/bom/ConfigurationParameters.hpp (rev 0)
+++ trunk/dsim/dsim/bom/ConfigurationParameters.hpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -0,0 +1,38 @@
+#ifndef __DSIM_BOM_CONFIGURATIONPARAMETERS_HPP
+#define __DSIM_BOM_CONFIGURATIONPARAMETERS_HPP
+
+// //////////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////////
+// DSIM
+#include <dsim/bom/StructAbstract.hpp>
+
+namespace DSIM {
+
+ /** Structure wrapping the configuration parameters. */
+ struct ConfigurationParameters : public StructAbstract {
+
+ public:
+ // ///////// Attributes //////////
+
+ public:
+ /** Costructor. */
+ ConfigurationParameters ();
+ ConfigurationParameters (const ConfigurationParameters&);
+
+ /** Destructor. */
+ ~ConfigurationParameters ();
+
+
+ public:
+ // //////// GETTERS /////////
+
+ // //////// SETTERS /////////
+
+ /////////// DISPLAY METHOD ///////////
+ const std::string describe() const;
+
+ };
+
+}
+#endif //__DSIM_BOM_CONFIGURATIONPARAMETERS_HPP
Added: trunk/dsim/dsim/bom/RDSParameters.cpp
===================================================================
--- trunk/dsim/dsim/bom/RDSParameters.cpp (rev 0)
+++ trunk/dsim/dsim/bom/RDSParameters.cpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -0,0 +1,44 @@
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <sstream>
+#include <cassert>
+// DSIM
+#include <dsim/bom/RDSParameters.hpp>
+#include <dsim/service/Logger.hpp>
+
+namespace DSIM {
+
+ // ////////////////////////////////////////////////////////////////////
+ RDSParameters::RDSParameters () {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ RDSParameters::RDSParameters (const RDSParameters& iRDSParameters)
+ : _scheduleInputFilename (iRDSParameters._scheduleInputFilename) {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ RDSParameters::~RDSParameters () {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ const std::string RDSParameters::describe() const {
+ // Store current formatting flags of std::cout
+ std::ios::fmtflags oldFlags = std::cout.flags();
+
+ std::ostringstream ostr;
+
+ ostr << "RDS Parameters: " << std::endl;
+
+ ostr << " Schedule file: " << _scheduleInputFilename;
+ ostr << std::endl;
+
+ // Reset formatting flags of std::cout
+ std::cout.flags (oldFlags);
+
+ return ostr.str();
+ }
+
+}
Added: trunk/dsim/dsim/bom/RDSParameters.hpp
===================================================================
--- trunk/dsim/dsim/bom/RDSParameters.hpp (rev 0)
+++ trunk/dsim/dsim/bom/RDSParameters.hpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -0,0 +1,47 @@
+#ifndef __DSIM_BOM_RDSPARAMETERS_HPP
+#define __DSIM_BOM_RDSPARAMETERS_HPP
+
+// //////////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////////
+// DSIM
+#include <dsim/bom/StructAbstract.hpp>
+
+namespace DSIM {
+
+ /** Structure wrapping the Reference Data Set parameters. */
+ struct RDSParameters : public StructAbstract {
+
+ public:
+ // ////////// Attributes ///////////
+ /** Schedule input filename. */
+ std::string _scheduleInputFilename;
+
+ public:
+ /** Costructor. */
+ RDSParameters ();
+ RDSParameters (const RDSParameters&);
+
+ /** Destructor. */
+ ~RDSParameters ();
+
+ public:
+ // //////// GETTERS /////////
+ /** Get the schedule input filename. */
+ const std::string& getScheduleInputFilename () const {
+ return _scheduleInputFilename;
+ }
+
+ // //////// SETTERS /////////
+ /** Set the schedule input filename. */
+ void setScheduleInputFilename (const std::string& iInputFilename) {
+ _scheduleInputFilename = iInputFilename;
+ }
+
+ /////////// DISPLAY METHOD ///////////
+ const std::string describe() const;
+
+ };
+
+}
+#endif //__DSIM_BOM_RDSPARAMETERS_HPP
Added: trunk/dsim/dsim/bom/StructAbstract.hpp
===================================================================
--- trunk/dsim/dsim/bom/StructAbstract.hpp (rev 0)
+++ trunk/dsim/dsim/bom/StructAbstract.hpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -0,0 +1,84 @@
+#ifndef __DSIM_BOM_STRUCTABSTRACT_HPP
+#define __DSIM_BOM_STRUCTABSTRACT_HPP
+
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <iostream>
+#include <sstream>
+
+namespace DSIM {
+
+ /** 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 DSIM::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,
+ DSIM::StructAbstract& ioStruct) {
+ // Fill the Structure object with the input stream.
+ ioStruct.fromStream (ioIn);
+ return ioIn;
+
+}
+
+#endif // __DSIM_BOM_STRUCTABSTRACT_HPP
Modified: trunk/dsim/dsim/bom/sources.mk
===================================================================
--- trunk/dsim/dsim/bom/sources.mk 2009-12-30 10:13:43 UTC (rev 33)
+++ trunk/dsim/dsim/bom/sources.mk 2009-12-30 10:14:40 UTC (rev 34)
@@ -1,2 +1,7 @@
-bom_h_sources = $(top_srcdir)/dsim/bom/BomAbstract.hpp
-bom_cc_sources = $(top_srcdir)/dsim/bom/BomAbstract.cpp
+bom_h_sources = $(top_srcdir)/dsim/bom/BomAbstract.hpp \
+ $(top_srcdir)/dsim/bom/StructAbstract.hpp \
+ $(top_srcdir)/dsim/bom/ConfigurationParameters.hpp \
+ $(top_srcdir)/dsim/bom/RDSParameters.hpp
+bom_cc_sources = $(top_srcdir)/dsim/bom/BomAbstract.cpp \
+ $(top_srcdir)/dsim/bom/ConfigurationParameters.cpp \
+ $(top_srcdir)/dsim/bom/RDSParameters.cpp
Modified: trunk/dsim/dsim/service/DSIM_Service.cpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_Service.cpp 2009-12-30 10:13:43 UTC (rev 33)
+++ trunk/dsim/dsim/service/DSIM_Service.cpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -21,9 +21,10 @@
// //////////////////////////////////////////////////////////////////////
DSIM_Service::
- DSIM_Service (std::ostream& ioLogStream)
+ DSIM_Service (const std::string& iScheduleInputFilename,
+ std::ostream& ioLogStream)
: _dsimServiceContext (NULL) {
- init (ioLogStream);
+ init (iScheduleInputFilename, ioLogStream);
}
// //////////////////////////////////////////////////////////////////////
@@ -50,7 +51,8 @@
}
// //////////////////////////////////////////////////////////////////////
- void DSIM_Service::init (std::ostream& ioLogStream) {
+ void DSIM_Service::init (const std::string& iScheduleInputFilename,
+ std::ostream& ioLogStream) {
// Set the log file
logInit (LOG::DEBUG, ioLogStream);
@@ -64,7 +66,8 @@
// Initialise the SIMCRS service handler
const SIMCRS::CRSCode_T lCRSCode = "1S";
SIMCRS_ServicePtr_T lSIMCRS_Service =
- SIMCRS_ServicePtr_T (new SIMCRS::SIMCRS_Service (ioLogStream, lCRSCode));
+ SIMCRS_ServicePtr_T (new SIMCRS::SIMCRS_Service (ioLogStream, lCRSCode,
+ iScheduleInputFilename));
lDSIM_ServiceContext.setSIMCRS_Service (lSIMCRS_Service);
}
Modified: trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2009-12-30 10:13:43 UTC (rev 33)
+++ trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -10,6 +10,8 @@
#include <boost/shared_ptr.hpp>
// Dsim
#include <dsim/DSIM_Types.hpp>
+#include <dsim/bom/ConfigurationParameters.hpp>
+#include <dsim/bom/RDSParameters.hpp>
#include <dsim/service/ServiceAbstract.hpp>
// Forward declarations
@@ -22,10 +24,37 @@
namespace DSIM {
-
+
/** Class holding the context of the Dsim services. */
class DSIM_ServiceContext : public ServiceAbstract {
friend class FacDsimServiceContext;
+
+ private:
+ // ///////////// Children ////////////
+ /** CRS Service Handler. */
+ SIMCRS_ServicePtr_T _simcrsService;
+
+ private:
+ // //////////// Attributes //////////////////
+ /** Simulator ID. */
+ SimulatorID_T _simulatorID;
+
+ /** Configuration parameters. */
+ ConfigurationParameters _configurationParameters;
+
+ /** Reference Data Set parameters. */
+ RDSParameters _rdsParameters;
+
+ private:
+ // /////// Construction / initialisation ////////
+ /** Constructors. */
+ DSIM_ServiceContext ();
+ DSIM_ServiceContext (const SimulatorID_T&);
+ DSIM_ServiceContext (const DSIM_ServiceContext&);
+
+ /** Destructor. */
+ ~DSIM_ServiceContext();
+
public:
// ///////// Getters //////////
/** Get the simulator ID. */
@@ -33,6 +62,16 @@
return _simulatorID;
}
+ /** Get the configuration parameters. */
+ const ConfigurationParameters& getConfigurationParameters () const {
+ return _configurationParameters;
+ }
+
+ /** Get the RDS parameters. */
+ const RDSParameters& getRDSParameters () const {
+ return _rdsParameters;
+ }
+
/** Get a reference on the SIMCRS service handler. */
SIMCRS::SIMCRS_Service& getSIMCRS_Service () const {
return *_simcrsService.get();
@@ -44,6 +83,16 @@
_simulatorID = iSimulatorID;
}
+ /** Set the configuration parameters. */
+ void setConfigurationParameters (const ConfigurationParameters& iConfigurationParameters) {
+ _configurationParameters = iConfigurationParameters;
+ }
+
+ /** Set the RDS parameters. */
+ void setRDSParameters (const RDSParameters& iRDSParameters) {
+ _rdsParameters = iRDSParameters;
+ }
+
/** Set the pointer on the SIMCRS service handler. */
void setSIMCRS_Service (SIMCRS_ServicePtr_T ioSIMCRS_ServicePtr) {
_simcrsService = ioSIMCRS_ServicePtr;
@@ -55,29 +104,6 @@
/** Display the full DSIM_ServiceContext content. */
const std::string display() const;
-
-
- private:
- // /////// Construction / initialisation ////////
- /** Constructors. */
- DSIM_ServiceContext ();
- DSIM_ServiceContext (const SimulatorID_T&);
- DSIM_ServiceContext (const DSIM_ServiceContext&);
-
- /** Destructor. */
- ~DSIM_ServiceContext();
-
-
- private:
- // ///////////// Children ////////////
- /** CRS Service Handler. */
- SIMCRS_ServicePtr_T _simcrsService;
-
-
- private:
- // //////////// Attributes //////////////////
- /** Simulator ID. */
- SimulatorID_T _simulatorID;
};
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-20 17:24:20
|
Revision: 50
http://dsim.svn.sourceforge.net/dsim/?rev=50&view=rev
Author: denis_arnaud
Date: 2010-01-20 17:24:13 +0000 (Wed, 20 Jan 2010)
Log Message:
-----------
[Dev] Removed the BasChronometer class, as it is now given by the StdAir library.
Modified Paths:
--------------
trunk/dsim/dsim/basic/sources.mk
trunk/dsim/dsim/service/DSIM_Service.cpp
Removed Paths:
-------------
trunk/dsim/dsim/basic/BasChronometer.cpp
trunk/dsim/dsim/basic/BasChronometer.hpp
Deleted: trunk/dsim/dsim/basic/BasChronometer.cpp
===================================================================
--- trunk/dsim/dsim/basic/BasChronometer.cpp 2010-01-19 18:41:41 UTC (rev 49)
+++ trunk/dsim/dsim/basic/BasChronometer.cpp 2010-01-20 17:24:13 UTC (rev 50)
@@ -1,50 +0,0 @@
-// //////////////////////////////////////////////////////////////////////
-// Import section
-// //////////////////////////////////////////////////////////////////////
-// STL
-#include <cassert>
-// Dsim
-#include <dsim/basic/BasChronometer.hpp>
-#include <dsim/service/Logger.hpp>
-
-namespace DSIM {
-
- // //////////////////////////////////////////////////////////////////////
- BasChronometer::BasChronometer () : _startTimeLaunched (false) {
- }
-
- // //////////////////////////////////////////////////////////////////////
- void BasChronometer::start () {
- // Get the time-stamp of now, and store it for later use
- _startTime = boost::posix_time::microsec_clock::local_time();
-
- // Update the boolean which states whether the chronometer
- // is launched
- _startTimeLaunched = true;
- }
-
- // //////////////////////////////////////////////////////////////////////
- double BasChronometer::elapsed () const {
- assert (_startTimeLaunched == true);
-
- // Get the time-stamp of now
- const boost::posix_time::ptime lStopTime =
- boost::posix_time::microsec_clock::local_time();
-
- // Calculate the time elapsed since the last time-stamp
- const boost::posix_time::time_duration lElapsedTime =
- lStopTime - _startTime;
-
- // Derived the corresponding number of milliseconds
- const double lElapsedTimeInMicroSeconds =
- static_cast<const double> (lElapsedTime.total_microseconds());
-
- /*DSIM_LOG_DEBUG ("Elapsed: " << lElapsedTime
- << "; (micros): "
- << lElapsedTimeInMicroSeconds / 1e6);*/
-
- // The elapsed time given in return is expressed in seconds
- return (lElapsedTimeInMicroSeconds / 1e6);
- }
-
-}
Deleted: trunk/dsim/dsim/basic/BasChronometer.hpp
===================================================================
--- trunk/dsim/dsim/basic/BasChronometer.hpp 2010-01-19 18:41:41 UTC (rev 49)
+++ trunk/dsim/dsim/basic/BasChronometer.hpp 2010-01-20 17:24:13 UTC (rev 50)
@@ -1,40 +0,0 @@
-#ifndef __DSIM_COM_BAS_BASCHRONOMETER_HPP
-#define __DSIM_COM_BAS_BASCHRONOMETER_HPP
-
-// //////////////////////////////////////////////////////////////////////
-// Import section
-// //////////////////////////////////////////////////////////////////////
-// Boost Date-Time (http://boost.org/doc/html/date_time/posix_time.html)
-#include <boost/date_time/posix_time/posix_time.hpp>
-
-namespace DSIM {
-
- /** Structure allowing measuring the time elapsed between two events. */
- struct BasChronometer {
- /** Constructor. */
- BasChronometer();
-
- /** Start the chronometer from the local time
- <br>The elapsed time given is the one elapsed since the start
- is launched. */
- void start ();
-
- /** Get the start time. */
- std::string getStart () const {
- return boost::posix_time::to_simple_string (_startTime);
- }
-
- /** Return the time elapsed since the structure has been instanciated.
- <br>That elapsed time is expressed in seconds. */
- double elapsed () const;
-
- private:
- /** Start time. */
- boost::posix_time::ptime _startTime;
-
- /** Boolean which states whether the chronometer is started or not.*/
- bool _startTimeLaunched;
- };
-
-}
-#endif // __DSIM_COM_BAS_BASCHRONOMETER_HPP
Modified: trunk/dsim/dsim/basic/sources.mk
===================================================================
--- trunk/dsim/dsim/basic/sources.mk 2010-01-19 18:41:41 UTC (rev 49)
+++ trunk/dsim/dsim/basic/sources.mk 2010-01-20 17:24:13 UTC (rev 50)
@@ -1,5 +1,3 @@
bas_h_sources = $(top_srcdir)/dsim/basic/BasConst_General.hpp \
- $(top_srcdir)/dsim/basic/BasConst_DSIM_Service.hpp \
- $(top_srcdir)/dsim/basic/BasChronometer.hpp
-bas_cc_sources = $(top_srcdir)/dsim/basic/BasConst.cpp \
- $(top_srcdir)/dsim/basic/BasChronometer.cpp
+ $(top_srcdir)/dsim/basic/BasConst_DSIM_Service.hpp
+bas_cc_sources = $(top_srcdir)/dsim/basic/BasConst.cpp
Modified: trunk/dsim/dsim/service/DSIM_Service.cpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_Service.cpp 2010-01-19 18:41:41 UTC (rev 49)
+++ trunk/dsim/dsim/service/DSIM_Service.cpp 2010-01-20 17:24:13 UTC (rev 50)
@@ -7,11 +7,12 @@
// Boost
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
+// StdAir
+#include <stdair/basic/BasChronometer.hpp>
// Distribution
#include <simcrs/SIMCRS_Service.hpp>
// Dsim
#include <dsim/basic/BasConst_DSIM_Service.hpp>
-#include <dsim/basic/BasChronometer.hpp>
#include <dsim/command/Simulator.hpp>
#include <dsim/factory/FacDsimServiceContext.hpp>
#include <dsim/service/DSIM_ServiceContext.hpp>
@@ -96,14 +97,14 @@
lDSIM_ServiceContext.getSIMCRS_Service();
// Delegate the booking to the dedicated command
- BasChronometer lSimulationChronometer;
+ stdair::BasChronometer lSimulationChronometer;
lSimulationChronometer.start();
Simulator::simulate (lSIMCRS_Service);
const double lSimulationMeasure = lSimulationChronometer.elapsed();
// DEBUG
DSIM_LOG_DEBUG ("Simulation: " << lSimulationMeasure << " - "
- << lDSIM_ServiceContext.display());
+ << lDSIM_ServiceContext.display());
} catch (const std::exception& error) {
DSIM_LOG_ERROR ("Exception: " << error.what());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-21 19:32:37
|
Revision: 53
http://dsim.svn.sourceforge.net/dsim/?rev=53&view=rev
Author: denis_arnaud
Date: 2010-01-21 19:32:31 +0000 (Thu, 21 Jan 2010)
Log Message:
-----------
[Dev] The log output stream initialisation has been moved into the StdAir library.
Modified Paths:
--------------
trunk/dsim/dsim/bom/ConfigurationParameters.cpp
trunk/dsim/dsim/bom/RDSParameters.cpp
trunk/dsim/dsim/command/Simulator.cpp
trunk/dsim/dsim/factory/FacSupervisor.cpp
trunk/dsim/dsim/factory/FacSupervisor.hpp
trunk/dsim/dsim/service/sources.mk
Removed Paths:
-------------
trunk/dsim/dsim/service/Logger.cpp
trunk/dsim/dsim/service/Logger.hpp
Modified: trunk/dsim/dsim/bom/ConfigurationParameters.cpp
===================================================================
--- trunk/dsim/dsim/bom/ConfigurationParameters.cpp 2010-01-21 13:25:10 UTC (rev 52)
+++ trunk/dsim/dsim/bom/ConfigurationParameters.cpp 2010-01-21 19:32:31 UTC (rev 53)
@@ -6,7 +6,6 @@
#include <cassert>
// DSIM
#include <dsim/bom/ConfigurationParameters.hpp>
-#include <dsim/service/Logger.hpp>
namespace DSIM {
@@ -25,14 +24,8 @@
// ////////////////////////////////////////////////////////////////////
const std::string ConfigurationParameters::describe() const {
- // Store current formatting flags of std::cout
- std::ios::fmtflags oldFlags = std::cout.flags();
-
std::ostringstream ostr;
- // Reset formatting flags of std::cout
- std::cout.flags (oldFlags);
-
return ostr.str();
}
Modified: trunk/dsim/dsim/bom/RDSParameters.cpp
===================================================================
--- trunk/dsim/dsim/bom/RDSParameters.cpp 2010-01-21 13:25:10 UTC (rev 52)
+++ trunk/dsim/dsim/bom/RDSParameters.cpp 2010-01-21 19:32:31 UTC (rev 53)
@@ -6,7 +6,6 @@
#include <cassert>
// DSIM
#include <dsim/bom/RDSParameters.hpp>
-#include <dsim/service/Logger.hpp>
namespace DSIM {
@@ -25,18 +24,12 @@
// ////////////////////////////////////////////////////////////////////
const std::string RDSParameters::describe() const {
- // Store current formatting flags of std::cout
- std::ios::fmtflags oldFlags = std::cout.flags();
-
std::ostringstream ostr;
ostr << "RDS Parameters: " << std::endl;
ostr << " Schedule file: " << _scheduleInputFilename;
ostr << std::endl;
-
- // Reset formatting flags of std::cout
- std::cout.flags (oldFlags);
return ostr.str();
}
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-01-21 13:25:10 UTC (rev 52)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-01-21 19:32:31 UTC (rev 53)
@@ -6,13 +6,14 @@
#include <string>
#include <vector>
#include <exception>
-// STDAIR
+// StdAir
#include <stdair/STDAIR_Types.hpp>
+#include <stdair/service/Logger.hpp>
// Distribution
#include <simcrs/SIMCRS_Service.hpp>
// Dsim
+#include <dsim/DSIM_Types.hpp>
#include <dsim/command/Simulator.hpp>
-#include <dsim/service/Logger.hpp>
namespace DSIM {
@@ -22,7 +23,7 @@
try {
// DEBUG
- DSIM_LOG_DEBUG ("The simulation is starting");
+ STDAIR_LOG_DEBUG ("The simulation is starting");
// Airline code
stdair::AirlineCode_T lAirlineCode ("BA");
@@ -34,10 +35,10 @@
ioSIMCRS_Service.sell (lAirlineCode, lPartySize);
// DEBUG
- DSIM_LOG_DEBUG ("The simulation has ended");
+ STDAIR_LOG_DEBUG ("The simulation has ended");
} catch (const std::exception& lStdError) {
- DSIM_LOG_ERROR ("Error: " << lStdError.what());
+ STDAIR_LOG_ERROR ("Error: " << lStdError.what());
throw SimulationException();
}
}
Modified: trunk/dsim/dsim/factory/FacSupervisor.cpp
===================================================================
--- trunk/dsim/dsim/factory/FacSupervisor.cpp 2010-01-21 13:25:10 UTC (rev 52)
+++ trunk/dsim/dsim/factory/FacSupervisor.cpp 2010-01-21 19:32:31 UTC (rev 53)
@@ -7,15 +7,13 @@
#include <dsim/factory/FacBomAbstract.hpp>
#include <dsim/factory/FacServiceAbstract.hpp>
#include <dsim/factory/FacSupervisor.hpp>
-#include <dsim/service/Logger.hpp>
namespace DSIM {
FacSupervisor* FacSupervisor::_instance = NULL;
// //////////////////////////////////////////////////////////////////////
- FacSupervisor::FacSupervisor () :
- _logger (NULL) {
+ FacSupervisor::FacSupervisor () {
}
// //////////////////////////////////////////////////////////////////////
@@ -40,15 +38,9 @@
}
// //////////////////////////////////////////////////////////////////////
- void FacSupervisor::registerLoggerService (Logger* ioLogger_ptr) {
- _logger = ioLogger_ptr;
- }
-
- // //////////////////////////////////////////////////////////////////////
FacSupervisor::~FacSupervisor() {
cleanBomLayer();
cleanServiceLayer();
- cleanLoggerService();
}
// //////////////////////////////////////////////////////////////////////
@@ -80,16 +72,10 @@
}
// //////////////////////////////////////////////////////////////////////
- void FacSupervisor::cleanLoggerService() {
- delete _logger; _logger = NULL;
- }
-
- // //////////////////////////////////////////////////////////////////////
void FacSupervisor::cleanFactory () {
if (_instance != NULL) {
_instance->cleanBomLayer();
_instance->cleanServiceLayer();
- _instance->cleanLoggerService();
}
delete (_instance); _instance = NULL;
}
Modified: trunk/dsim/dsim/factory/FacSupervisor.hpp
===================================================================
--- trunk/dsim/dsim/factory/FacSupervisor.hpp 2010-01-21 13:25:10 UTC (rev 52)
+++ trunk/dsim/dsim/factory/FacSupervisor.hpp 2010-01-21 19:32:31 UTC (rev 53)
@@ -12,7 +12,6 @@
// Forward declarations
class FacBomAbstract;
class FacServiceAbstract;
- class Logger;
/** Singleton class to register and clean all Factories. */
class FacSupervisor {
@@ -39,16 +38,6 @@
@param FacServiceAbstract& the concrete Factory to register. */
void registerServiceFactory (FacServiceAbstract*);
- /** Register a newly instantiated concrete factory for the
- Logger object. In fact, as the Logger object
- follows the singleton pattern, the concrete factory is the
- Logger object itself.
- <br>When a concrete Factory is firstly instantiated this
- factory have to register itself to the FacSupervisor.
- @param FacServiceAbstract& the concrete Factory to
- register. */
- void registerLoggerService (Logger*);
-
/** Clean all created object.
<br>Call the clean method of all the instantiated factories
for the Bom layer. */
@@ -59,9 +48,6 @@
for the Service layer. */
void cleanServiceLayer();
- /** Delete the Logger object. */
- void cleanLoggerService();
-
/** Clean the static instance.
<br> The singleton is deleted.*/
static void cleanFactory ();
@@ -84,9 +70,6 @@
/** The unique instance.*/
static FacSupervisor* _instance;
- /** Logger (singleton) instance. */
- Logger* _logger;
-
/** List of instantiated factories for the Bom layer. */
BomFactoryPool_T _bomPool;
Deleted: trunk/dsim/dsim/service/Logger.cpp
===================================================================
--- trunk/dsim/dsim/service/Logger.cpp 2010-01-21 13:25:10 UTC (rev 52)
+++ trunk/dsim/dsim/service/Logger.cpp 2010-01-21 19:32:31 UTC (rev 53)
@@ -1,64 +0,0 @@
-// //////////////////////////////////////////////////////////////////////
-// Import section
-// //////////////////////////////////////////////////////////////////////
-// STL
-#include <iostream>
-// Dsim Logger
-#include <dsim/factory/FacSupervisor.hpp>
-#include <dsim/service/Logger.hpp>
-
-namespace DSIM {
-
- Logger* Logger::_instance = NULL;
-
- // //////////////////////////////////////////////////////////////////////
- Logger::Logger () : _logStream (&std::cout) {
- assert (false);
- }
-
- // //////////////////////////////////////////////////////////////////////
- Logger::Logger (const Logger&) : _logStream (&std::cout) {
- assert (false);
- }
-
- // //////////////////////////////////////////////////////////////////////
- Logger::Logger (const LOG::EN_LogLevel iLevel, std::ostream& ioLogStream)
- : _level (iLevel), _logStream (&ioLogStream) {
- }
-
- // //////////////////////////////////////////////////////////////////////
- Logger::~Logger () {
- _logStream = NULL;
- }
-
- // //////////////////////////////////////////////////////////////////////
- LOG::EN_LogLevel Logger::getLogLevel() {
- return _level;
- }
-
- // //////////////////////////////////////////////////////////////////////
- std::ostream& Logger::getLogStream() {
- assert (_logStream != NULL);
- return *_logStream;
- }
-
- // //////////////////////////////////////////////////////////////////////
- void Logger::setLogParameters (const LOG::EN_LogLevel iLogLevel,
- std::ostream& ioLogStream) {
- _level = iLogLevel;
- _logStream = &ioLogStream;
- }
-
- // //////////////////////////////////////////////////////////////////////
- Logger& Logger::instance() {
- if (_instance == NULL) {
- _instance = new Logger (LOG::DEBUG, std::cout);
-
- assert (_instance != NULL);
-
- FacSupervisor::instance().registerLoggerService (_instance);
- }
- return *_instance;
- }
-
-}
Deleted: trunk/dsim/dsim/service/Logger.hpp
===================================================================
--- trunk/dsim/dsim/service/Logger.hpp 2010-01-21 13:25:10 UTC (rev 52)
+++ trunk/dsim/dsim/service/Logger.hpp 2010-01-21 19:32:31 UTC (rev 53)
@@ -1,94 +0,0 @@
-#ifndef __DSIM_SVC_LOGGER_HPP
-#define __DSIM_SVC_LOGGER_HPP
-
-// //////////////////////////////////////////////////////////////////////
-// Import section
-// //////////////////////////////////////////////////////////////////////
-// STL
-#include <cassert>
-#include <sstream>
-#include <string>
-// DSIM
-#include <dsim/DSIM_Types.hpp>
-
-// /////////////// LOG MACROS /////////////////
-#define DSIM_LOG_CORE(iLevel, iToBeLogged) \
- { std::ostringstream ostr; ostr << iToBeLogged; \
- DSIM::Logger::instance().log (iLevel, __LINE__, __FILE__, ostr.str()); }
-
-#define DSIM_LOG_CRITICAL(iToBeLogged) \
- DSIM_LOG_CORE (DSIM::LOG::CRITICAL, iToBeLogged)
-
-#define DSIM_LOG_ERROR(iToBeLogged) \
- DSIM_LOG_CORE (DSIM::LOG::ERROR, iToBeLogged)
-
-#define DSIM_LOG_NOTIFICATION(iToBeLogged) \
- DSIM_LOG_CORE (DSIM::LOG::NOTIFICATION, iToBeLogged)
-
-#define DSIM_LOG_WARNING(iToBeLogged) \
- DSIM_LOG_CORE (DSIM::LOG::WARNING, iToBeLogged)
-
-#define DSIM_LOG_DEBUG(iToBeLogged) \
- DSIM_LOG_CORE (DSIM::LOG::DEBUG, iToBeLogged)
-
-#define DSIM_LOG_VERBOSE(iToBeLogged) \
- DSIM_LOG_CORE (DSIM::LOG::VERBOSE, iToBeLogged)
-// /////////// (END OF) LOG MACROS /////////////
-
-
-namespace DSIM {
-
- /** Class holding the stream for logs.
- <br>Note that the error logs are seen as standard output logs,
- but with a higher level of visibility. */
- class Logger {
- // Friend classes
- friend class FacSupervisor;
- public:
-
- /** Main log entry. */
- template <typename T>
- void log (const LOG::EN_LogLevel iLevel, const int iLineNumber,
- const std::string& iFileName, const T& iToBeLogged) {
- if (iLevel <= _level) {
- assert (_logStream != NULL);
- *_logStream << iFileName << ":" << iLineNumber
- << ": " << iToBeLogged << std::endl;
- }
- }
-
- /** Get the log level. */
- LOG::EN_LogLevel getLogLevel();
-
- /** get the log stream. */
- std::ostream& getLogStream();
-
- /** Set the logger parameters (level and stream). */
- void setLogParameters (const LOG::EN_LogLevel iLogLevel,
- std::ostream& ioLogStream);
-
- /** Returns a current Logger instance.*/
- static Logger& instance();
-
- private:
- /** Default constructors are private so that only the required
- constructor can be used. */
- Logger ();
- Logger (const Logger&);
- Logger (const LOG::EN_LogLevel iLevel, std::ostream& ioLogStream);
- /** Destructor. */
- ~Logger ();
-
- private:
- /** Log level. */
- LOG::EN_LogLevel _level;
-
- /** Stream dedicated to the logs. */
- std::ostream* _logStream;
-
- /** Instance object.*/
- static Logger* _instance;
- };
-
-}
-#endif // __DSIM_SVC_LOGGER_HPP
Modified: trunk/dsim/dsim/service/sources.mk
===================================================================
--- trunk/dsim/dsim/service/sources.mk 2010-01-21 13:25:10 UTC (rev 52)
+++ trunk/dsim/dsim/service/sources.mk 2010-01-21 19:32:31 UTC (rev 53)
@@ -1,7 +1,5 @@
svc_h_sources = $(top_srcdir)/dsim/service/ServiceAbstract.hpp \
- $(top_srcdir)/dsim/service/DSIM_ServiceContext.hpp \
- $(top_srcdir)/dsim/service/Logger.hpp
+ $(top_srcdir)/dsim/service/DSIM_ServiceContext.hpp
svc_cc_sources = $(top_srcdir)/dsim/service/ServiceAbstract.cpp \
$(top_srcdir)/dsim/service/DSIM_ServiceContext.cpp \
- $(top_srcdir)/dsim/service/Logger.cpp \
$(top_srcdir)/dsim/service/DSIM_Service.cpp
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-01-29 16:02:52
|
Revision: 58
http://dsim.svn.sourceforge.net/dsim/?rev=58&view=rev
Author: quannaus
Date: 2010-01-29 16:02:46 +0000 (Fri, 29 Jan 2010)
Log Message:
-----------
[Dev] Fixed a bug.
Modified Paths:
--------------
trunk/dsim/dsim/DSIM_Service.hpp
trunk/dsim/dsim/service/DSIM_Service.cpp
Modified: trunk/dsim/dsim/DSIM_Service.hpp
===================================================================
--- trunk/dsim/dsim/DSIM_Service.hpp 2010-01-29 15:59:32 UTC (rev 57)
+++ trunk/dsim/dsim/DSIM_Service.hpp 2010-01-29 16:02:46 UTC (rev 58)
@@ -62,8 +62,19 @@
/** Initialise.
@param const stdair::Filename_T& Filename of the input schedule file. */
- void init (const stdair::Filename_T&);
+ void init (stdair::STDAIR_ServicePtr_T, const stdair::Filename_T&);
+ /** Initialise the (DSIM) service context (i.e., the
+ DSIM_ServiceContext object). */
+ void initServiceContext ();
+
+ /** Initialise the STDAIR service (including the log service).
+ <br>A reference on the root of the BOM tree, namely the BomRoot object,
+ is stored within the service context for later use.
+ @param const stdair::BasLogParams& Parameters for the output log stream.
+ */
+ stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
+
/** Finalise. */
void finalise ();
Modified: trunk/dsim/dsim/service/DSIM_Service.cpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_Service.cpp 2010-01-29 15:59:32 UTC (rev 57)
+++ trunk/dsim/dsim/service/DSIM_Service.cpp 2010-01-29 16:02:46 UTC (rev 58)
@@ -7,7 +7,12 @@
// StdAir
#include <stdair/basic/BasChronometer.hpp>
#include <stdair/bom/BomManager.hpp> // for display()
+#include <stdair/bom/AirlineFeature.hpp>
+#include <stdair/bom/AirlineFeatureSet.hpp>
+#include <stdair/bom/BomRoot.hpp>
+#include <stdair/factory/FacBomContent.hpp>
#include <stdair/service/Logger.hpp>
+#include <stdair/STDAIR_Service.hpp>
// Distribution
#include <simcrs/SIMCRS_Service.hpp>
// Dsim
@@ -32,21 +37,29 @@
// //////////////////////////////////////////////////////////////////////
DSIM_Service::DSIM_Service (const stdair::Filename_T& iScheduleInputFilename)
: _dsimServiceContext (NULL) {
+
+ // Initialise the service context
+ initServiceContext ();
+ // Initialise the context
+ //init (iScheduleInputFilename);
- // Initialise the context
- init (iScheduleInputFilename);
+ assert (false);
}
// //////////////////////////////////////////////////////////////////////
DSIM_Service::DSIM_Service (const stdair::BasLogParams& iLogParams,
const stdair::Filename_T& iScheduleInputFilename)
: _dsimServiceContext (NULL) {
-
- // Set the log file
- logInit (iLogParams);
-
+
+ // Initialise the service context
+ initServiceContext ();
+
+ // Initialise the STDAIR service handler
+ stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
+ initStdAirService (iLogParams);
+
// Initialise the (remaining of the) context
- init (iScheduleInputFilename);
+ init (lSTDAIR_Service_ptr, iScheduleInputFilename);
}
// //////////////////////////////////////////////////////////////////////
@@ -55,18 +68,61 @@
finalise();
}
- // //////////////////////////////////////////////////////////////////////
- void DSIM_Service::logInit (const stdair::BasLogParams& iLogParams) {
- stdair::Logger::init (iLogParams);
- }
-
- // //////////////////////////////////////////////////////////////////////
- void DSIM_Service::init (const stdair::Filename_T& iScheduleInputFilename) {
+ // ////////////////////////////////////////////////////////////////////
+ void DSIM_Service::initServiceContext () {
// Initialise the context
DSIM_ServiceContext& lDSIM_ServiceContext =
FacDsimServiceContext::instance().create ();
_dsimServiceContext = &lDSIM_ServiceContext;
+ }
+ // //////////////////////////////////////////////////////////////////////
+ stdair::STDAIR_ServicePtr_T DSIM_Service::
+ initStdAirService (const stdair::BasLogParams& iLogParams) {
+
+ // Retrieve the Dsim service context
+ assert (_dsimServiceContext != NULL);
+ DSIM_ServiceContext& lDSIM_ServiceContext = *_dsimServiceContext;
+
+ // Initialise the STDAIR service handler
+ // Note that the track on the object memory is kept thanks to the Boost
+ // Smart Pointers component.
+ stdair::STDAIR_ServicePtr_T oSTDAIR_Service_ptr =
+ stdair::STDAIR_ServicePtr_T (new stdair::STDAIR_Service (iLogParams));
+
+ // Retrieve the root of the BOM tree, on which all of the other BOM objects
+ // will be attached
+ assert (oSTDAIR_Service_ptr != NULL);
+ stdair::BomRoot& lBomRoot = oSTDAIR_Service_ptr->getBomRoot();
+
+ // TODO: do not hardcode the initialisation of AirlineFeatureSet
+ // Initialise the set of required airline features
+ stdair::AirlineFeatureSet& lAirlineFeatureSet =
+ stdair::FacBomContent::instance().create<stdair::AirlineFeatureSet>();
+
+ // Airline code
+ stdair::AirlineCode_T lAirlineCode ("BA");
+ // Initialise an AirlineFeature object
+ stdair::AirlineFeatureKey_T lAirlineFeatureKey (lAirlineCode);
+ stdair::AirlineFeature& lAirlineFeature = stdair::FacBomContent::
+ instance().create<stdair::AirlineFeature> (lAirlineFeatureKey);
+ stdair::FacBomContent::
+ linkWithParent<stdair::AirlineFeature> (lAirlineFeature,
+ lAirlineFeatureSet);
+
+ // Set the AirlineFeatureSet for the BomRoot.
+ lBomRoot.setAirlineFeatureSet (&lAirlineFeatureSet);
+
+ return oSTDAIR_Service_ptr;
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ void DSIM_Service::init (stdair::STDAIR_ServicePtr_T ioSTDAIR_ServicePtr,
+ const stdair::Filename_T& iScheduleInputFilename) {
+ // Retrieve the service context
+ assert (_dsimServiceContext != NULL);
+ DSIM_ServiceContext& lDSIM_ServiceContext = *_dsimServiceContext;
+
// TODO: do not hardcode the CRS code (e.g., take it from a
// configuration file).
// Initialise the SIMCRS service handler
@@ -76,7 +132,8 @@
// on the Service object, and deletes that object when it is no longer
// referenced (e.g., at the end of the process).
SIMCRS_ServicePtr_T lSIMCRS_Service =
- SIMCRS_ServicePtr_T (new SIMCRS::SIMCRS_Service (lCRSCode,
+ SIMCRS_ServicePtr_T (new SIMCRS::SIMCRS_Service (ioSTDAIR_ServicePtr,
+ lCRSCode,
iScheduleInputFilename));
lDSIM_ServiceContext.setSIMCRS_Service (lSIMCRS_Service);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-02-03 16:29:34
|
Revision: 60
http://dsim.svn.sourceforge.net/dsim/?rev=60&view=rev
Author: quannaus
Date: 2010-02-03 16:28:56 +0000 (Wed, 03 Feb 2010)
Log Message:
-----------
[dev] Integrated TRADEMGEN service into DSIM.
Modified Paths:
--------------
trunk/dsim/dsim/command/Makefile.am
trunk/dsim/dsim/command/Simulator.cpp
trunk/dsim/dsim/command/Simulator.hpp
trunk/dsim/dsim/core/Makefile.am
trunk/dsim/dsim/service/DSIM_Service.cpp
trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
Modified: trunk/dsim/dsim/command/Makefile.am
===================================================================
--- trunk/dsim/dsim/command/Makefile.am 2010-02-03 14:57:56 UTC (rev 59)
+++ trunk/dsim/dsim/command/Makefile.am 2010-02-03 16:28:56 UTC (rev 60)
@@ -8,7 +8,8 @@
libcmd_la_CXXFLAGS = $(BOOST_CFLAGS)
libcmd_la_LIBADD =
libcmd_la_LDFLAGS = $(BOOST_LIBS) \
- $(top_builddir)/simcrs/core/libsimcrs.la
+ $(top_builddir)/simcrs/core/libsimcrs.la \
+ $(top_builddir)/trademgen/core/libtrademgen.la
#pkgincludedir = $(includedir)/@PACKAGE@/command
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-02-03 14:57:56 UTC (rev 59)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-02-03 16:28:56 UTC (rev 60)
@@ -14,6 +14,8 @@
#include <stdair/service/Logger.hpp>
// Distribution
#include <simcrs/SIMCRS_Service.hpp>
+// TRADEMGEN
+#include <trademgen/TRADEMGEN_Service.hpp>
// Airsched
#include <airsched/AIRSCHED_Service.hpp>
// Dsim
@@ -23,30 +25,18 @@
namespace DSIM {
// ////////////////////////////////////////////////////////////////////
- void Simulator::simulate (SIMCRS::SIMCRS_Service& ioSIMCRS_Service) {
+ void Simulator::simulate (SIMCRS::SIMCRS_Service& ioSIMCRS_Service,
+ TRADEMGEN::TRADEMGEN_Service& ioTRADEMGEN_Service) {
try {
// DEBUG
STDAIR_LOG_DEBUG ("The simulation is starting");
- // TODO: remove this hardcoded section
- // Hardcode a booking request in order to simulate a sale.
- // Departure airport code
- stdair::AirportCode_T lOrigin ("LHR");
- // Arrival airport code
- stdair::AirportCode_T lDestination ("JFK");
- // Departure date
- stdair::Date_T lDepartureDate (2010, 01, 19);
- // Passenger type
- stdair::PassengerType_T lPaxType ("L");
- // Number of passengers in the travelling group
- stdair::NbOfSeats_T lPartySize = 5;
- // Booking request
- stdair::BookingRequestStruct lBookingRequest (lOrigin, lDestination,
- lDepartureDate,
- lPaxType, lPartySize);
-
+ // Generate a booking request.
+ stdair::BookingRequestStruct lBookingRequest =
+ ioTRADEMGEN_Service.generateBookingRequest ();
+
// Play booking request
playBookingRequest (ioSIMCRS_Service, lBookingRequest);
Modified: trunk/dsim/dsim/command/Simulator.hpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.hpp 2010-02-03 14:57:56 UTC (rev 59)
+++ trunk/dsim/dsim/command/Simulator.hpp 2010-02-03 16:28:56 UTC (rev 60)
@@ -16,6 +16,10 @@
class SIMCRS_Service;
}
+namespace TRADEMGEN {
+ class TRADEMGEN_Service;
+}
+
namespace DSIM {
/** Class wrapping the simulation methods. */
@@ -24,7 +28,7 @@
private:
/** Perform a simulation. */
- static void simulate (SIMCRS::SIMCRS_Service&);
+ static void simulate (SIMCRS::SIMCRS_Service&,TRADEMGEN::TRADEMGEN_Service&);
/** Play a booking request event. */
static void playBookingRequest (SIMCRS::SIMCRS_Service&,
Modified: trunk/dsim/dsim/core/Makefile.am
===================================================================
--- trunk/dsim/dsim/core/Makefile.am 2010-02-03 14:57:56 UTC (rev 59)
+++ trunk/dsim/dsim/core/Makefile.am 2010-02-03 16:28:56 UTC (rev 60)
@@ -24,4 +24,5 @@
$(top_builddir)/stdair/core/libstdair.la \
$(top_builddir)/airsched/core/libairsched.la \
$(top_builddir)/simcrs/core/libsimcrs.la \
+ $(top_builddir)/trademgen/core/libtrademgen.la \
-version-info $(GENERIC_LIBRARY_VERSION)
Modified: trunk/dsim/dsim/service/DSIM_Service.cpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_Service.cpp 2010-02-03 14:57:56 UTC (rev 59)
+++ trunk/dsim/dsim/service/DSIM_Service.cpp 2010-02-03 16:28:56 UTC (rev 60)
@@ -15,6 +15,9 @@
#include <stdair/STDAIR_Service.hpp>
// Distribution
#include <simcrs/SIMCRS_Service.hpp>
+// TRADEMGEN
+#include <trademgen/TRADEMGEN_Service.hpp>
+#include <trademgen/DBParams.hpp>
// Dsim
#include <dsim/basic/BasConst_DSIM_Service.hpp>
#include <dsim/command/Simulator.hpp>
@@ -136,6 +139,16 @@
lCRSCode,
iScheduleInputFilename));
lDSIM_ServiceContext.setSIMCRS_Service (lSIMCRS_Service);
+
+ // TODO: do not hardcode the DBParams.
+ // Initialise the TRADEMGEN service handler
+ const TRADEMGEN::DBParams lDBParams =
+ TRADEMGEN::DBParams ("anguyen", "anguyen", "ncemysqlp.nce.amadeus.net",
+ "3321", "sim_anguyen");
+ TRADEMGEN_ServicePtr_T lTRADEMGEN_Service =
+ TRADEMGEN_ServicePtr_T (new TRADEMGEN::TRADEMGEN_Service (lDBParams));
+ lDSIM_ServiceContext.setTRADEMGEN_Service (lTRADEMGEN_Service);
+
}
// //////////////////////////////////////////////////////////////////////
@@ -157,11 +170,14 @@
// Get a reference on the SIMCRS service handler
SIMCRS::SIMCRS_Service& lSIMCRS_Service =
lDSIM_ServiceContext.getSIMCRS_Service();
+ // Get a reference on the TRADEMGEN service handler
+ TRADEMGEN::TRADEMGEN_Service& lTRADEMGEN_Service =
+ lDSIM_ServiceContext.getTRADEMGEN_Service();
// Delegate the booking to the dedicated command
stdair::BasChronometer lSimulationChronometer;
lSimulationChronometer.start();
- Simulator::simulate (lSIMCRS_Service);
+ Simulator::simulate (lSIMCRS_Service, lTRADEMGEN_Service);
const double lSimulationMeasure = lSimulationChronometer.elapsed();
// DEBUG
Modified: trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2010-02-03 14:57:56 UTC (rev 59)
+++ trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2010-02-03 16:28:56 UTC (rev 60)
@@ -18,11 +18,17 @@
namespace SIMCRS {
class SIMCRS_Service;
}
+namespace TRADEMGEN {
+ class TRADEMGEN_Service;
+}
/** Pointer on the SIMCRS Service handler. */
typedef boost::shared_ptr<SIMCRS::SIMCRS_Service> SIMCRS_ServicePtr_T;
+/** Pointer on the TRADEMGEN Service handler. */
+typedef boost::shared_ptr<TRADEMGEN::TRADEMGEN_Service> TRADEMGEN_ServicePtr_T;
+
namespace DSIM {
/** Class holding the context of the Dsim services. */
@@ -50,6 +56,11 @@
return *_simcrsService.get();
}
+ /** Get a reference on the TRADEMGEN service handler. */
+ TRADEMGEN::TRADEMGEN_Service& getTRADEMGEN_Service () const {
+ return *_trademgenService.get();
+ }
+
// ///////// Setters //////////
/** Set the simulator ID. */
void setSimulatorID (const SimulatorID_T& iSimulatorID) {
@@ -71,6 +82,11 @@
_simcrsService = ioSIMCRS_ServicePtr;
}
+ /** Set the pointer on the TRADEMGEN service handler. */
+ void setTRADEMGEN_Service (TRADEMGEN_ServicePtr_T ioTRADEMGEN_ServicePtr) {
+ _trademgenService = ioTRADEMGEN_ServicePtr;
+ }
+
// ///////// Display Methods //////////
/** Display the short DSIM_ServiceContext content. */
const std::string shortDisplay() const;
@@ -92,6 +108,8 @@
// ///////////// Children ////////////
/** CRS Service Handler. */
SIMCRS_ServicePtr_T _simcrsService;
+ /** TRADEMGEN Service Handler. */
+ TRADEMGEN_ServicePtr_T _trademgenService;
private:
// //////////// Attributes //////////////////
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-07-23 14:59:34
|
Revision: 105
http://dsim.svn.sourceforge.net/dsim/?rev=105&view=rev
Author: denis_arnaud
Date: 2010-07-23 14:59:27 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
[Dev] Replaced the new XXX_Service() by boost::make_shared<XXX_Service>().
Modified Paths:
--------------
trunk/dsim/dsim/command/DBManager.cpp
trunk/dsim/dsim/service/DSIM_Service.cpp
Modified: trunk/dsim/dsim/command/DBManager.cpp
===================================================================
--- trunk/dsim/dsim/command/DBManager.cpp 2010-07-20 23:45:35 UTC (rev 104)
+++ trunk/dsim/dsim/command/DBManager.cpp 2010-07-23 14:59:27 UTC (rev 105)
@@ -142,14 +142,14 @@
DBManager::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
Modified: trunk/dsim/dsim/service/DSIM_Service.cpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_Service.cpp 2010-07-20 23:45:35 UTC (rev 104)
+++ trunk/dsim/dsim/service/DSIM_Service.cpp 2010-07-23 14:59:27 UTC (rev 105)
@@ -4,6 +4,8 @@
// STL
#include <cassert>
#include <ostream>
+// Boost
+#include <boost/make_shared.hpp>
// SOCI
#include <soci/core/soci.h>
// StdAir
@@ -104,8 +106,7 @@
// Note that the track on the object memory is kept thanks to the Boost
// Smart Pointers component.
stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
- stdair::STDAIR_ServicePtr_T (new stdair::STDAIR_Service (iLogParams,
- iDBParams));
+ boost::make_shared<stdair::STDAIR_Service> (iLogParams, iDBParams);
// Retrieve the root of the BOM tree, on which all of the other BOM objects
// will be attached
@@ -136,17 +137,16 @@
// on the Service object, and deletes that object when it is no longer
// referenced (e.g., at the end of the process).
SIMCRS_ServicePtr_T lSIMCRS_Service =
- SIMCRS_ServicePtr_T (new SIMCRS::SIMCRS_Service (lSTDAIR_Service_ptr,
- lCRSCode,
- iScheduleInputFilename));
+ boost::make_shared<SIMCRS::SIMCRS_Service> (lSTDAIR_Service_ptr,
+ lCRSCode,
+ iScheduleInputFilename);
lDSIM_ServiceContext.setSIMCRS_Service (lSIMCRS_Service);
// TODO: do not hardcode the demand input file.
// Initialise the TRADEMGEN service handler
TRADEMGEN_ServicePtr_T lTRADEMGEN_Service =
- TRADEMGEN_ServicePtr_T (new TRADEMGEN::
- TRADEMGEN_Service (lSTDAIR_Service_ptr,
- iDemandInputFilename));
+ boost::make_shared<TRADEMGEN::TRADEMGEN_Service> (lSTDAIR_Service_ptr,
+ iDemandInputFilename);
lDSIM_ServiceContext.setTRADEMGEN_Service (lTRADEMGEN_Service);
}
@@ -195,7 +195,7 @@
throw NonInitialisedServiceException();
}
assert (_dsimServiceContext != NULL);
- DSIM_ServiceContext& lDSIM_ServiceContext = *_dsimServiceContext;
+ //DSIM_ServiceContext& lDSIM_ServiceContext = *_dsimServiceContext;
// Get the date-time for the present time
boost::posix_time::ptime lNowDateTime =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-08-20 14:56:23
|
Revision: 120
http://dsim.svn.sourceforge.net/dsim/?rev=120&view=rev
Author: quannaus
Date: 2010-08-20 14:56:17 +0000 (Fri, 20 Aug 2010)
Log Message:
-----------
[dev] Adapted to the new stdair.
Modified Paths:
--------------
trunk/dsim/dsim/batches/simulate.cpp
trunk/dsim/dsim/command/Simulator.cpp
trunk/dsim/dsim/service/DSIM_Service.cpp
Modified: trunk/dsim/dsim/batches/simulate.cpp
===================================================================
--- trunk/dsim/dsim/batches/simulate.cpp 2010-08-20 10:41:24 UTC (rev 119)
+++ trunk/dsim/dsim/batches/simulate.cpp 2010-08-20 14:56:17 UTC (rev 120)
@@ -14,7 +14,6 @@
#include <stdair/STDAIR_Types.hpp>
#include <stdair/basic/BasLogParams.hpp>
#include <stdair/basic/BasDBParams.hpp>
-#include <stdair/factory/FacBomContent.hpp>
// DSIM
#include <dsim/DSIM_Service.hpp>
#include <dsim/config/dsim-paths.hpp>
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-08-20 10:41:24 UTC (rev 119)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-08-20 14:56:17 UTC (rev 120)
@@ -8,10 +8,6 @@
#include <exception>
// StdAir
#include <stdair/STDAIR_Types.hpp>
-#include <stdair/basic/DemandCharacteristics.hpp>
-#include <stdair/basic/DemandDistribution.hpp>
-#include <stdair/basic/CategoricalAttribute.hpp>
-#include <stdair/basic/ContinuousAttribute.hpp>
#include <stdair/bom/EventStruct.hpp>
#include <stdair/bom/EventQueue.hpp>
#include <stdair/bom/BookingRequestStruct.hpp>
Modified: trunk/dsim/dsim/service/DSIM_Service.cpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_Service.cpp 2010-08-20 10:41:24 UTC (rev 119)
+++ trunk/dsim/dsim/service/DSIM_Service.cpp 2010-08-20 14:56:17 UTC (rev 120)
@@ -10,11 +10,10 @@
#include <soci/core/soci.h>
// StdAir
#include <stdair/basic/BasChronometer.hpp>
-#include <stdair/bom/BomManager.hpp> // for display()
+#include <stdair/bom/BomManager.hpp>
#include <stdair/bom/BomRoot.hpp>
#include <stdair/bom/AirlineStruct.hpp>
#include <stdair/bom/AirlineFeature.hpp>
-#include <stdair/factory/FacBomContent.hpp>
#include <stdair/service/Logger.hpp>
#include <stdair/service/DBSessionManager.hpp>
#include <stdair/STDAIR_Service.hpp>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-09-10 14:00:31
|
Revision: 127
http://dsim.svn.sourceforge.net/dsim/?rev=127&view=rev
Author: quannaus
Date: 2010-09-10 14:00:25 +0000 (Fri, 10 Sep 2010)
Log Message:
-----------
[dev] Debugging airsched/dsim.
Modified Paths:
--------------
trunk/dsim/dsim/batches/simulate.cpp
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/batches/simulate.cpp
===================================================================
--- trunk/dsim/dsim/batches/simulate.cpp 2010-09-07 15:18:51 UTC (rev 126)
+++ trunk/dsim/dsim/batches/simulate.cpp 2010-09-10 14:00:25 UTC (rev 127)
@@ -306,17 +306,7 @@
// Display the airlines stored in the database
dsimService.displayAirlineListFromDB();
- } catch (const DSIM::RootException& otexp) {
- std::cerr << "Standard exception: " << otexp.what() << std::endl;
- return -1;
-
- } catch (const std::exception& stde) {
- std::cerr << "Standard exception: " << stde.what() << std::endl;
- return -1;
-
- } catch (...) {
- return -1;
- }
+ } CATCH_ALL_EXCEPTIONS
return 0;
}
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-09-07 15:18:51 UTC (rev 126)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-09-10 14:00:25 UTC (rev 127)
@@ -100,12 +100,15 @@
// Get the fare quote for each travel solution.
// Get the availability for each travel solution.
//ioSIMCRS_Service.getAvailability (lTravelSolutionList);
+
// Hardcode a travel solution choice.
- // Make a sale.
- // ioSIMCRS_Service.sell (lChosenTravelSolution, lNbOfSeats);
stdair::TravelSolutionList_T::iterator itTS = lTravelSolutionList.begin();
const stdair::TravelSolutionStruct& lChosenTS = *itTS;
STDAIR_LOG_DEBUG ("Chosen TS: " << lChosenTS);
+
+ // Make a sale.
+ const stdair::NbOfSeats_T& lPartySize = iBookingRequest.getPartySize();
+ ioSIMCRS_Service.sell (lChosenTS, lPartySize);
} else {
// DEBUG
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-10-13 13:31:37
|
Revision: 140
http://dsim.svn.sourceforge.net/dsim/?rev=140&view=rev
Author: quannaus
Date: 2010-10-13 13:31:31 +0000 (Wed, 13 Oct 2010)
Log Message:
-----------
[dev] Added input files in AIRINV and SIMFQT.
Modified Paths:
--------------
trunk/dsim/dsim/DSIM_Service.hpp
trunk/dsim/dsim/service/DSIM_Service.cpp
Modified: trunk/dsim/dsim/DSIM_Service.hpp
===================================================================
--- trunk/dsim/dsim/DSIM_Service.hpp 2010-10-04 09:30:53 UTC (rev 139)
+++ trunk/dsim/dsim/DSIM_Service.hpp 2010-10-13 13:31:31 UTC (rev 140)
@@ -37,9 +37,13 @@
@param const stdair::BasLogParams& Parameters for the output log stream.
@param const stdair::BasDBParams& Parameters for the database access.
@param const stdair::Filename_T& Filename of the input schedule file.
+ @param const stdair::Filename_T& Filename of the input O&D file.
+ @param const stdair::Filename_T& Filename of the input fare file.
@param const stdair::Filename_T& Filename of the input demand file. */
DSIM_Service (const stdair::BasLogParams&, const stdair::BasDBParams&,
const stdair::Filename_T& iScheduleInputFilename,
+ const stdair::Filename_T& iODInputFilename,
+ const stdair::Filename_T& iFareInputFilename,
const stdair::Filename_T& iDemandInputFilenames);
/** Constructor.
@@ -52,9 +56,13 @@
calling chain (for instance, when the DSIM_Service is
itself being initialised by another library service).
@param const stdair::Filename_T& Filename of the input schedule file.
+ @param const stdair::Filename_T& Filename of the input O&D file.
+ @param const stdair::Filename_T& Filename of the input Fare file.
@param const stdair::Filename_T& Filename of the input demand file. */
DSIM_Service (stdair::STDAIR_ServicePtr_T,
const stdair::Filename_T& iScheduleInputFilename,
+ const stdair::Filename_T& iODInputFilename,
+ const stdair::Filename_T& iFareInputFilename,
const stdair::Filename_T& iDemandInputFilenames);
/** Destructor. */
@@ -95,8 +103,12 @@
simulator, is parsed and the inventories are generated accordingly.
@param const stdair::AirlineFeatureSet& Set of airline features.
@param const stdair::Filename_T& Filename of the input schedule file.
+ @param const stdair::Filename_T& Filename of the input O&D file.
+ @param const stdair::Filename_T& Filename of the input Fare file.
@param const stdair::Filename_T& Filename of the input demand file. */
void init (const stdair::Filename_T& iScheduleInputFilename,
+ const stdair::Filename_T& iODInputFilename,
+ const stdair::Filename_T& iFareInputFilename,
const stdair::Filename_T& iDemandInputFilename);
/** Finalise. */
Modified: trunk/dsim/dsim/service/DSIM_Service.cpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_Service.cpp 2010-10-04 09:30:53 UTC (rev 139)
+++ trunk/dsim/dsim/service/DSIM_Service.cpp 2010-10-13 13:31:31 UTC (rev 140)
@@ -45,6 +45,8 @@
// //////////////////////////////////////////////////////////////////////
DSIM_Service::DSIM_Service (stdair::STDAIR_ServicePtr_T ioSTDAIR_ServicePtr,
const stdair::Filename_T& iScheduleInputFilename,
+ const stdair::Filename_T& iODInputFilename,
+ const stdair::Filename_T& iFareInputFilename,
const stdair::Filename_T& iDemandInputFilename)
: _dsimServiceContext (NULL) {
@@ -59,13 +61,16 @@
lDSIM_ServiceContext.setSTDAIR_Service (ioSTDAIR_ServicePtr);
// Initialise the context
- init (iScheduleInputFilename, iDemandInputFilename);
+ init (iScheduleInputFilename, iODInputFilename,
+ iFareInputFilename, iDemandInputFilename);
}
// //////////////////////////////////////////////////////////////////////
DSIM_Service::DSIM_Service (const stdair::BasLogParams& iLogParams,
const stdair::BasDBParams& iDBParams,
const stdair::Filename_T& iScheduleInputFilename,
+ const stdair::Filename_T& iODInputFilename,
+ const stdair::Filename_T& iFareInputFilename,
const stdair::Filename_T& iDemandInputFilename)
: _dsimServiceContext (NULL) {
@@ -76,7 +81,8 @@
initStdAirService (iLogParams, iDBParams);
// Initialise the (remaining of the) context
- init (iScheduleInputFilename, iDemandInputFilename);
+ init (iScheduleInputFilename, iODInputFilename,
+ iFareInputFilename, iDemandInputFilename);
}
// //////////////////////////////////////////////////////////////////////
@@ -117,6 +123,8 @@
// //////////////////////////////////////////////////////////////////////
void DSIM_Service::init (const stdair::Filename_T& iScheduleInputFilename,
+ const stdair::Filename_T& iODInputFilename,
+ const stdair::Filename_T& iFareInputFilename,
const stdair::Filename_T& iDemandInputFilename) {
// Retrieve the service context
assert (_dsimServiceContext != NULL);
@@ -136,12 +144,12 @@
// on the Service object, and deletes that object when it is no longer
// referenced (e.g., at the end of the process).
SIMCRS_ServicePtr_T lSIMCRS_Service =
- boost::make_shared<SIMCRS::SIMCRS_Service> (lSTDAIR_Service_ptr,
- lCRSCode,
- iScheduleInputFilename);
+ boost::make_shared<SIMCRS::SIMCRS_Service> (lSTDAIR_Service_ptr, lCRSCode,
+ iScheduleInputFilename,
+ iODInputFilename,
+ iFareInputFilename);
lDSIM_ServiceContext.setSIMCRS_Service (lSIMCRS_Service);
- // TODO: do not hardcode the demand input file.
// Initialise the TRADEMGEN service handler
TRADEMGEN_ServicePtr_T lTRADEMGEN_Service =
boost::make_shared<TRADEMGEN::TRADEMGEN_Service> (lSTDAIR_Service_ptr,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-12-03 21:19:19
|
Revision: 166
http://dsim.svn.sourceforge.net/dsim/?rev=166&view=rev
Author: denis_arnaud
Date: 2010-12-03 21:19:13 +0000 (Fri, 03 Dec 2010)
Log Message:
-----------
[StdAir API] Adapted the code to the new StdAir API.
Modified Paths:
--------------
trunk/dsim/dsim/DSIM_Service.hpp
trunk/dsim/dsim/command/DBManager.hpp
trunk/dsim/dsim/command/Simulator.cpp
trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
Modified: trunk/dsim/dsim/DSIM_Service.hpp
===================================================================
--- trunk/dsim/dsim/DSIM_Service.hpp 2010-12-01 07:44:33 UTC (rev 165)
+++ trunk/dsim/dsim/DSIM_Service.hpp 2010-12-03 21:19:13 UTC (rev 166)
@@ -5,14 +5,14 @@
// Import section
// //////////////////////////////////////////////////////////////////////
// StdAir
-#include <stdair/STDAIR_Types.hpp>
+#include <stdair/stdair_basic_types.hpp>
+#include <stdair/stdair_service_types.hpp>
// Dsim
#include <dsim/DSIM_Types.hpp>
-// Forward declarations.
+// Forward declarations
namespace stdair {
class AirlineFeatureSet;
- class STDAIR_Service;
struct BasLogParams;
struct BasDBParams;
}
Modified: trunk/dsim/dsim/command/DBManager.hpp
===================================================================
--- trunk/dsim/dsim/command/DBManager.hpp 2010-12-01 07:44:33 UTC (rev 165)
+++ trunk/dsim/dsim/command/DBManager.hpp 2010-12-03 21:19:13 UTC (rev 166)
@@ -5,7 +5,8 @@
// Import section
// //////////////////////////////////////////////////////////////////////
// StdAir
-#include <stdair/STDAIR_Types.hpp>
+#include <stdair/stdair_basic_types.hpp>
+#include <stdair/stdair_db.hpp>
// Dsim
#include <dsim/DSIM_Types.hpp>
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-12-01 07:44:33 UTC (rev 165)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-12-03 21:19:13 UTC (rev 166)
@@ -7,7 +7,7 @@
#include <vector>
#include <exception>
// StdAir
-#include <stdair/STDAIR_Types.hpp>
+#include <stdair/stdair_demand_types.hpp>
#include <stdair/bom/EventStruct.hpp>
#include <stdair/bom/EventQueue.hpp>
#include <stdair/bom/BookingRequestStruct.hpp>
Modified: trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2010-12-01 07:44:33 UTC (rev 165)
+++ trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2010-12-03 21:19:13 UTC (rev 166)
@@ -9,7 +9,7 @@
// Boost
#include <boost/shared_ptr.hpp>
// StdAir
-#include <stdair/STDAIR_Types.hpp>
+#include <stdair/stdair_service_types.hpp>
// Dsim
#include <dsim/DSIM_Types.hpp>
#include <dsim/bom/ConfigurationParameters.hpp>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|