|
From: <den...@us...> - 2010-01-01 18:55:24
|
Revision: 43
http://dsim.svn.sourceforge.net/dsim/?rev=43&view=rev
Author: denis_arnaud
Date: 2010-01-01 18:55:18 +0000 (Fri, 01 Jan 2010)
Log Message:
-----------
[Struct] The parsing of the input schedule file is now done during the initialisation.
Modified Paths:
--------------
trunk/dsim/dsim/DSIM_Service.hpp
trunk/dsim/dsim/service/DSIM_Service.cpp
trunk/dsim/test/dsim/simulate.cpp
Modified: trunk/dsim/dsim/DSIM_Service.hpp
===================================================================
--- trunk/dsim/dsim/DSIM_Service.hpp 2009-12-31 13:33:35 UTC (rev 42)
+++ trunk/dsim/dsim/DSIM_Service.hpp 2010-01-01 18:55:18 UTC (rev 43)
@@ -5,8 +5,10 @@
// Import section
// //////////////////////////////////////////////////////////////////////
// STL
-#include <ostream>
+#include <iosfwd>
#include <string>
+// StdAir
+#include <stdair/STDAIR_Types.hpp>
// Dsim
#include <dsim/DSIM_Types.hpp>
@@ -27,8 +29,9 @@
public:
// ////////// Constructors and destructors //////////
/** Constructor.
- @param std::ostream& Output log stream (for instance, std::cout). */
- DSIM_Service (const std::string&, std::ostream& ioLogStream);
+ @param std::ostream& Output log stream (for instance, std::cout).
+ @param const stdair::Filename_T& Filename of the input schedule file. */
+ DSIM_Service (std::ostream& ioLogStream, const stdair::Filename_T&);
/** Destructor. */
~DSIM_Service();
@@ -41,8 +44,10 @@
/** Default copy constructor. */
DSIM_Service (const DSIM_Service&);
- /** Initialise. */
- void init (const std::string&, std::ostream& ioLogStream);
+ /** Initialise.
+ @param std::ostream& Output log stream (for instance, std::cout).
+ @param const stdair::Filename_T& Filename of the input schedule file. */
+ void init (std::ostream& ioLogStream, const stdair::Filename_T&);
/** Finalise. */
void finalise ();
Modified: trunk/dsim/dsim/service/DSIM_Service.cpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_Service.cpp 2009-12-31 13:33:35 UTC (rev 42)
+++ trunk/dsim/dsim/service/DSIM_Service.cpp 2010-01-01 18:55:18 UTC (rev 43)
@@ -3,6 +3,7 @@
// //////////////////////////////////////////////////////////////////////
// STL
#include <cassert>
+#include <ostream>
// Boost
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
@@ -21,15 +22,14 @@
// //////////////////////////////////////////////////////////////////////
DSIM_Service::
- DSIM_Service (const std::string& iScheduleInputFilename,
- std::ostream& ioLogStream)
+ DSIM_Service (std::ostream& ioLogStream,
+ const stdair::Filename_T& iScheduleInputFilename)
: _dsimServiceContext (NULL) {
- init (iScheduleInputFilename, ioLogStream);
+ init (ioLogStream, iScheduleInputFilename);
}
// //////////////////////////////////////////////////////////////////////
- DSIM_Service::DSIM_Service ()
- : _dsimServiceContext (NULL) {
+ DSIM_Service::DSIM_Service () : _dsimServiceContext (NULL) {
assert (false);
}
@@ -51,8 +51,8 @@
}
// //////////////////////////////////////////////////////////////////////
- void DSIM_Service::init (const std::string& iScheduleInputFilename,
- std::ostream& ioLogStream) {
+ void DSIM_Service::init (std::ostream& ioLogStream,
+ const stdair::Filename_T& iScheduleInputFilename) {
// Set the log file
logInit (LOG::DEBUG, ioLogStream);
@@ -65,6 +65,10 @@
// configuration file).
// Initialise the SIMCRS service handler
const SIMCRS::CRSCode_T lCRSCode = "1S";
+
+ // Note that the (Boost.)Smart Pointer keeps track of the references
+ // 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 (ioLogStream, lCRSCode,
iScheduleInputFilename));
Modified: trunk/dsim/test/dsim/simulate.cpp
===================================================================
--- trunk/dsim/test/dsim/simulate.cpp 2009-12-31 13:33:35 UTC (rev 42)
+++ trunk/dsim/test/dsim/simulate.cpp 2010-01-01 18:55:18 UTC (rev 43)
@@ -26,7 +26,7 @@
logOutputFile.clear();
// Initialise the list of classes/buckets
- DSIM::DSIM_Service dsimService (lScheduleInputFilename, logOutputFile);
+ DSIM::DSIM_Service dsimService (logOutputFile, lScheduleInputFilename);
// Perform a simulation
dsimService.simulate();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|