You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(23) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(16) |
Feb
(13) |
Mar
(1) |
Apr
(6) |
May
(4) |
Jun
(3) |
Jul
(33) |
Aug
(3) |
Sep
(16) |
Oct
(7) |
Nov
(20) |
Dec
(2) |
|
From: <qua...@us...> - 2010-10-15 09:28:00
|
Revision: 141
http://dsim.svn.sourceforge.net/dsim/?rev=141&view=rev
Author: quannaus
Date: 2010-10-15 09:27:53 +0000 (Fri, 15 Oct 2010)
Log Message:
-----------
[dev] Added SIMFQT lib into the Makefile.am
Modified Paths:
--------------
trunk/dsim/dsim/core/Makefile.am
Modified: trunk/dsim/dsim/core/Makefile.am
===================================================================
--- trunk/dsim/dsim/core/Makefile.am 2010-10-13 13:31:31 UTC (rev 140)
+++ trunk/dsim/dsim/core/Makefile.am 2010-10-15 09:27:53 UTC (rev 141)
@@ -23,6 +23,7 @@
$(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \
$(BOOST_FILESYSTEM_LIB) $(STDAIR_LIBS) \
$(top_builddir)/airsched/core/libairsched.la \
- $(top_builddir)/simcrs/core/libsimcrs.la \
+ $(top_builddir)/simcrs/core/libsimcrs.la \ \
+ $(top_builddir)/simfqt/core/libsimfqt.la \
$(top_builddir)/trademgen/core/libtrademgen.la \
-version-info $(GENERIC_LIBRARY_VERSION)
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: <qua...@us...> - 2010-10-04 09:30:59
|
Revision: 139
http://dsim.svn.sourceforge.net/dsim/?rev=139&view=rev
Author: quannaus
Date: 2010-10-04 09:30:53 +0000 (Mon, 04 Oct 2010)
Log Message:
-----------
[dev] Adapted the demand generation to stdair.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-10-03 16:25:59 UTC (rev 138)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-10-04 09:30:53 UTC (rev 139)
@@ -61,21 +61,15 @@
// generate next request
bool stillHavingRequestsToBeGenerated =
ioTRADEMGEN_Service.stillHavingRequestsToBeGenerated(lDemandStreamKey);
-
if (stillHavingRequestsToBeGenerated) {
stdair::BookingRequestPtr_T lNextRequest =
ioTRADEMGEN_Service.generateNextRequest (lDemandStreamKey);
assert (lNextRequest != NULL);
-
- stdair::DateTime_T lNextRequestDateTime =
- lNextRequest->getRequestDateTime ();
- stdair::EventStruct lNextEventStruct ("Request",
- lNextRequestDateTime,
- lDemandStreamKey,
+
+ stdair::EventStruct lNextEventStruct ("Request", lDemandStreamKey,
lNextRequest);
lEventQueue.addEvent (lNextEventStruct);
}
-
lEventQueue.eraseLastUsedEvent ();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-10-03 16:26:05
|
Revision: 138
http://dsim.svn.sourceforge.net/dsim/?rev=138&view=rev
Author: denis_arnaud
Date: 2010-10-03 16:25:59 +0000 (Sun, 03 Oct 2010)
Log Message:
-----------
[Test] Added the small simulation test from the RMOL project into the boost/random sub-directory.
Modified Paths:
--------------
trunk/dsim/test/boost/random/Makefile.am
Added Paths:
-----------
trunk/dsim/test/boost/random/SimulateTestSuite.cpp
trunk/dsim/test/boost/random/SimulateTestSuite.hpp
trunk/dsim/test/boost/random/SimulateTestSuite.log
Property Changed:
----------------
trunk/dsim/test/boost/random/
Property changes on: trunk/dsim/test/boost/random
___________________________________________________________________
Modified: svn:ignore
- .deps
.libs
Makefile.in
Makefile
random_demo
random_demo.rng
random_order_stats
random_order_stats.log
+ .deps
.libs
Makefile.in
Makefile
random_demo
random_demo.rng
random_order_stats
random_order_stats.log
SimulateTestSuite
SimulateTestSuite.log
SimulateTestSuite_results.xml
Modified: trunk/dsim/test/boost/random/Makefile.am
===================================================================
--- trunk/dsim/test/boost/random/Makefile.am 2010-09-29 15:26:50 UTC (rev 137)
+++ trunk/dsim/test/boost/random/Makefile.am 2010-10-03 16:25:59 UTC (rev 138)
@@ -16,7 +16,10 @@
librndmgr_la_LDFLAGS =
#
-check_PROGRAMS = random_demo random_order_stats
+EXTRACC_CHECKS = SimulateTestSuite
+check_PROGRAMS = random_demo random_order_stats $(EXTRACC_CHECKS)
+TESTS = $(EXTRACC_CHECKS)
+XFAIL_TESTS =
random_demo_SOURCES = random_demo.cpp
random_demo_CXXFLAGS = $(BOOST_CFLAGS)
@@ -26,3 +29,8 @@
random_order_stats_CXXFLAGS = $(BOOST_CFLAGS)
random_order_stats_LDFLAGS = $(BOOST_LIBS) $(BOOST_PROGRAM_OPTIONS_LIB) \
$(builddir)/librndmgr.la
+
+SimulateTestSuite_SOURCES = SimulateTestSuite.hpp SimulateTestSuite.cpp
+SimulateTestSuite_CXXFLAGS = $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS) $(EXTRACC_CFLAGS)
+SimulateTestSuite_LDADD =
+SimulateTestSuite_LDFLAGS = $(CPPUNIT_LIBS) $(EXTRACC_LIBS) $(BOOST_LIBS)
Added: trunk/dsim/test/boost/random/SimulateTestSuite.cpp
===================================================================
--- trunk/dsim/test/boost/random/SimulateTestSuite.cpp (rev 0)
+++ trunk/dsim/test/boost/random/SimulateTestSuite.cpp 2010-10-03 16:25:59 UTC (rev 138)
@@ -0,0 +1,394 @@
+// STL
+#include <iostream>
+#include <sstream>
+// Boost Date-Time
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/gregorian/gregorian.hpp>
+// Boost Random
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/normal_distribution.hpp>
+#include <boost/random/poisson_distribution.hpp>
+#include <boost/random/exponential_distribution.hpp>
+#include <boost/random/variate_generator.hpp>
+// Boost Math
+#include <boost/math/distributions/normal.hpp>
+#include <boost/math/distributions/weibull.hpp>
+// Boost Accumulators
+#include <boost/accumulators/accumulators.hpp>
+#include <boost/accumulators/statistics.hpp>
+// Extra-CPPUnit
+#include <extracppunit/CppUnitCore.hpp>
+// Test Suite
+#include <test/boost/random/SimulateTestSuite.hpp>
+
+// using namespace boost;
+namespace ba = boost::accumulators;
+
+// ////////// Type definitions //////////
+/** Type definition for a random number generator base (mt19937). */
+typedef boost::minstd_rand base_generator_type;
+
+/** Type definition for the random generator seed.
+ <br>That seed must be unsigned, otherwise the wrong overload may be
+ selected when using mt19937 as the base_generator_type. */
+typedef unsigned int random_generator_seed_type;
+
+/** Type definiton for the normal distribution (characteristics). */
+typedef boost::normal_distribution<> normal_dist_type;
+
+/** Type definiton for the Poisson distribution (characteristics). */
+typedef boost::poisson_distribution<> poisson_dist_type;
+
+/** Type definiton for the exponential distribution (characteristics). */
+typedef boost::exponential_distribution<> exponential_dist_type;
+
+/** Type definition for the normal distribution random generator. */
+typedef boost::variate_generator<base_generator_type&,
+ normal_dist_type> normal_gen_type;
+
+/** Type definition for the Poisson distribution random generator. */
+typedef boost::variate_generator<base_generator_type&,
+ poisson_dist_type> poisson_gen_type;
+
+/** Type definition for the exponential distribution random generator. */
+typedef boost::variate_generator<base_generator_type&,
+ exponential_dist_type> exponential_gen_type;
+
+/** Type definition to gather statistics. */
+typedef ba::accumulator_set<double,
+ ba::stats<ba::tag::min, ba::tag::max,
+ ba::tag::mean (ba::immediate),
+ ba::tag::sum,
+ ba::tag::lazy_variance> > stat_acc_type;
+
+class simulation_exception : public std::exception {
+public:
+ /** Constructor. */
+ simulation_exception (const std::string& iWhat) throw() : _what () {}
+ ~simulation_exception () throw() {}
+ /** Gives the reason of the exception. */
+ const char* what() const throw() { return _what.c_str(); }
+private:
+ std::string _what;
+};
+
+// ///////////////////////////////////////////////////
+double calculateDailyRate (const boost::gregorian::date iStartDate,
+ const boost::gregorian::date iCurrentDate,
+ const boost::gregorian::date iEndDate,
+ const double iFinalDemandMean) {
+
+ /**
+ Note that the following method of pro-rating the daily rate, from
+ the final annual demand, may appear cumbersome, as:
+ 1. We discretise a continuous distribution, just to get a typical
+ S-curve booking pattern.
+ 2. We normalise that distribution, so as to get the corresponding
+ cdf (cumulative distribution function) equal to 1 on [0, infinite[.
+ 3. Moreover, in reality, we should first fit the parameters of that
+ S-curve distribution with the corresponding observations.
+
+ Therefore, in the final version, we'll certainly use directly the
+ discrete distributions corresponding to the observations (historical
+ date) made beforehand. But as those observations may be difficult
+ to obtain, the following method is just handy for now.
+ */
+
+ /**
+ The result is the daily rate, expressed as a number of events (per day).
+ (lambda => mu = 1/ lambda), e.g., lambda = 10 => mu = 0.1 (= 2.4h,
+ i.e., in average, an event occurs every 2.4h).
+ */
+ double lambda = 0.0001;
+
+ // The first day open to reservation, there is no reservation (lambda = 0)
+ if (iStartDate == iCurrentDate) {
+ return lambda;
+ }
+
+ // Simulation length-time (expressed as a number of days)
+ const boost::gregorian::date_duration lSimulationLength =
+ iEndDate - iStartDate;
+ const int lSimulationLengthInDays =
+ static_cast<const int> (lSimulationLength.days());
+
+ // DEBUG
+ return (iFinalDemandMean / lSimulationLengthInDays);
+
+ // Current length-time (expressed as a number of days)
+ const boost::gregorian::date_duration lCurrentDuration =
+ iCurrentDate - iStartDate;
+ const double lCurrentDurationInDays =
+ static_cast<const double> (lCurrentDuration.days());
+
+ /** Ratio on the x-absciss for the Weibull distribution
+ (see ref: http://www.boost.org/doc/libs/1_44_0/libs/math/doc/sf_and_dist/html/math_toolkit/dist/dist_ref/dists/weibull.html). */
+ const double lXRatio = 2.0 / lSimulationLengthInDays;
+
+ /** The daily rate is pro-rated/weighted according to the
+ Weibull distribution (see above for the Boost reference).
+ The a and b parameters are taken equal to respectively 2 and 3. */
+ boost::math::weibull weibull_distribution (2, 3);
+ const double lCurrentDurationInWeibullX = lCurrentDurationInDays * lXRatio;
+ const double lPreviousDurationInWeibullX =
+ (lCurrentDurationInDays - 1.0) * lXRatio;
+
+ /**
+ There's also a normalisation factor, so as the CDF be equal
+ to one when x is equal to lSimulationLengthInDays.
+ Hence, we're looking for a normalisation constant (let's name it nc)
+ such as: f_pdf (x) = nc . Weibull_pdf (lXRatio . x).
+ We get:
+ nc = lXRatio / Weibull_cdf (lXRatio . lSimulationLengthInDays), and:
+ f_cdf (x) = Weibull_cdf (lXRatio . x)
+ / Weibull_cdf (lXRatio . lSimulationLengthInDays).
+ */
+ const double lSimulationLengthInWeibullX = lSimulationLengthInDays * lXRatio;
+ const double lNormalisationConstant =
+ 1 / boost::math::cdf (weibull_distribution, lSimulationLengthInWeibullX);
+ // gsl_cdf_weibull_P (lSimulationLengthInWeibullX, 2, 3);
+
+ const double lDailyIncrementalRate = lNormalisationConstant
+ * (boost::math::cdf (weibull_distribution, lCurrentDurationInWeibullX)
+ - boost::math::cdf (weibull_distribution, lPreviousDurationInWeibullX));
+
+ lambda = iFinalDemandMean * lDailyIncrementalRate;
+
+ return lambda;
+}
+
+// //////////////////////////////////////////////////////////////////////
+void testSimulateHelper() {
+
+ // Output log File
+ std::string lLogFilename ("SimulateTestSuite.log");
+
+ // Set the log parameters
+ std::ofstream logOutputFile;
+
+ // Open and clean the log outputfile
+ logOutputFile.open (lLogFilename.c_str());
+ logOutputFile.clear();
+
+ // Time duration representing a full day
+ // (i.e., 24h or 1,440 minutes or 86,400 seconds)
+ const boost::posix_time::time_duration kDay = boost::posix_time::hours(24);
+ const int kDayInSeconds = static_cast<const int> (kDay.total_seconds());
+ const boost::gregorian::date_duration kDayDuration (1);
+
+ // Simulation length (time length) / date range for the simulation
+ const boost::gregorian::date kStartDate (2007, boost::gregorian::Jan, 1);
+ const boost::gregorian::date kEndDate (2008, boost::gregorian::Jan, 1);
+
+ // Length of the Simulation (number of runs)
+ int K = 10;
+
+ // Final demand (i.e., number of passengers) for the given simulated
+ // flight-date
+ const double lFinalDemandMean = 300.0;
+ const double lFinalDemandStandardDeviation = 17.32;
+
+ // Initialisation of random generators
+ /** Base for the random generator. */
+ base_generator_type lGenerator (42u);
+
+ // Statistical accumulators for the respective numbers to watch
+ stat_acc_type lLambdaSumAcc;
+ stat_acc_type lTotalEventNumberAcc;
+ stat_acc_type lGaussianVariateAcc;
+
+ // Total number of events
+ int lTotalEventNumber = 0;
+
+ // Consistency check: check that the sum of the daily lambdas equals to the
+ // final demand mean
+ double lLambdaSum = 0.0;
+
+ // Perform K simulations
+ for (int i=0; i != K; i++) {
+ // Re-initialisaton of the current date
+ boost::gregorian::date lCurrentDate = kStartDate;
+
+ // Generate 1 year of draws
+
+ // Reset the total number of events for the current simulation
+ lTotalEventNumber = 0;
+
+ // Reset the sum of lambdas
+ lLambdaSum = 0.0;
+
+ // DEBUG
+ /*
+ std::cout << "Start date: " << kStartDate << "; End date: " << kEndDate
+ << std::endl;
+ */
+
+ while (lCurrentDate < kEndDate) {
+ // Calculate the daily rate of events (bookings)
+ const double lambda = calculateDailyRate (kStartDate, lCurrentDate,
+ kEndDate, lFinalDemandMean);
+ // const double mu = 1 / lambda;
+
+ // DEBUG
+ /*
+ std::cout << "Current date: " << lCurrentDate
+ << "; Final demand mean: " << lFinalDemandMean
+ << "; Lambda: " << lambda << "; mu: " << mu << std::endl;
+ */
+
+ /** Poisson distribution. */
+ poisson_dist_type lPoissonDistribution (lambda);
+
+ /** Random generator for the Poisson distribution. */
+ poisson_gen_type lPoissonDistributionGenerator (lGenerator,
+ lPoissonDistribution);
+
+ /** Exponential distribution
+ <br>Note: Boost.Math exponential distribution takes lambda as
+ the parameter, whereas the GSL (GNU Scientific Library) takes
+ mu (== 1/lambda). */
+ exponential_dist_type lExponentialDistribution (lambda);
+
+ /** Random generator for the exponential distribution. */
+ exponential_gen_type lExponentialDistributionGenerator (lGenerator,
+ lExponentialDistribution);
+
+ //
+ lLambdaSum += lambda;
+
+ // Current time
+ boost::posix_time::time_duration lCurrentTime (0, 0, 0, 0);
+
+ // Current number of events
+ int lDailyEventNumber = 0;
+
+ // Repeat until the current time exceeds 24h (i.e., 86,400 seconds)
+ while (lCurrentTime <= kDay) {
+ // Generate a random variate, expressed in (fractional) day
+ const double lExponentialVariateInDays =
+ lExponentialDistributionGenerator();
+
+ // Convert the variate in a number of seconds
+ const int lExponentialVariateInSeconds =
+ static_cast<const int> (lExponentialVariateInDays * kDayInSeconds);
+
+ // Convert the variate in a (Boost typedef) time duration
+ const boost::posix_time::time_duration lExponentialVariate =
+ boost::posix_time::seconds (lExponentialVariateInSeconds);
+
+ // Add an event
+ lDailyEventNumber++; lTotalEventNumber++;
+
+ // Add the inter-arrival time to the current time
+ lCurrentTime += lExponentialVariate;
+
+ // const double lPoissonVariate = lPoissonDistributionGenerator();
+
+ /* DEBUG
+ logOutputFile << lCurrentDate << "; " << lTotalEventNumber << "; "
+ << lDailyEventNumber << "; " << lCurrentTime << "; "
+ << std::endl;
+ */
+ }
+
+ // When the booking day is over, there's an additional event
+ // (the first one made after the booking date)
+ lTotalEventNumber--; lDailyEventNumber--;
+
+ // DEBUG
+ /**
+ logOutputFile << i << "; " << lCurrentDate << "; " << lambda << "; "
+ << lDailyEventNumber << "; " << lTotalEventNumber << "; "
+ << std::endl;
+ */
+
+ // Add a day
+ lCurrentDate += kDayDuration;
+ }
+
+ // Generate a Gaussian variate, just in order to compare the final
+ // distributions (Gaussian and accumulated Poissonian).
+ /** Normal distribution. */
+ normal_dist_type lNormalDistribution (lFinalDemandMean,
+ lFinalDemandStandardDeviation);
+
+ /** Random generator for the normal distribution. */
+ normal_gen_type lNormalDistributionGenerator (lGenerator,
+ lNormalDistribution);
+
+ const double lGaussianVariate = lNormalDistributionGenerator();
+
+ // DEBUG
+ logOutputFile << "Simulation#; Sum of Lambdas; Total nb of events; "
+ << "Random draw (following normal law);" << std::endl;
+ logOutputFile << i << "; " << lLambdaSum << "; "
+ << lTotalEventNumber << "; "
+ << lGaussianVariate << "; " << std::endl;
+
+ // Update the statistics
+ lLambdaSumAcc (lLambdaSum);
+ lTotalEventNumberAcc (lTotalEventNumber);
+ lGaussianVariateAcc (lGaussianVariate);
+ }
+
+ // DEBUG
+ logOutputFile << "Statistics for sum of Lambdas (min, max, mean, variance);"
+ << std::endl;
+ logOutputFile << ba::min (lLambdaSumAcc) << ", "
+ << ba::max (lLambdaSumAcc) << ", "
+ << ba::mean (lLambdaSumAcc) << ", "
+ << ba::variance (lLambdaSumAcc) << "; " << std::endl;
+ logOutputFile<<"Statistics for total nb of events (min, max, mean, variance);"
+ << std::endl;
+ logOutputFile << ba::min (lTotalEventNumberAcc) << ", "
+ << ba::max (lTotalEventNumberAcc) << ", "
+ << ba::mean (lTotalEventNumberAcc) << ", "
+ << ba::variance (lTotalEventNumberAcc) << "; " << std::endl;
+ logOutputFile << "Statistics for random draws (min, max, mean, variance);"
+ << std::endl;
+ logOutputFile << ba::min (lGaussianVariateAcc) << ", "
+ << ba::max (lGaussianVariateAcc) << ", "
+ << ba::mean (lGaussianVariateAcc) << ", "
+ << ba::variance (lGaussianVariateAcc) << "; "
+ << std::endl;
+
+ // Checking that the number of daily events follows a distribution
+ if (ba::mean (lTotalEventNumberAcc)
+ < lFinalDemandMean - lFinalDemandStandardDeviation
+ || ba::mean (lTotalEventNumberAcc)
+ > lFinalDemandMean + lFinalDemandStandardDeviation) {
+ throw simulation_exception ("The mean of the total number of events is not in the expected range");
+ }
+
+ // Checking that the random draws follow a normal distribution
+ if (ba::mean (lGaussianVariateAcc)
+ < lFinalDemandMean - lFinalDemandStandardDeviation
+ || ba::mean (lGaussianVariateAcc)
+ > lFinalDemandMean + lFinalDemandStandardDeviation) {
+ throw simulation_exception ("The mean of the total number of events is not in the expected range");
+ }
+
+ // TODO: check that the average number of events corresponds to the given
+ // input
+
+ // Close the log file
+ logOutputFile.close();
+}
+
+// //////////////////////////////////////////////////////////////////////
+void SimulateTestSuite::testSimulate() {
+ CPPUNIT_ASSERT_NO_THROW (testSimulateHelper(););
+}
+
+// //////////////////////////////////////////////////////////////////////
+// void SimulateTestSuite::errorCase () {
+// CPPUNIT_ASSERT (false);
+// }
+
+// //////////////////////////////////////////////////////////////////////
+SimulateTestSuite::SimulateTestSuite () {
+ _describeKey << "Running test on random generation for simulation";
+}
+
+// /////////////// M A I N /////////////////
+CPPUNIT_MAIN()
Added: trunk/dsim/test/boost/random/SimulateTestSuite.hpp
===================================================================
--- trunk/dsim/test/boost/random/SimulateTestSuite.hpp (rev 0)
+++ trunk/dsim/test/boost/random/SimulateTestSuite.hpp 2010-10-03 16:25:59 UTC (rev 138)
@@ -0,0 +1,25 @@
+// STL
+#include <sstream>
+// CPPUNIT
+#include <cppunit/extensions/HelperMacros.h>
+
+class SimulateTestSuite : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE (SimulateTestSuite);
+ CPPUNIT_TEST (testSimulate);
+ // CPPUNIT_TEST (errorCase);
+ CPPUNIT_TEST_SUITE_END ();
+public:
+
+ /** Test the Simulation functionality. */
+ void testSimulate ();
+
+ /** Test some error detection functionalities. */
+ // void errorCase ();
+
+ /** Constructor. */
+ SimulateTestSuite ();
+
+protected:
+ std::stringstream _describeKey;
+};
+CPPUNIT_TEST_SUITE_REGISTRATION (SimulateTestSuite);
Added: trunk/dsim/test/boost/random/SimulateTestSuite.log
===================================================================
--- trunk/dsim/test/boost/random/SimulateTestSuite.log (rev 0)
+++ trunk/dsim/test/boost/random/SimulateTestSuite.log 2010-10-03 16:25:59 UTC (rev 138)
@@ -0,0 +1,26 @@
+Simulation#; Sum of Lambdas; Total nb of events; Random draw (following normal law);
+0; 299.178; 286; 315.39;
+Simulation#; Sum of Lambdas; Total nb of events; Random draw (following normal law);
+1; 299.178; 336; 313.843;
+Simulation#; Sum of Lambdas; Total nb of events; Random draw (following normal law);
+2; 299.178; 300; 306.053;
+Simulation#; Sum of Lambdas; Total nb of events; Random draw (following normal law);
+3; 299.178; 306; 295.871;
+Simulation#; Sum of Lambdas; Total nb of events; Random draw (following normal law);
+4; 299.178; 297; 266.792;
+Simulation#; Sum of Lambdas; Total nb of events; Random draw (following normal law);
+5; 299.178; 288; 323.427;
+Simulation#; Sum of Lambdas; Total nb of events; Random draw (following normal law);
+6; 299.178; 304; 260.27;
+Simulation#; Sum of Lambdas; Total nb of events; Random draw (following normal law);
+7; 299.178; 286; 269.565;
+Simulation#; Sum of Lambdas; Total nb of events; Random draw (following normal law);
+8; 299.178; 307; 339.724;
+Simulation#; Sum of Lambdas; Total nb of events; Random draw (following normal law);
+9; 299.178; 303; 276.597;
+Statistics for sum of Lambdas (min, max, mean, variance);
+299.178, 299.178, 299.178, 8.5123e-12;
+Statistics for total nb of events (min, max, mean, variance);
+286, 336, 301.3, 193.41;
+Statistics for random draws (min, max, mean, variance);
+260.27, 339.724, 296.753, 665.878;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-29 15:26:56
|
Revision: 137
http://dsim.svn.sourceforge.net/dsim/?rev=137&view=rev
Author: denis_arnaud
Date: 2010-09-29 15:26:50 +0000 (Wed, 29 Sep 2010)
Log Message:
-----------
[Test] Replaced the 2nd moment by the variance on the random generation test.
Modified Paths:
--------------
trunk/dsim/test/boost/random/RandomManager.cpp
trunk/dsim/test/boost/random/RandomManager.hpp
Modified: trunk/dsim/test/boost/random/RandomManager.cpp
===================================================================
--- trunk/dsim/test/boost/random/RandomManager.cpp 2010-09-27 11:38:22 UTC (rev 136)
+++ trunk/dsim/test/boost/random/RandomManager.cpp 2010-09-29 15:26:50 UTC (rev 137)
@@ -58,7 +58,7 @@
_oStr << " mean = " << ba::mean (iStatAcc) << std::endl;
_oStr << " maximum = " << ba::max (iStatAcc) << std::endl;
_oStr << " count = " << ba::count (iStatAcc) << std::endl;
- _oStr << " moment<2> = " << ba::moment<2> (iStatAcc) << std::endl;
+ _oStr << " variance = " << ba::variance (iStatAcc) << std::endl;
// Reset formatting flags of _oStr
_oStr.flags (oldFlags);
Modified: trunk/dsim/test/boost/random/RandomManager.hpp
===================================================================
--- trunk/dsim/test/boost/random/RandomManager.hpp 2010-09-27 11:38:22 UTC (rev 136)
+++ trunk/dsim/test/boost/random/RandomManager.hpp 2010-09-29 15:26:50 UTC (rev 137)
@@ -36,7 +36,7 @@
ba::stats<ba::tag::min, ba::tag::max,
ba::tag::mean (ba::immediate),
ba::tag::sum,
- ba::tag::moment<2> > > stat_acc_type;
+ ba::tag::variance> > stat_acc_type;
/** Helper class for testing random number generation
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-27 11:38:31
|
Revision: 136
http://dsim.svn.sourceforge.net/dsim/?rev=136&view=rev
Author: denis_arnaud
Date: 2010-09-27 11:38:22 +0000 (Mon, 27 Sep 2010)
Log Message:
-----------
[Dev] Replaced calls to the GSL (GNU Scientific Library) by Boost.Math.
Modified Paths:
--------------
trunk/dsim/configure.ac
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2010-09-26 13:18:08 UTC (rev 135)
+++ trunk/dsim/configure.ac 2010-09-27 11:38:22 UTC (rev 136)
@@ -124,15 +124,6 @@
AC_SUBST(EXTRACC_CFLAGS)
AC_SUBST(EXTRACC_LIBS)
-# -----------------------------------------------------------------------------
-# Support for the GSL (GNU Scientific Library): http://www.gnu.org/software/gsl
-# -----------------------------------------------------------------------------
-# Provide --with-gsl
-AM_PATH_GSL([1.8])
-AC_SUBST(GSL_VERSION)
-AC_SUBST(GSL_CFLAGS)
-AC_SUBST(GSL_LIBS)
-
# -----------------------------------------------------------
# Python: http://www.python.org
# -----------------------------------------------------------
@@ -502,6 +493,7 @@
test/boost/mpi/master_slave/Makefile
test/boost/mpi/log_server/Makefile
test/boost/mpl/Makefile
+ test/boost/random/Makefile
test/boost/spirit/Makefile
test/boost/serialization/Makefile
test/boost/signals/Makefile
@@ -582,11 +574,6 @@
- LIBS .............. : ${LIBS}
External libraries:
- - GSL ............... :
- o GSL_VERSION ..... : ${GSL_VERSION}
- o GSL_CFLAGS ...... : ${GSL_CFLAGS}
- o GSL_LIBS ........ : ${GSL_LIBS}
-
${OPENMPI_OUTPUT}
${MPICH2_OUTPUT}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-26 13:18:15
|
Revision: 135
http://dsim.svn.sourceforge.net/dsim/?rev=135&view=rev
Author: denis_arnaud
Date: 2010-09-26 13:18:08 +0000 (Sun, 26 Sep 2010)
Log Message:
-----------
[Test] The test on sequential generation with order statistics is now fully working.
Modified Paths:
--------------
trunk/dsim/test/boost/random/Makefile.am
trunk/dsim/test/boost/random/random_order_stats.cpp
Added Paths:
-----------
trunk/dsim/test/boost/random/RandomManager.cpp
trunk/dsim/test/boost/random/RandomManager.hpp
trunk/dsim/test/boost/random/random_order_stats.cfg
trunk/dsim/test/boost/random/sources.mk
Property Changed:
----------------
trunk/dsim/test/boost/random/
Property changes on: trunk/dsim/test/boost/random
___________________________________________________________________
Modified: svn:ignore
- .deps
.libs
Makefile.in
Makefile
random_demo
random_order_stats
random_demo.rng
+ .deps
.libs
Makefile.in
Makefile
random_demo
random_demo.rng
random_order_stats
random_order_stats.log
Modified: trunk/dsim/test/boost/random/Makefile.am
===================================================================
--- trunk/dsim/test/boost/random/Makefile.am 2010-09-25 17:08:48 UTC (rev 134)
+++ trunk/dsim/test/boost/random/Makefile.am 2010-09-26 13:18:08 UTC (rev 135)
@@ -1,17 +1,28 @@
## test/boost/random sub-directory
include $(top_srcdir)/Makefile.common
+include $(srcdir)/sources.mk
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST =
+##
+# Test library
+noinst_LTLIBRARIES = librndmgr.la
+
+librndmgr_la_SOURCES = $(librndmgr_h_sources) $(librndmgr_cc_sources)
+librndmgr_la_CXXFLAGS = $(BOOST_CFLAGS)
+librndmgr_la_LIBADD =
+librndmgr_la_LDFLAGS =
+
#
check_PROGRAMS = random_demo random_order_stats
random_demo_SOURCES = random_demo.cpp
random_demo_CXXFLAGS = $(BOOST_CFLAGS)
-random_demo_LDADD = $(BOOST_LIBS)
+random_demo_LDFLAGS = $(BOOST_LIBS)
random_order_stats_SOURCES = random_order_stats.cpp
random_order_stats_CXXFLAGS = $(BOOST_CFLAGS)
-random_order_stats_LDADD = $(BOOST_LIBS)
+random_order_stats_LDFLAGS = $(BOOST_LIBS) $(BOOST_PROGRAM_OPTIONS_LIB) \
+ $(builddir)/librndmgr.la
Added: trunk/dsim/test/boost/random/RandomManager.cpp
===================================================================
--- trunk/dsim/test/boost/random/RandomManager.cpp (rev 0)
+++ trunk/dsim/test/boost/random/RandomManager.cpp 2010-09-26 13:18:08 UTC (rev 135)
@@ -0,0 +1,175 @@
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <cassert>
+// Test Random
+#include <test/boost/random/RandomManager.hpp>
+
+namespace test_random {
+
+ // //////////////////////////////////////////////////////////////////////
+ void gen_save (std::string& ioState, const boost::minstd_rand& iGenerator) {
+ std::ostringstream oStr;
+ oStr << iGenerator;
+ ioState = oStr.str();
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ void gen_restore (const std::string& iState,
+ boost::minstd_rand& ioGenerator) {
+ std::istringstream iStr (iState);
+ iStr >> ioGenerator;
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ RandomManager::RandomManager (std::ostream& ioStream,
+ const amount_of_draws_type& iNbOfDraws,
+ const random_generator_seed_type& iSeed)
+ : _oStr (ioStream), _nbOfDraws (iNbOfDraws), _seed (iSeed),
+ _generator (iSeed),
+ _uniformDistributionGenerator (_generator,
+ boost::uniform_real<> (0, 1)) {
+ //
+ init();
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ void RandomManager::init() {
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ RandomManager::~RandomManager () {
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ void RandomManager::stat_display (const stat_acc_type& iStatAcc,
+ const std::string& iTypeStr) {
+ // Store current formatting flags of _oStr
+ std::ios::fmtflags oldFlags = _oStr.flags();
+
+ //
+ _oStr.setf (std::ios::fixed);
+
+ //
+ _oStr << "Statistics for the random draws (" << iTypeStr << "): "
+ << std::endl;
+ _oStr << " minimum = " << ba::min (iStatAcc) << std::endl;
+ _oStr << " mean = " << ba::mean (iStatAcc) << std::endl;
+ _oStr << " maximum = " << ba::max (iStatAcc) << std::endl;
+ _oStr << " count = " << ba::count (iStatAcc) << std::endl;
+ _oStr << " moment<2> = " << ba::moment<2> (iStatAcc) << std::endl;
+
+ // Reset formatting flags of _oStr
+ _oStr.flags (oldFlags);
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ stat_acc_type RandomManager::pristine_uniform() {
+ stat_acc_type oStatAccumulator;
+
+ // Store current formatting flags of _oStr
+ std::ios::fmtflags oldFlags = _oStr.flags();
+
+ //
+ _oStr.setf (std::ios::fixed);
+
+ // Draw randomly
+ for (unsigned int i = 1; i <= _nbOfDraws; ++i) {
+ // Draw a random number corresponding to the uniform [0,1) range
+ const double lDrawnNumber = _uniformDistributionGenerator();
+
+ // Update the statistics
+ oStatAccumulator (lDrawnNumber);
+
+ // DEBUG
+ // _oStr << "[" << i << "]: " << lDrawnNumber << std::endl;
+ }
+
+ // Reset formatting flags of _oStr
+ _oStr.flags (oldFlags);
+
+ return oStatAccumulator;
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ stat_acc_type RandomManager::sequential_dummy() {
+ stat_acc_type oStatAccumulator;
+
+ // Store current formatting flags of _oStr
+ std::ios::fmtflags oldFlags = _oStr.flags();
+
+ //
+ _oStr.setf (std::ios::fixed);
+
+ // Draw randomly
+ double lLowerBound = 0.0;
+ for (unsigned int i = 1; i <= _nbOfDraws; ++i) {
+ // Draw a random number corresponding to the uniform [0,1) range
+ double lDrawnNumber = _uniformDistributionGenerator();
+
+ // Transform the drawn number so that it corresponds to the uniform [x,1)
+ // range distribution
+ lDrawnNumber = lLowerBound + lDrawnNumber * (1 - lLowerBound);
+
+ // Update the statistics
+ oStatAccumulator (lDrawnNumber);
+
+ // DEBUG
+ // _oStr << "[" << i << "]: " << lDrawnNumber << std::endl;
+
+ // The lower bound is translated to the latest drawn number
+ lLowerBound = lDrawnNumber;
+ }
+
+ // Reset formatting flags of _oStr
+ _oStr.flags (oldFlags);
+
+ return oStatAccumulator;
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ stat_acc_type RandomManager::sequential_uniform() {
+ stat_acc_type oStatAccumulator;
+
+ // Store current formatting flags of _oStr
+ std::ios::fmtflags oldFlags = _oStr.flags();
+
+ //
+ _oStr.setf (std::ios::fixed);
+
+ // Draw randomly
+ const double lUniformRangeLength = 1.0 / _nbOfDraws;
+ double lLowerBound = 0.0;
+ for (unsigned int i = 1; i <= _nbOfDraws; ++i) {
+ // Draw a random number corresponding to the uniform [0,1) range
+ double lDrawnNumber = _uniformDistributionGenerator();
+
+ /**
+ Transform the drawn number so that it corresponds to the
+ uniform [x,x+d) range distribution, where:<br>
+ <ul>
+ <li>d == 1/<total number of numbers to be drawn></li>
+ <li>x == (i-1)*d</li>
+ <li>x+d == i*d (by construction)</li>
+ </ul>
+ */
+ lDrawnNumber = lUniformRangeLength * (i-1 + lDrawnNumber);
+
+ // Update the statistics
+ oStatAccumulator (lDrawnNumber);
+
+ // DEBUG
+ // _oStr << "[" << i << "]: " << lDrawnNumber << std::endl;
+
+ // The lower bound is translated to the latest drawn number
+ lLowerBound = lDrawnNumber;
+ }
+
+ // Reset formatting flags of _oStr
+ _oStr.flags (oldFlags);
+
+ return oStatAccumulator;
+ }
+
+}
Added: trunk/dsim/test/boost/random/RandomManager.hpp
===================================================================
--- trunk/dsim/test/boost/random/RandomManager.hpp (rev 0)
+++ trunk/dsim/test/boost/random/RandomManager.hpp 2010-09-26 13:18:08 UTC (rev 135)
@@ -0,0 +1,109 @@
+#ifndef __TEST_RANDOM_TEST_RANDOMMANAGER_HPP
+#define __TEST_RANDOM_TEST_RANDOMMANAGER_HPP
+
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <iosfwd>
+#include <string>
+// Boost Random
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/generator_iterator.hpp>
+// Boost Accumulators
+#include <boost/accumulators/accumulators.hpp>
+#include <boost/accumulators/statistics.hpp>
+
+// using namespace boost;
+namespace ba = boost::accumulators;
+
+namespace test_random {
+
+ // ////////// Type definitions //////////
+ /** Type definition for the amount of random numbers to be generated. */
+ typedef unsigned int amount_of_draws_type;
+
+ /** Type definition for the random generator seed.
+ <br>That seed must be unsigned, otherwise the wrong overload may be
+ selected when using mt19937 as the base_generator_type. */
+ typedef unsigned int random_generator_seed_type;
+
+ /** Type definition to gather statistics. */
+ typedef ba::accumulator_set<double,
+ ba::stats<ba::tag::min, ba::tag::max,
+ ba::tag::mean (ba::immediate),
+ ba::tag::sum,
+ ba::tag::moment<2> > > stat_acc_type;
+
+
+ /** Helper class for testing random number generation
+ and order statistics. */
+ class RandomManager {
+ private:
+ // ////////// Type definitions //////////
+ /** Type definition for a random number generator base (mt19937). */
+ typedef boost::minstd_rand base_generator_type;
+
+ /** Type definition for the uniform distribution random generator. */
+ typedef boost::variate_generator<base_generator_type&,
+ boost::uniform_real<> > uni_gen_type;
+
+ public:
+ // /////////// Constructors and destructors /////////
+ /** Constructor.
+ <br>The internal random number generator is initialised with a reproducible
+ seed. That seed must be unsigned, otherwise the wrong overload may be
+ selected when using mt19937 as the base_generator_type. */
+ RandomManager (std::ostream&, const amount_of_draws_type&,
+ const random_generator_seed_type&);
+
+ /** Constructor. */
+ ~RandomManager();
+
+ /** Display the statistics held by the dedicated accumulator. */
+ void stat_display (const stat_acc_type& iStatAcc,
+ const std::string& iTypeStr = "");
+
+ /** */
+ stat_acc_type pristine_uniform();
+
+ /** */
+ stat_acc_type sequential_dummy();
+
+ /** */
+ stat_acc_type sequential_uniform();
+
+ private:
+ // /////////// Constructors and destructors /////////
+ /** Default constructors.
+ <br>They are kept private so that only the public constructor
+ may be used. */
+ RandomManager ();
+ RandomManager (const RandomManager&);
+
+ /** Initialise the random generator. */
+ void init();
+
+ private:
+ // /////////// Attributes ///////////
+ /** Log stream. */
+ std::ostream& _oStr;
+
+ /** Amount of random numbers to be generated. */
+ const amount_of_draws_type _nbOfDraws;
+
+ /** Seed of the random generator. */
+ const random_generator_seed_type _seed;
+
+ /** Base for the random generator. */
+ base_generator_type _generator;
+
+ /** Random generator for the uniform distribution on [0,1). */
+ uni_gen_type _uniformDistributionGenerator;
+ };
+
+}
+#endif // __TEST_RANDOM_TEST_RANDOMMANAGER_HPP
Added: trunk/dsim/test/boost/random/random_order_stats.cfg
===================================================================
--- trunk/dsim/test/boost/random/random_order_stats.cfg (rev 0)
+++ trunk/dsim/test/boost/random/random_order_stats.cfg 2010-09-26 13:18:08 UTC (rev 135)
@@ -0,0 +1,4 @@
+draws = 10000
+seed = 42
+log = random_order_stats.log
+
Modified: trunk/dsim/test/boost/random/random_order_stats.cpp
===================================================================
--- trunk/dsim/test/boost/random/random_order_stats.cpp 2010-09-25 17:08:48 UTC (rev 134)
+++ trunk/dsim/test/boost/random/random_order_stats.cpp 2010-09-26 13:18:08 UTC (rev 135)
@@ -1,79 +1,158 @@
+// STL
#include <cassert>
#include <iostream>
#include <sstream>
-// Boost.Random
-#include <boost/random/linear_congruential.hpp>
-#include <boost/random/uniform_int.hpp>
-#include <boost/random/uniform_real.hpp>
-#include <boost/random/variate_generator.hpp>
-#include <boost/generator_iterator.hpp>
+#include <fstream>
+// Boost Program Options
+#include <boost/program_options.hpp>
+// Local
+#include <test/boost/random/RandomManager.hpp>
-// Type definition for a random number generator (mt19937).
-typedef boost::minstd_rand base_generator_type;
+// //////// Constants ////////
+/** Default name and location for the log file. */
+const std::string K_RANDOM_DEFAULT_LOG_FILENAME ("random_order_stats.log");
-// ////////////////////////////////////////////////////
-void gen_save (std::string& ioState, const base_generator_type& iGenerator) {
- std::ostringstream oStr;
- oStr << iGenerator;
- ioState = oStr.str();
-}
+/** Default amount of random numbers to be generated. */
+const test_random::amount_of_draws_type K_RANDOM_DEFAULT_NB_OF_DRAWS = 10000;
-// ////////////////////////////////////////////////////
-void gen_restore (const std::string& iState, base_generator_type& ioGenerator) {
- std::istringstream iStr (iState);
- iStr >> ioGenerator;
-}
+/** Default seed for the random generator. */
+const test_random::random_generator_seed_type K_RANDOM_DEFAULT_GENERATOR_SEED = 42u;
-// /////////////// M A I N /////////////////
-int main() {
- // Define a random number generator and initialize it with a reproducible
- // seed.
- // <br>The seed is unsigned, otherwise the wrong overload may be selected
- // when using mt19937 as the base_generator_type.
- base_generator_type generator (42u);
+/** Early return status (so that it can be differentiated from an
+ error). */
+const int K_RANDOM_EARLY_RETURN_STATUS = 99;
- std::cout << "10 samples of a uniform distribution in [0..1):" << std::endl;
+/** Read and parse the command line options. */
+int readConfiguration (int argc, char* argv[],
+ test_random::amount_of_draws_type& ioAmountOfDraws,
+ test_random::random_generator_seed_type& ioRandomGeneratorSeed,
+ std::string& ioLogFilename) {
+ // Declare a group of options that will be allowed only on command line
+ boost::program_options::options_description generic ("Generic options");
+ generic.add_options()
+ ("version,v", "print version string")
+ ("help,h", "produce help message");
+
+ // Declare a group of options that will be allowed both on command
+ // line and in config file
+ boost::program_options::options_description config ("Configuration");
+ config.add_options()
+ ("draws,n",
+ boost::program_options::value< test_random::amount_of_draws_type >(&ioAmountOfDraws)->default_value(K_RANDOM_DEFAULT_NB_OF_DRAWS),
+ "Amount of random numbers to be generated")
+ ("seed,s",
+ boost::program_options::value< test_random::random_generator_seed_type >(&ioRandomGeneratorSeed)->default_value(K_RANDOM_DEFAULT_GENERATOR_SEED),
+ "Seed for the random generator")
+ ("log,l",
+ boost::program_options::value< std::string >(&ioLogFilename)->default_value(K_RANDOM_DEFAULT_LOG_FILENAME),
+ "Filename for the logs")
+ ;
- // Store current formatting flags of std::cout
- std::ios::fmtflags oldFlags = std::cout.flags();
+ // Hidden options, will be allowed both on command line and
+ // in config file, but will not be shown to the user.
+ boost::program_options::options_description hidden ("Hidden options");
+ hidden.add_options()
+ ("copyright",
+ boost::program_options::value< std::vector<std::string> >(),
+ "Show the copyright (license)");
+
+ boost::program_options::options_description cmdline_options;
+ cmdline_options.add(generic).add(config).add(hidden);
- std::cout.setf (std::ios::fixed);
+ boost::program_options::options_description config_file_options;
+ config_file_options.add(config).add(hidden);
+ boost::program_options::options_description visible ("Allowed options");
+ visible.add(generic).add(config);
+
+ boost::program_options::positional_options_description p;
+ p.add ("copyright", -1);
+
+ boost::program_options::variables_map vm;
+ boost::program_options::
+ store (boost::program_options::command_line_parser (argc, argv).
+ options (cmdline_options).positional(p).run(), vm);
- // Draw randomly
- double lDrawnNumber = 0.0;
- std::string lGeneratorState;
- double average = 0.0;
- const unsigned int lNbOfDraws = 100;
- for (unsigned int i = 1; i <= lNbOfDraws; ++i) {
- // Change the lower bound of the range of the uniform distribution
- boost::uniform_real<> uni_dist (lDrawnNumber, 1);
- boost::variate_generator<base_generator_type&,
- boost::uniform_real<> > uni_gen (generator,
- uni_dist);
-
- // Restore the generator state (seed)
- if (i != 1) {
- // Restore the generator state
- gen_restore (lGeneratorState, generator);
- }
+ std::ifstream ifs ("random_order_stats.cfg");
+ boost::program_options::store (parse_config_file (ifs, config_file_options),
+ vm);
+ boost::program_options::notify (vm);
- // Draw a random number corresponding to the uniform [x,1) range
- lDrawnNumber = uni_gen();
- average += lDrawnNumber / lNbOfDraws;
+ if (vm.count ("help")) {
+ std::cout << visible << std::endl;
+ return K_RANDOM_EARLY_RETURN_STATUS;
+ }
- // Save the generator state (seed)
- gen_save (lGeneratorState, generator);
+ if (vm.count ("version")) {
+ std::cout << "Order Statistics Helper Tool, version 1.0" << std::endl;
+ return K_RANDOM_EARLY_RETURN_STATUS;
+ }
+
+ if (vm.count ("draws")) {
+ ioAmountOfDraws = vm["draws"].as< test_random::amount_of_draws_type >();
+ std::cout << "Amount of random numbers to be generated: " << ioAmountOfDraws
+ << std::endl;
+ }
+
+ if (vm.count ("seed")) {
+ ioRandomGeneratorSeed = vm["seed"].as< test_random::random_generator_seed_type >();
+ std::cout << "Random generator seed: "<< ioRandomGeneratorSeed << std::endl;
+ }
+
+ if (vm.count ("log")) {
+ ioLogFilename = vm["log"].as< std::string >();
+ std::cout << "Log filename is: " << ioLogFilename << std::endl;
+ }
+
+ return 0;
+}
+
+
+// //////////////////////// M A I N /////////////////////////////
+int main (int argc, char* argv[]) {
+
+ /** Amount of random numbers to be generated. */
+ test_random::amount_of_draws_type lAmountOfDraws;
+
+ /** Seed for the random generator. */
+ test_random::random_generator_seed_type lRandomGeneratorSeed;
+
+ // Output log File
+ std::string lLogFilename;
- // DEBUG
- std::cout << "[" << i << "]: " << lDrawnNumber << std::endl;
+ // Call the command-line option parser
+ const int lOptionParserStatus =
+ readConfiguration (argc, argv, lAmountOfDraws, lRandomGeneratorSeed,
+ lLogFilename);
+
+ if (lOptionParserStatus == K_RANDOM_EARLY_RETURN_STATUS) {
+ return 0;
}
+
+ // Set the log parameters
+ std::ofstream logOutputFile;
+ // Open and clean the log outputfile
+ logOutputFile.open (lLogFilename.c_str());
+ logOutputFile.clear();
- // DEBUG
- std::cout << "Average on " << lNbOfDraws << " draws: " << average
- << std::endl;
+ // Initialise the RandomManager service object
+ test_random::RandomManager lRandomManager (logOutputFile, lAmountOfDraws,
+ lRandomGeneratorSeed);
+
+ // Pristine uniform method
+ const test_random::stat_acc_type& lPristineUniformStatAcc =
+ lRandomManager.pristine_uniform();
+ lRandomManager.stat_display (lPristineUniformStatAcc,
+ "pristine uniform [0,1)");
- // Reset formatting flags of std::cout
- std::cout.flags (oldFlags);
-
+ // Dummy sequential method
+ const test_random::stat_acc_type& lDummySequentialStatAcc =
+ lRandomManager.sequential_dummy();
+ lRandomManager.stat_display (lDummySequentialStatAcc, "dummy sequential");
+
+ // Sequential uniform method
+ const test_random::stat_acc_type& lSequentialUniformStatAcc =
+ lRandomManager.sequential_uniform();
+ lRandomManager.stat_display (lSequentialUniformStatAcc, "sequential uniform");
+
return 0;
}
Added: trunk/dsim/test/boost/random/sources.mk
===================================================================
--- trunk/dsim/test/boost/random/sources.mk (rev 0)
+++ trunk/dsim/test/boost/random/sources.mk 2010-09-26 13:18:08 UTC (rev 135)
@@ -0,0 +1,3 @@
+#
+librndmgr_h_sources = $(top_srcdir)/test/boost/random/RandomManager.hpp
+librndmgr_cc_sources = $(top_srcdir)/test/boost/random/RandomManager.cpp
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-25 17:08:54
|
Revision: 134
http://dsim.svn.sourceforge.net/dsim/?rev=134&view=rev
Author: denis_arnaud
Date: 2010-09-25 17:08:48 +0000 (Sat, 25 Sep 2010)
Log Message:
-----------
[Test] Added a test for order statistics with Boost.Random
Added Paths:
-----------
trunk/dsim/test/boost/random/
trunk/dsim/test/boost/random/Makefile.am
trunk/dsim/test/boost/random/random_demo.cpp
trunk/dsim/test/boost/random/random_order_stats.cpp
Property changes on: trunk/dsim/test/boost/random
___________________________________________________________________
Added: svn:ignore
+ .deps
.libs
Makefile.in
Makefile
random_demo
random_order_stats
random_demo.rng
Added: trunk/dsim/test/boost/random/Makefile.am
===================================================================
--- trunk/dsim/test/boost/random/Makefile.am (rev 0)
+++ trunk/dsim/test/boost/random/Makefile.am 2010-09-25 17:08:48 UTC (rev 134)
@@ -0,0 +1,17 @@
+## test/boost/random sub-directory
+include $(top_srcdir)/Makefile.common
+
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST =
+
+#
+check_PROGRAMS = random_demo random_order_stats
+
+random_demo_SOURCES = random_demo.cpp
+random_demo_CXXFLAGS = $(BOOST_CFLAGS)
+random_demo_LDADD = $(BOOST_LIBS)
+
+random_order_stats_SOURCES = random_order_stats.cpp
+random_order_stats_CXXFLAGS = $(BOOST_CFLAGS)
+random_order_stats_LDADD = $(BOOST_LIBS)
Added: trunk/dsim/test/boost/random/random_demo.cpp
===================================================================
--- trunk/dsim/test/boost/random/random_demo.cpp (rev 0)
+++ trunk/dsim/test/boost/random/random_demo.cpp 2010-09-25 17:08:48 UTC (rev 134)
@@ -0,0 +1,121 @@
+/* boost random_demo.cpp profane demo
+ *
+ * Copyright Jens Maurer 2000
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * $Id: random_demo.cpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ *
+ * A short demo program how to use the random number library.
+ */
+
+#include <iostream>
+#include <fstream>
+#include <ctime> // std::time
+
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/generator_iterator.hpp>
+
+// This is a typedef for a random number generator.
+// Try boost::mt19937 or boost::ecuyer1988 instead of boost::minstd_rand
+typedef boost::minstd_rand base_generator_type;
+
+// This is a reproducible simulation experiment. See main().
+void experiment (base_generator_type& generator) {
+ // Define a uniform random number distribution of integer values between
+ // 1 and 6 inclusive.
+ typedef boost::uniform_int<> distribution_type;
+ typedef boost::variate_generator<base_generator_type&,
+ distribution_type> gen_type;
+ gen_type die_gen (generator, distribution_type (1, 6));
+
+ // If you want to use an STL iterator interface, use iterator_adaptors.hpp.
+ // Unfortunately, this doesn't work on SunCC yet.
+ boost::generator_iterator<gen_type> die (&die_gen);
+ for (int i = 0; i < 10; i++) {
+ std::cout << *die++ << " ";
+ }
+ std::cout << std::endl;
+}
+
+int main() {
+ // Define a random number generator and initialize it with a reproducible
+ // seed.
+ // (The seed is unsigned, otherwise the wrong overload may be selected
+ // when using mt19937 as the base_generator_type.)
+ base_generator_type generator (42u);
+
+ std::cout << "10 samples of a uniform distribution in [0..1):" << std::endl;
+
+ // Define a uniform random number distribution which produces "double"
+ // values between 0 and 1 (0 inclusive, 1 exclusive).
+ boost::uniform_real<> uni_dist (0,1);
+ boost::variate_generator<base_generator_type&,
+ boost::uniform_real<> > uni (generator, uni_dist);
+
+ std::cout.setf (std::ios::fixed);
+ // You can now retrieve random numbers from that distribution by means
+ // of a STL Generator interface, i.e. calling the generator as a zero-
+ // argument function.
+ for (int i = 0; i < 10; i++) {
+ std::cout << uni() << std::endl;
+ }
+
+ /*
+ * Change seed to something else.
+ *
+ * Caveat: std::time(0) is not a very good truly-random seed. When
+ * called in rapid succession, it could return the same values, and
+ * thus the same random number sequences could ensue. If not the same
+ * values are returned, the values differ only slightly in the
+ * lowest bits. A linear congruential generator with a small factor
+ * wrapped in a uniform_smallint (see experiment) will produce the same
+ * values for the first few iterations. This is because uniform_smallint
+ * takes only the highest bits of the generator, and the generator itself
+ * needs a few iterations to spread the initial entropy from the lowest bits
+ * to the whole state.
+ */
+ generator.seed (static_cast<unsigned int> (std::time(0)));
+
+ std::cout << std::endl << "experiment: roll a die 10 times:" << std::endl;
+
+ // You can save a generator's state by copy construction.
+ base_generator_type saved_generator = generator;
+
+ // When calling other functions which take a generator or distribution
+ // as a parameter, make sure to always call by reference (or pointer).
+ // Calling by value invokes the copy constructor, which means that the
+ // sequence of random numbers at the caller is disconnected from the
+ // sequence at the callee.
+ experiment (generator);
+
+ std::cout << "redo the experiment to verify it:" << std::endl;
+ experiment (saved_generator);
+
+ // After that, both generators are equivalent
+ assert (generator == saved_generator);
+
+ // as a degenerate case, you can set min = max for uniform_int
+ boost::uniform_int<> degen_dist(4,4);
+ boost::variate_generator<base_generator_type&,
+ boost::uniform_int<> > deg (generator, degen_dist);
+ std::cout << std::endl << "degenerate case:" << std::endl;
+ std::cout << deg() << " " << deg() << " " << deg() << std::endl;
+
+#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
+ {
+ // You can save the generator state for future use. You can read the
+ // state back in at any later time using operator>>.
+ std::ofstream file ("random_demo.rng", std::ofstream::trunc);
+ file << generator;
+ }
+#endif
+
+ // Some compilers don't pay attention to std:3.6.1/5 and issue a
+ // warning here if "return 0;" is omitted.
+ return 0;
+}
Added: trunk/dsim/test/boost/random/random_order_stats.cpp
===================================================================
--- trunk/dsim/test/boost/random/random_order_stats.cpp (rev 0)
+++ trunk/dsim/test/boost/random/random_order_stats.cpp 2010-09-25 17:08:48 UTC (rev 134)
@@ -0,0 +1,79 @@
+#include <cassert>
+#include <iostream>
+#include <sstream>
+// Boost.Random
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/generator_iterator.hpp>
+
+// Type definition for a random number generator (mt19937).
+typedef boost::minstd_rand base_generator_type;
+
+// ////////////////////////////////////////////////////
+void gen_save (std::string& ioState, const base_generator_type& iGenerator) {
+ std::ostringstream oStr;
+ oStr << iGenerator;
+ ioState = oStr.str();
+}
+
+// ////////////////////////////////////////////////////
+void gen_restore (const std::string& iState, base_generator_type& ioGenerator) {
+ std::istringstream iStr (iState);
+ iStr >> ioGenerator;
+}
+
+// /////////////// M A I N /////////////////
+int main() {
+ // Define a random number generator and initialize it with a reproducible
+ // seed.
+ // <br>The seed is unsigned, otherwise the wrong overload may be selected
+ // when using mt19937 as the base_generator_type.
+ base_generator_type generator (42u);
+
+ std::cout << "10 samples of a uniform distribution in [0..1):" << std::endl;
+
+ // Store current formatting flags of std::cout
+ std::ios::fmtflags oldFlags = std::cout.flags();
+
+ std::cout.setf (std::ios::fixed);
+
+ // Draw randomly
+ double lDrawnNumber = 0.0;
+ std::string lGeneratorState;
+ double average = 0.0;
+ const unsigned int lNbOfDraws = 100;
+ for (unsigned int i = 1; i <= lNbOfDraws; ++i) {
+ // Change the lower bound of the range of the uniform distribution
+ boost::uniform_real<> uni_dist (lDrawnNumber, 1);
+ boost::variate_generator<base_generator_type&,
+ boost::uniform_real<> > uni_gen (generator,
+ uni_dist);
+
+ // Restore the generator state (seed)
+ if (i != 1) {
+ // Restore the generator state
+ gen_restore (lGeneratorState, generator);
+ }
+
+ // Draw a random number corresponding to the uniform [x,1) range
+ lDrawnNumber = uni_gen();
+ average += lDrawnNumber / lNbOfDraws;
+
+ // Save the generator state (seed)
+ gen_save (lGeneratorState, generator);
+
+ // DEBUG
+ std::cout << "[" << i << "]: " << lDrawnNumber << std::endl;
+ }
+
+ // DEBUG
+ std::cout << "Average on " << lNbOfDraws << " draws: " << average
+ << std::endl;
+
+ // Reset formatting flags of std::cout
+ std::cout.flags (oldFlags);
+
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-11 22:48:47
|
Revision: 133
http://dsim.svn.sourceforge.net/dsim/?rev=133&view=rev
Author: denis_arnaud
Date: 2010-09-11 22:48:41 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
[Test] Added a sample for handling Boost.Intrusive Set, with the find() algorithm, to the Boost.Intrusive examples on StdAir typical use.
Modified Paths:
--------------
trunk/dsim/test/boost/intrusive/BomAbstract.hpp
trunk/dsim/test/boost/intrusive/FlightDate.hpp
trunk/dsim/test/boost/intrusive/bom.cpp
Modified: trunk/dsim/test/boost/intrusive/BomAbstract.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/BomAbstract.hpp 2010-09-11 19:59:37 UTC (rev 132)
+++ trunk/dsim/test/boost/intrusive/BomAbstract.hpp 2010-09-11 22:48:41 UTC (rev 133)
@@ -24,6 +24,11 @@
oStr << idx;
_key = oStr.str();
}
+ /** Get the key. */
+ const std::string& getKey() const {
+ return _key;
+ }
+
protected:
/** Default constructors.
<br>They are kept private, so as to forbid their use (only the
@@ -33,18 +38,26 @@
public:
// Comparison operators
- friend bool operator== (const BomAbstract &a, const BomAbstract &b) {
+ friend bool operator< (const BomAbstract& a, const BomAbstract& b) {
+ return a._key < b._key;
+ }
+
+ friend bool operator> (const BomAbstract& a, const BomAbstract& b) {
+ return a._key > b._key;
+ }
+
+ friend bool operator== (const BomAbstract& a, const BomAbstract& b) {
return a._key == b._key;
}
- friend bool operator!= (const BomAbstract &a, const BomAbstract &b) {
- return a._key != b._key;
- }
+ friend bool operator!= (const BomAbstract& a, const BomAbstract& b) {
+ return a._key != b._key;
+ }
- // The hash function
- friend std::size_t hash_value (const BomAbstract &i) {
- return boost::hash<std::string>() (i._key);
- }
+ // The hash function
+ friend std::size_t hash_value (const BomAbstract& iBom) {
+ return boost::hash<std::string>() (iBom._key);
+ }
public:
// /////////// Display support methods /////////
@@ -56,7 +69,7 @@
@param istream& the input stream. */
virtual void fromStream (std::istream& ioIn) = 0;
- /** Get the serialised version of the Business Object. */
+ /** Get the serialised version of the Business Object. */
virtual std::string toString() const = 0;
protected:
@@ -117,4 +130,27 @@
}
};
+// These compare (STL strings) keys of BOM objects
+template <typename BOM>
+struct StrExpComp {
+ bool operator() (const std::string& iKey, const BOM& iBom) const {
+ return (iKey < iBom.getKey());
+ }
+
+ bool operator() (const BOM& iBom, const std::string& iKey) const {
+ return (iBom.getKey() < iKey);
+ }
+};
+
+template <typename BOM>
+struct StrExpEqual {
+ bool operator() (const std::string& iKey, const BOM& iBom) const {
+ return (iKey == iBom.getKey());
+ }
+
+ bool operator() (const BOM& iBom, const std::string& iKey) const {
+ return (iBom.getKey() == iKey);
+ }
+};
+
#endif // __INTRUSIVE_BOM_BOMABSTRACT_HPP
Modified: trunk/dsim/test/boost/intrusive/FlightDate.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/FlightDate.hpp 2010-09-11 19:59:37 UTC (rev 132)
+++ trunk/dsim/test/boost/intrusive/FlightDate.hpp 2010-09-11 22:48:41 UTC (rev 133)
@@ -7,6 +7,9 @@
// STL
#include <cassert>
#include <string>
+// Boost.Intrusive
+#include <boost/intrusive/list.hpp>
+#include <boost/intrusive/set.hpp>
// Local
#include <test/boost/intrusive/BomAbstract.hpp>
@@ -31,7 +34,8 @@
FlightDate (const FlightDate&) {}
public:
- bi::list_member_hook<> _childHook;
+ bi::list_member_hook<> _childListHook;
+ bi::set_member_hook<> _childSetHook;
public:
// /////////// Display support methods /////////
@@ -52,8 +56,11 @@
/** List of child-type FlightDate objects. */
typedef bi::member_hook <FlightDate, bi::list_member_hook<>,
- &FlightDate::_childHook> FlightDateChildMemberOption;
- typedef bi::list<FlightDate, FlightDateChildMemberOption> FlightDateChildren;
+ &FlightDate::_childListHook> FlightDateListMemberOption;
+ typedef bi::list<FlightDate, FlightDateListMemberOption> FlightDateChildList;
+ typedef bi::member_hook <FlightDate, bi::set_member_hook<>,
+ &FlightDate::_childSetHook> FlightDateSetMemberOption;
+ typedef bi::set<FlightDate, FlightDateSetMemberOption> FlightDateChildSet;
}
#endif // __INTRUSIVE_BOM_FLIGHTDATE_HPP
Modified: trunk/dsim/test/boost/intrusive/bom.cpp
===================================================================
--- trunk/dsim/test/boost/intrusive/bom.cpp 2010-09-11 19:59:37 UTC (rev 132)
+++ trunk/dsim/test/boost/intrusive/bom.cpp 2010-09-11 22:48:41 UTC (rev 133)
@@ -1,5 +1,6 @@
// STL
#include <cassert>
+#include <iostream>
#include <sstream>
#include <string>
#include <vector>
@@ -12,11 +13,23 @@
namespace bi = boost::intrusive;
+// Optimized search functions
+stdair::FlightDate* getFromSet(const std::string& iKey,
+ stdair::FlightDateChildSet& ioFlightDateChildSet) {
+ stdair::FlightDate* oFlightDate_ptr = NULL;
+ stdair::FlightDateChildSet::iterator itFlight =
+ ioFlightDateChildSet.find (iKey, StrExpComp<stdair::FlightDate>());
+ if (itFlight == ioFlightDateChildSet.end()) {
+ return oFlightDate_ptr;
+ }
+ oFlightDate_ptr = &*itFlight;
+ return oFlightDate_ptr;
+}
// /////////////////////////// M A I N /////////////////////////
/** Main.
<br>Run with the following command:
- <tt>make check && ./bom && echo "Success"</tt>
+ <tt>make check && ((./bom && echo "Success") || echo "Failure")</tt>
<br>To run the program with Valgrind, type:
<tt>libtool --mode=execute valgrind --leak-check=full ./bom</tt>
*/
@@ -37,7 +50,8 @@
}
// (Boost) Intrusive container
- stdair::FlightDateChildren lFlightDateChildren;
+ stdair::FlightDateChildList lFlightDateChildList;
+ stdair::FlightDateChildSet lFlightDateChildSet;
// Now insert them in the same order as in vector in the member hook list
for (FlightDateVector_T::iterator itFlight (lFlightDateVector.begin()),
@@ -45,13 +59,22 @@
stdair::FlightDate* lFlightDate_ptr = *itFlight;
assert (lFlightDate_ptr != NULL);
- lFlightDateChildren.push_back (*lFlightDate_ptr);
+ lFlightDateChildList.push_back (*lFlightDate_ptr);
+ lFlightDateChildSet.insert (*lFlightDate_ptr);
}
+ // DEBUG
+ /*
+ std::cout << "Size of the Boost.Intrusive list of FlightDate objects: "
+ << lFlightDateChildList.size() << std::endl;
+ std::cout << "Size of the Boost.Intrusive set of FlightDate objects: "
+ << lFlightDateChildSet.size() << std::endl;
+ */
+
// Now test lists
{
- stdair::FlightDateChildren::iterator mit (lFlightDateChildren.begin()),
- mitend (lFlightDateChildren.end());
+ stdair::FlightDateChildList::iterator mit (lFlightDateChildList.begin()),
+ mitend (lFlightDateChildList.end());
FlightDateVector_T::iterator itFlight (lFlightDateVector.begin()),
itend (lFlightDateVector.end());
@@ -68,16 +91,47 @@
}
// Now, test iterator_to()
- stdair::FlightDateChildren::iterator itChild (lFlightDateChildren.begin());
- for (int idx = 0; idx < 100; ++idx, ++itChild) {
- stdair::FlightDate* lFlightDate_ptr = lFlightDateVector.at(idx);
- assert (lFlightDate_ptr != NULL);
+ {
+ stdair::FlightDateChildList::iterator itChild(lFlightDateChildList.begin());
+ for (int idx = 0; idx < 100; ++idx, ++itChild) {
+ stdair::FlightDate* lFlightDate_ptr = lFlightDateVector.at(idx);
+ assert (lFlightDate_ptr != NULL);
+
+ if (lFlightDateChildList.iterator_to (*lFlightDate_ptr) != itChild ||
+ stdair::FlightDateChildList::s_iterator_to(*lFlightDate_ptr) != itChild) {
+ return 1;
+ }
+ }
+ }
- if (lFlightDateChildren.iterator_to (*lFlightDate_ptr) != itChild ||
- stdair::FlightDateChildren::s_iterator_to(*lFlightDate_ptr) != itChild){
- return 1;
+ // Now, test sets
+ {
+ stdair::FlightDateChildSet::iterator itChild (lFlightDateChildSet.begin()),
+ itChildEnd (lFlightDateChildSet.end());
+ for (; itChild != itChildEnd; ++itChild) {
+ const stdair::FlightDate& lFlightDate = *itChild;
+
+ const std::string& lKey = lFlightDate.getKey();
+ stdair::FlightDate* retrievedFlightDate_ptr =
+ getFromSet (lKey, lFlightDateChildSet);
+
+ // DEBUG
+ /*
+ std::cout << "Key = '" << lKey << "', itFD = "
+ << &lFlightDate << ", retrieved: " << retrievedFlightDate_ptr
+ << std::endl;
+ */
+
+ if (retrievedFlightDate_ptr == NULL ||
+ lFlightDateChildSet.iterator_to (lFlightDate) != itChild ||
+ lFlightDateChildSet.iterator_to (*retrievedFlightDate_ptr) != itChild ||
+ stdair::FlightDateChildSet::s_iterator_to (lFlightDate) != itChild ||
+ stdair::FlightDateChildSet::s_iterator_to(*retrievedFlightDate_ptr) != itChild) {
+ return 1;
+ }
}
}
+
/** Some memory cleaning.
<br>Note: the FlightDate objects cannot be simply deleted (with the
@@ -85,8 +139,12 @@
<br>See also, for more details:
- http://www.boost.org/doc/libs/1_44_0/doc/html/intrusive/usage.html#intrusive.usage.usage_lifetime
- http://www.boost.org/doc/libs/1_44_0/doc/html/intrusive/erasing_and_disposing.html
+ <br>First, clear simply all the Boost.Intrusive containers but one. Then,
+ clear the last Boost.Intrusive container while deleting the corresponding
+ hooked objects.
*/
- lFlightDateChildren.clear_and_dispose (delete_disposer<stdair::FlightDate>());
+ lFlightDateChildSet.clear();
+ lFlightDateChildList.clear_and_dispose(delete_disposer<stdair::FlightDate>());
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-11 19:59:43
|
Revision: 132
http://dsim.svn.sourceforge.net/dsim/?rev=132&view=rev
Author: denis_arnaud
Date: 2010-09-11 19:59:37 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
[Test] Improved memory handling for the Boost.Intrusive example. It is now closer to the StdAir library usage.
Modified Paths:
--------------
trunk/dsim/test/boost/intrusive/BomAbstract.hpp
trunk/dsim/test/boost/intrusive/FlightDate.hpp
trunk/dsim/test/boost/intrusive/LegDate.hpp
trunk/dsim/test/boost/intrusive/SegmentDate.hpp
Modified: trunk/dsim/test/boost/intrusive/BomAbstract.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/BomAbstract.hpp 2010-09-11 19:54:29 UTC (rev 131)
+++ trunk/dsim/test/boost/intrusive/BomAbstract.hpp 2010-09-11 19:59:37 UTC (rev 132)
@@ -17,13 +17,21 @@
/** BomAbstract. */
class BomAbstract {
public:
+ /** Constructors. */
BomAbstract (const std::string& iKey) : _key (iKey) {}
BomAbstract (const int idx) {
std::ostringstream oStr;
oStr << idx;
_key = oStr.str();
}
+ protected:
+ /** Default constructors.
+ <br>They are kept private, so as to forbid their use (only the
+ public constructors should be used). */
+ BomAbstract () {}
+ BomAbstract (const BomAbstract&) {}
+ public:
// Comparison operators
friend bool operator== (const BomAbstract &a, const BomAbstract &b) {
return a._key == b._key;
Modified: trunk/dsim/test/boost/intrusive/FlightDate.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/FlightDate.hpp 2010-09-11 19:54:29 UTC (rev 131)
+++ trunk/dsim/test/boost/intrusive/FlightDate.hpp 2010-09-11 19:59:37 UTC (rev 132)
@@ -23,7 +23,14 @@
FlightDate (const int idx) : BomAbstract (idx) {}
/** Destructor. */
~FlightDate() {}
-
+ private:
+ /** Default constructors.
+ <br>They are kept private, so as to forbid their use (only the
+ public constructors should be used). */
+ FlightDate () {}
+ FlightDate (const FlightDate&) {}
+
+ public:
bi::list_member_hook<> _childHook;
public:
Modified: trunk/dsim/test/boost/intrusive/LegDate.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/LegDate.hpp 2010-09-11 19:54:29 UTC (rev 131)
+++ trunk/dsim/test/boost/intrusive/LegDate.hpp 2010-09-11 19:59:37 UTC (rev 132)
@@ -20,7 +20,14 @@
public:
LegDate (const std::string& iKey) : BomAbstract (iKey) {}
LegDate (const int idx) : BomAbstract (idx) {}
-
+ private:
+ /** Default constructors.
+ <br>They are kept private, so as to forbid their use (only the
+ public constructors should be used). */
+ LegDate () {}
+ LegDate (const LegDate&) {}
+
+ public:
bi::list_member_hook<> _childHook;
bi::list_member_hook<> _siblingHook;
Modified: trunk/dsim/test/boost/intrusive/SegmentDate.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/SegmentDate.hpp 2010-09-11 19:54:29 UTC (rev 131)
+++ trunk/dsim/test/boost/intrusive/SegmentDate.hpp 2010-09-11 19:59:37 UTC (rev 132)
@@ -20,7 +20,14 @@
public:
SegmentDate (const std::string& iKey) : BomAbstract (iKey) {}
SegmentDate (const int idx) : BomAbstract (idx) {}
-
+ private:
+ /** Default constructors.
+ <br>They are kept private, so as to forbid their use (only the
+ public constructors should be used). */
+ SegmentDate () {}
+ SegmentDate (const SegmentDate&) {}
+
+ public:
bi::list_member_hook<> _childHook;
bi::list_member_hook<> _siblingHook;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-11 19:54:35
|
Revision: 131
http://dsim.svn.sourceforge.net/dsim/?rev=131&view=rev
Author: denis_arnaud
Date: 2010-09-11 19:54:29 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
[Test] Improved memory handling for the Boost.Intrusive example. It is now closer to the StdAir library usage.
Modified Paths:
--------------
trunk/dsim/test/boost/intrusive/BomAbstract.hpp
trunk/dsim/test/boost/intrusive/BomRoot.hpp
trunk/dsim/test/boost/intrusive/FlightDate.hpp
trunk/dsim/test/boost/intrusive/LegDate.hpp
trunk/dsim/test/boost/intrusive/SegmentDate.hpp
trunk/dsim/test/boost/intrusive/bom.cpp
Modified: trunk/dsim/test/boost/intrusive/BomAbstract.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/BomAbstract.hpp 2010-09-11 16:51:17 UTC (rev 130)
+++ trunk/dsim/test/boost/intrusive/BomAbstract.hpp 2010-09-11 19:54:29 UTC (rev 131)
@@ -6,10 +6,13 @@
// //////////////////////////////////////////////////////////////////////
// STL
#include <cassert>
+#include <iosfwd>
#include <sstream>
#include <string>
+// Boost.Intrusive
+#include <boost/functional/hash.hpp>
-namespace intrusive {
+namespace stdair {
/** BomAbstract. */
class BomAbstract {
@@ -20,9 +23,90 @@
oStr << idx;
_key = oStr.str();
}
+
+ // Comparison operators
+ friend bool operator== (const BomAbstract &a, const BomAbstract &b) {
+ return a._key == b._key;
+ }
+
+ friend bool operator!= (const BomAbstract &a, const BomAbstract &b) {
+ return a._key != b._key;
+ }
+
+ // The hash function
+ friend std::size_t hash_value (const BomAbstract &i) {
+ return boost::hash<std::string>() (i._key);
+ }
+
+ public:
+ // /////////// Display support methods /////////
+ /** Dump a Business Object into an output stream.
+ @param ostream& the output stream. */
+ 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) = 0;
+
+ /** Get the serialised version of the Business Object. */
+ virtual std::string toString() const = 0;
+
protected:
std::string _key;
};
}
+
+/**
+ Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing
+ Output Operators" (p653) of his book "The C++ Standard Library: A Tutorial
+ and Reference", published by Addison-Wesley.
+ */
+template <class charT, class traits>
+inline
+std::basic_ostream<charT, traits>&
+operator<< (std::basic_ostream<charT, traits>& ioOut,
+ const stdair::BomAbstract& iBom) {
+ /**
+ string stream:
+ - with same format
+ - without special field width
+ */
+ std::basic_ostringstream<charT,traits> ostr;
+ ostr.copyfmt (ioOut);
+ ostr.width (0);
+
+ // Fill string stream
+ iBom.toStream (ostr);
+
+ // Print string stream
+ ioOut << ostr.str();
+
+ return ioOut;
+}
+
+/**
+ Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing
+ Output Operators" (pp655-657) of his book "The C++ Standard Library:
+ A Tutorial and Reference", published by Addison-Wesley.
+ */
+template <class charT, class traits>
+inline
+std::basic_istream<charT, traits>&
+operator>> (std::basic_istream<charT, traits>& ioIn,
+ stdair::BomAbstract& ioBom) {
+ // Fill Bom object with input stream
+ ioBom.fromStream (ioIn);
+ return ioIn;
+}
+
+
+/** The disposer object function. */
+template <typename BOM>
+struct delete_disposer {
+ void operator() (BOM* oBOM_ptr) {
+ delete oBOM_ptr; oBOM_ptr = NULL;
+ }
+};
+
#endif // __INTRUSIVE_BOM_BOMABSTRACT_HPP
Modified: trunk/dsim/test/boost/intrusive/BomRoot.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/BomRoot.hpp 2010-09-11 16:51:17 UTC (rev 130)
+++ trunk/dsim/test/boost/intrusive/BomRoot.hpp 2010-09-11 19:54:29 UTC (rev 131)
@@ -10,13 +10,29 @@
//
#include <test/boost/intrusive/BomAbstract.hpp>
-namespace intrusive {
+namespace stdair {
/** BomRoot. */
class BomRoot : public BomAbstract {
public:
BomRoot (const std::string& iKey) : BomAbstract (iKey) {}
BomRoot (const int idx) : BomAbstract (idx) {}
+
+ public:
+ // /////////// Display support methods /////////
+ /** Dump a Business Object into an output stream.
+ @param ostream& the output stream. */
+ void toStream (std::ostream& ioOut) const { ioOut << toString(); }
+
+ /** Read a Business Object from an input stream.
+ @param istream& the input stream. */
+ void fromStream (std::istream& ioIn) { }
+
+ /** Get the serialised version of the Business Object. */
+ std::string toString() const { return describeKey(); }
+
+ /** Get a string describing the key. */
+ const std::string describeKey() const { return _key; }
};
}
Modified: trunk/dsim/test/boost/intrusive/FlightDate.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/FlightDate.hpp 2010-09-11 16:51:17 UTC (rev 130)
+++ trunk/dsim/test/boost/intrusive/FlightDate.hpp 2010-09-11 19:54:29 UTC (rev 131)
@@ -13,15 +13,34 @@
/** Alias for the boost::intrusive namespace. */
namespace bi = boost::intrusive;
-namespace intrusive {
+namespace stdair {
/** FlightDate. */
class FlightDate : public BomAbstract {
public:
+ /** Constructors. */
FlightDate (const std::string& iKey) : BomAbstract (iKey) {}
FlightDate (const int idx) : BomAbstract (idx) {}
+ /** Destructor. */
+ ~FlightDate() {}
bi::list_member_hook<> _childHook;
+
+ public:
+ // /////////// Display support methods /////////
+ /** Dump a Business Object into an output stream.
+ @param ostream& the output stream. */
+ void toStream (std::ostream& ioOut) const { ioOut << toString(); }
+
+ /** Read a Business Object from an input stream.
+ @param istream& the input stream. */
+ void fromStream (std::istream& ioIn) { }
+
+ /** Get the serialised version of the Business Object. */
+ std::string toString() const { return describeKey(); }
+
+ /** Get a string describing the key. */
+ const std::string describeKey() const { return _key; }
};
/** List of child-type FlightDate objects. */
Modified: trunk/dsim/test/boost/intrusive/LegDate.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/LegDate.hpp 2010-09-11 16:51:17 UTC (rev 130)
+++ trunk/dsim/test/boost/intrusive/LegDate.hpp 2010-09-11 19:54:29 UTC (rev 131)
@@ -13,7 +13,7 @@
/** Alias for the boost::intrusive namespace. */
namespace bi = boost::intrusive;
-namespace intrusive {
+namespace stdair {
/** LegDate. */
class LegDate : public BomAbstract {
@@ -23,6 +23,22 @@
bi::list_member_hook<> _childHook;
bi::list_member_hook<> _siblingHook;
+
+ public:
+ // /////////// Display support methods /////////
+ /** Dump a Business Object into an output stream.
+ @param ostream& the output stream. */
+ void toStream (std::ostream& ioOut) const { ioOut << toString(); }
+
+ /** Read a Business Object from an input stream.
+ @param istream& the input stream. */
+ void fromStream (std::istream& ioIn) { }
+
+ /** Get the serialised version of the Business Object. */
+ std::string toString() const { return describeKey(); }
+
+ /** Get a string describing the key. */
+ const std::string describeKey() const { return _key; }
};
/** List of child-type LegDate objects. */
Modified: trunk/dsim/test/boost/intrusive/SegmentDate.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/SegmentDate.hpp 2010-09-11 16:51:17 UTC (rev 130)
+++ trunk/dsim/test/boost/intrusive/SegmentDate.hpp 2010-09-11 19:54:29 UTC (rev 131)
@@ -13,7 +13,7 @@
/** Alias for the boost::intrusive namespace. */
namespace bi = boost::intrusive;
-namespace intrusive {
+namespace stdair {
/** SegmentDate. */
class SegmentDate : public BomAbstract {
@@ -23,6 +23,22 @@
bi::list_member_hook<> _childHook;
bi::list_member_hook<> _siblingHook;
+
+ public:
+ // /////////// Display support methods /////////
+ /** Dump a Business Object into an output stream.
+ @param ostream& the output stream. */
+ void toStream (std::ostream& ioOut) const { ioOut << toString(); }
+
+ /** Read a Business Object from an input stream.
+ @param istream& the input stream. */
+ void fromStream (std::istream& ioIn) { }
+
+ /** Get the serialised version of the Business Object. */
+ std::string toString() const { return describeKey(); }
+
+ /** Get a string describing the key. */
+ const std::string describeKey() const { return _key; }
};
/** List of child-type SegmentDate objects. */
Modified: trunk/dsim/test/boost/intrusive/bom.cpp
===================================================================
--- trunk/dsim/test/boost/intrusive/bom.cpp 2010-09-11 16:51:17 UTC (rev 130)
+++ trunk/dsim/test/boost/intrusive/bom.cpp 2010-09-11 19:54:29 UTC (rev 131)
@@ -14,36 +14,79 @@
// /////////////////////////// M A I N /////////////////////////
+/** Main.
+ <br>Run with the following command:
+ <tt>make check && ./bom && echo "Success"</tt>
+ <br>To run the program with Valgrind, type:
+ <tt>libtool --mode=execute valgrind --leak-check=full ./bom</tt>
+*/
int main (int argc, char* argv[]) {
+ //
+ typedef std::vector<stdair::FlightDate*> FlightDateVector_T;
+
+ // Standard STL container
+ FlightDateVector_T lFlightDateVector;
+
// Create several FlightDate objects, each one with a different value
- std::vector<intrusive::FlightDate> flightDateList;
- for (int i = 0; i < 100; ++i) {
- flightDateList.push_back (intrusive::FlightDate (i));
+ for (int idx = 0; idx < 100; ++idx) {
+ stdair::FlightDate* lFlightDate_ptr = new stdair::FlightDate (idx);
+ assert (lFlightDate_ptr != NULL);
+
+ lFlightDateVector.push_back (lFlightDate_ptr);
}
- intrusive::FlightDateChildren flightDateChildren;
+ // (Boost) Intrusive container
+ stdair::FlightDateChildren lFlightDateChildren;
// Now insert them in the same order as in vector in the member hook list
- for (std::vector<intrusive::FlightDate>::iterator it (flightDateList.begin()),
- itend (flightDateList.end()); it != itend; ++it) {
- flightDateChildren.push_back (*it);
+ for (FlightDateVector_T::iterator itFlight (lFlightDateVector.begin()),
+ itend (lFlightDateVector.end()); itFlight != itend; ++itFlight) {
+ stdair::FlightDate* lFlightDate_ptr = *itFlight;
+ assert (lFlightDate_ptr != NULL);
+
+ lFlightDateChildren.push_back (*lFlightDate_ptr);
}
// Now test lists
{
- intrusive::FlightDateChildren::iterator mit (flightDateChildren.begin()),
- mitend (flightDateChildren.end());
- std::vector<intrusive::FlightDate>::iterator it (flightDateList.begin()),
- itend (flightDateList.end());
+ stdair::FlightDateChildren::iterator mit (lFlightDateChildren.begin()),
+ mitend (lFlightDateChildren.end());
+ FlightDateVector_T::iterator itFlight (lFlightDateVector.begin()),
+ itend (lFlightDateVector.end());
// Test the objects inserted in the member hook list
- for (it = flightDateList.begin(); it != itend; ++it, ++mit) {
- if (&*mit != &*it) {
+ for (itFlight = lFlightDateVector.begin();
+ itFlight != itend; ++itFlight, ++mit) {
+ stdair::FlightDate* lFlightDate_ptr = *itFlight;
+ assert (lFlightDate_ptr != NULL);
+
+ if (&*mit != lFlightDate_ptr) {
return 1;
}
}
}
+ // Now, test iterator_to()
+ stdair::FlightDateChildren::iterator itChild (lFlightDateChildren.begin());
+ for (int idx = 0; idx < 100; ++idx, ++itChild) {
+ stdair::FlightDate* lFlightDate_ptr = lFlightDateVector.at(idx);
+ assert (lFlightDate_ptr != NULL);
+
+ if (lFlightDateChildren.iterator_to (*lFlightDate_ptr) != itChild ||
+ stdair::FlightDateChildren::s_iterator_to(*lFlightDate_ptr) != itChild){
+ return 1;
+ }
+ }
+
+ /** Some memory cleaning.
+ <br>Note: the FlightDate objects cannot be simply deleted (with the
+ delete opearator).
+ <br>See also, for more details:
+ - http://www.boost.org/doc/libs/1_44_0/doc/html/intrusive/usage.html#intrusive.usage.usage_lifetime
+ - http://www.boost.org/doc/libs/1_44_0/doc/html/intrusive/erasing_and_disposing.html
+ */
+ lFlightDateChildren.clear_and_dispose (delete_disposer<stdair::FlightDate>());
+
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-11 16:51:23
|
Revision: 130
http://dsim.svn.sourceforge.net/dsim/?rev=130&view=rev
Author: denis_arnaud
Date: 2010-09-11 16:51:17 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
[Test] Added C++ classes to demonstrate how to use Boost.Intrusive for the BOM tree (there is still some work).
Modified Paths:
--------------
trunk/dsim/test/boost/intrusive/Makefile.am
Added Paths:
-----------
trunk/dsim/test/boost/intrusive/BomAbstract.hpp
trunk/dsim/test/boost/intrusive/BomRoot.hpp
trunk/dsim/test/boost/intrusive/FlightDate.hpp
trunk/dsim/test/boost/intrusive/LegDate.hpp
trunk/dsim/test/boost/intrusive/SegmentDate.hpp
trunk/dsim/test/boost/intrusive/bom.cpp
trunk/dsim/test/boost/intrusive/sources.mk
Property Changed:
----------------
trunk/dsim/test/boost/intrusive/
Property changes on: trunk/dsim/test/boost/intrusive
___________________________________________________________________
Modified: svn:ignore
- .deps
.libs
Makefile.in
Makefile
intrusive
+ .deps
.libs
Makefile.in
Makefile
intrusive
bom
Added: trunk/dsim/test/boost/intrusive/BomAbstract.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/BomAbstract.hpp (rev 0)
+++ trunk/dsim/test/boost/intrusive/BomAbstract.hpp 2010-09-11 16:51:17 UTC (rev 130)
@@ -0,0 +1,28 @@
+#ifndef __INTRUSIVE_BOM_BOMABSTRACT_HPP
+#define __INTRUSIVE_BOM_BOMABSTRACT_HPP
+
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <cassert>
+#include <sstream>
+#include <string>
+
+namespace intrusive {
+
+ /** BomAbstract. */
+ class BomAbstract {
+ public:
+ BomAbstract (const std::string& iKey) : _key (iKey) {}
+ BomAbstract (const int idx) {
+ std::ostringstream oStr;
+ oStr << idx;
+ _key = oStr.str();
+ }
+ protected:
+ std::string _key;
+ };
+
+}
+#endif // __INTRUSIVE_BOM_BOMABSTRACT_HPP
Added: trunk/dsim/test/boost/intrusive/BomRoot.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/BomRoot.hpp (rev 0)
+++ trunk/dsim/test/boost/intrusive/BomRoot.hpp 2010-09-11 16:51:17 UTC (rev 130)
@@ -0,0 +1,23 @@
+#ifndef __INTRUSIVE_BOM_BOMROOT_HPP
+#define __INTRUSIVE_BOM_BOMROOT_HPP
+
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <cassert>
+#include <string>
+//
+#include <test/boost/intrusive/BomAbstract.hpp>
+
+namespace intrusive {
+
+ /** BomRoot. */
+ class BomRoot : public BomAbstract {
+ public:
+ BomRoot (const std::string& iKey) : BomAbstract (iKey) {}
+ BomRoot (const int idx) : BomAbstract (idx) {}
+ };
+
+}
+#endif // __INTRUSIVE_BOM_BOMROOT_HPP
Added: trunk/dsim/test/boost/intrusive/FlightDate.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/FlightDate.hpp (rev 0)
+++ trunk/dsim/test/boost/intrusive/FlightDate.hpp 2010-09-11 16:51:17 UTC (rev 130)
@@ -0,0 +1,33 @@
+#ifndef __INTRUSIVE_BOM_FLIGHTDATE_HPP
+#define __INTRUSIVE_BOM_FLIGHTDATE_HPP
+
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <cassert>
+#include <string>
+// Local
+#include <test/boost/intrusive/BomAbstract.hpp>
+
+/** Alias for the boost::intrusive namespace. */
+namespace bi = boost::intrusive;
+
+namespace intrusive {
+
+ /** FlightDate. */
+ class FlightDate : public BomAbstract {
+ public:
+ FlightDate (const std::string& iKey) : BomAbstract (iKey) {}
+ FlightDate (const int idx) : BomAbstract (idx) {}
+
+ bi::list_member_hook<> _childHook;
+ };
+
+ /** List of child-type FlightDate objects. */
+ typedef bi::member_hook <FlightDate, bi::list_member_hook<>,
+ &FlightDate::_childHook> FlightDateChildMemberOption;
+ typedef bi::list<FlightDate, FlightDateChildMemberOption> FlightDateChildren;
+
+}
+#endif // __INTRUSIVE_BOM_FLIGHTDATE_HPP
Added: trunk/dsim/test/boost/intrusive/LegDate.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/LegDate.hpp (rev 0)
+++ trunk/dsim/test/boost/intrusive/LegDate.hpp 2010-09-11 16:51:17 UTC (rev 130)
@@ -0,0 +1,39 @@
+#ifndef __INTRUSIVE_BOM_LEGDATE_HPP
+#define __INTRUSIVE_BOM_LEGDATE_HPP
+
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <cassert>
+#include <string>
+//
+#include <test/boost/intrusive/BomAbstract.hpp>
+
+/** Alias for the boost::intrusive namespace. */
+namespace bi = boost::intrusive;
+
+namespace intrusive {
+
+ /** LegDate. */
+ class LegDate : public BomAbstract {
+ public:
+ LegDate (const std::string& iKey) : BomAbstract (iKey) {}
+ LegDate (const int idx) : BomAbstract (idx) {}
+
+ bi::list_member_hook<> _childHook;
+ bi::list_member_hook<> _siblingHook;
+ };
+
+ /** List of child-type LegDate objects. */
+ typedef bi::member_hook <LegDate, bi::list_member_hook<>,
+ &LegDate::_childHook> LegDateChildMemberOption;
+ typedef bi::list<LegDate, LegDateChildMemberOption> LegDateChildren;
+
+ /** List of sibling-type LegDate objects. */
+ typedef bi::member_hook <LegDate, bi::list_member_hook<>,
+ &LegDate::_siblingHook> LegDateSiblingMemberOption;
+ typedef bi::list<LegDate, LegDateSiblingMemberOption> LegDateSiblings;
+
+}
+#endif // __INTRUSIVE_BOM_LEGDATE_HPP
Modified: trunk/dsim/test/boost/intrusive/Makefile.am
===================================================================
--- trunk/dsim/test/boost/intrusive/Makefile.am 2010-09-11 15:42:49 UTC (rev 129)
+++ trunk/dsim/test/boost/intrusive/Makefile.am 2010-09-11 16:51:17 UTC (rev 130)
@@ -1,5 +1,6 @@
## test/boost/intrusive sub-directory
include $(top_srcdir)/Makefile.common
+include $(srcdir)/sources.mk
MAINTAINERCLEANFILES = Makefile.in
@@ -9,12 +10,17 @@
EXTRA_DIST =
##
-check_PROGRAMS = intrusive
+check_PROGRAMS = intrusive bom
#TESTS = $(check_PROGRAMS)
TESTS =
XFAIL_TESTS = #IndexBuildingTestSuite
intrusive_SOURCES = intrusive.cpp
-intrusive_CXXFLAGS= $(BOOST_CFLAGS)
+intrusive_CXXFLAGS = $(BOOST_CFLAGS)
intrusive_LDFLAGS = $(BOOST_LIBS)
intrusive_LDADD =
+
+bom_SOURCES = $(intru_bom_h_sources) $(intru_bom_cc_sources)
+bom_CXXFLAGS = $(BOOST_CFLAGS)
+bom_LDFLAGS = $(BOOST_LIBS)
+bom_LDADD =
Added: trunk/dsim/test/boost/intrusive/SegmentDate.hpp
===================================================================
--- trunk/dsim/test/boost/intrusive/SegmentDate.hpp (rev 0)
+++ trunk/dsim/test/boost/intrusive/SegmentDate.hpp 2010-09-11 16:51:17 UTC (rev 130)
@@ -0,0 +1,41 @@
+#ifndef __INTRUSIVE_BOM_SEGMENTDATE_HPP
+#define __INTRUSIVE_BOM_SEGMENTDATE_HPP
+
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <cassert>
+#include <string>
+//
+#include <test/boost/intrusive/BomAbstract.hpp>
+
+/** Alias for the boost::intrusive namespace. */
+namespace bi = boost::intrusive;
+
+namespace intrusive {
+
+ /** SegmentDate. */
+ class SegmentDate : public BomAbstract {
+ public:
+ SegmentDate (const std::string& iKey) : BomAbstract (iKey) {}
+ SegmentDate (const int idx) : BomAbstract (idx) {}
+
+ bi::list_member_hook<> _childHook;
+ bi::list_member_hook<> _siblingHook;
+ };
+
+ /** List of child-type SegmentDate objects. */
+ typedef bi::member_hook <SegmentDate, bi::list_member_hook<>,
+ &SegmentDate::_childHook> SegmentDateChildMemberOption;
+ typedef bi::list<SegmentDate,
+ SegmentDateChildMemberOption> SegmentDateChildren;
+
+ /** List of sibling-type SegmentDate objects. */
+ typedef bi::member_hook <SegmentDate, bi::list_member_hook<>,
+ &SegmentDate::_siblingHook> SegmentDateSiblingMemberOption;
+ typedef bi::list<SegmentDate,
+ SegmentDateSiblingMemberOption> SegmentDateSiblings;
+
+}
+#endif // __INTRUSIVE_BOM_SEGMENTDATE_HPP
Copied: trunk/dsim/test/boost/intrusive/bom.cpp (from rev 129, trunk/dsim/test/boost/intrusive/intrusive.cpp)
===================================================================
--- trunk/dsim/test/boost/intrusive/bom.cpp (rev 0)
+++ trunk/dsim/test/boost/intrusive/bom.cpp 2010-09-11 16:51:17 UTC (rev 130)
@@ -0,0 +1,49 @@
+// STL
+#include <cassert>
+#include <sstream>
+#include <string>
+#include <vector>
+// Boost
+#include <boost/intrusive/list.hpp>
+// Local
+#include <test/boost/intrusive/FlightDate.hpp>
+
+/** Alias for the boost::intrusive namespace. */
+namespace bi = boost::intrusive;
+
+
+
+// /////////////////////////// M A I N /////////////////////////
+int main (int argc, char* argv[]) {
+
+ // Create several FlightDate objects, each one with a different value
+ std::vector<intrusive::FlightDate> flightDateList;
+ for (int i = 0; i < 100; ++i) {
+ flightDateList.push_back (intrusive::FlightDate (i));
+ }
+
+ intrusive::FlightDateChildren flightDateChildren;
+
+ // Now insert them in the same order as in vector in the member hook list
+ for (std::vector<intrusive::FlightDate>::iterator it (flightDateList.begin()),
+ itend (flightDateList.end()); it != itend; ++it) {
+ flightDateChildren.push_back (*it);
+ }
+
+ // Now test lists
+ {
+ intrusive::FlightDateChildren::iterator mit (flightDateChildren.begin()),
+ mitend (flightDateChildren.end());
+ std::vector<intrusive::FlightDate>::iterator it (flightDateList.begin()),
+ itend (flightDateList.end());
+
+ // Test the objects inserted in the member hook list
+ for (it = flightDateList.begin(); it != itend; ++it, ++mit) {
+ if (&*mit != &*it) {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
Added: trunk/dsim/test/boost/intrusive/sources.mk
===================================================================
--- trunk/dsim/test/boost/intrusive/sources.mk (rev 0)
+++ trunk/dsim/test/boost/intrusive/sources.mk 2010-09-11 16:51:17 UTC (rev 130)
@@ -0,0 +1,8 @@
+intru_bom_h_sources = \
+ $(top_srcdir)/test/boost/intrusive/BomAbstract.hpp \
+ $(top_srcdir)/test/boost/intrusive/BomRoot.hpp \
+ $(top_srcdir)/test/boost/intrusive/FlightDate.hpp \
+ $(top_srcdir)/test/boost/intrusive/LegDate.hpp \
+ $(top_srcdir)/test/boost/intrusive/SegmentDate.hpp
+intru_bom_cc_sources = \
+ $(top_srcdir)/test/boost/intrusive/bom.cpp
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-11 15:42:55
|
Revision: 129
http://dsim.svn.sourceforge.net/dsim/?rev=129&view=rev
Author: denis_arnaud
Date: 2010-09-11 15:42:49 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
[Test] Added a sub-directory for Boost.Intrusive.
Modified Paths:
--------------
trunk/dsim/configure.ac
trunk/dsim/test/boost/Makefile.am
Added Paths:
-----------
trunk/dsim/test/boost/intrusive/
trunk/dsim/test/boost/intrusive/Makefile.am
trunk/dsim/test/boost/intrusive/intrusive.cpp
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2010-09-11 00:48:16 UTC (rev 128)
+++ trunk/dsim/configure.ac 2010-09-11 15:42:49 UTC (rev 129)
@@ -496,6 +496,7 @@
test/boost/asio/logger/Makefile
test/boost/asio/chat/Makefile
test/boost/filesystem/Makefile
+ test/boost/intrusive/Makefile
test/boost/iostreams/Makefile
test/boost/mpi/Makefile
test/boost/mpi/master_slave/Makefile
Modified: trunk/dsim/test/boost/Makefile.am
===================================================================
--- trunk/dsim/test/boost/Makefile.am 2010-09-11 00:48:16 UTC (rev 128)
+++ trunk/dsim/test/boost/Makefile.am 2010-09-11 15:42:49 UTC (rev 129)
@@ -5,7 +5,7 @@
MAINTAINERCLEANFILES = Makefile.in
##
-SUBDIRS = accumulators asio filesystem mpi mpl serialization signals spirit \
- smart_pointers
+SUBDIRS = accumulators asio filesystem intrusive mpi mpl \
+ serialization signals spirit smart_pointers
EXTRA_DIST =
Property changes on: trunk/dsim/test/boost/intrusive
___________________________________________________________________
Added: svn:ignore
+ .deps
.libs
Makefile.in
Makefile
intrusive
Added: trunk/dsim/test/boost/intrusive/Makefile.am
===================================================================
--- trunk/dsim/test/boost/intrusive/Makefile.am (rev 0)
+++ trunk/dsim/test/boost/intrusive/Makefile.am 2010-09-11 15:42:49 UTC (rev 129)
@@ -0,0 +1,20 @@
+## test/boost/intrusive sub-directory
+include $(top_srcdir)/Makefile.common
+
+MAINTAINERCLEANFILES = Makefile.in
+
+##
+SUBDIRS =
+
+EXTRA_DIST =
+##
+
+check_PROGRAMS = intrusive
+#TESTS = $(check_PROGRAMS)
+TESTS =
+XFAIL_TESTS = #IndexBuildingTestSuite
+
+intrusive_SOURCES = intrusive.cpp
+intrusive_CXXFLAGS= $(BOOST_CFLAGS)
+intrusive_LDFLAGS = $(BOOST_LIBS)
+intrusive_LDADD =
Added: trunk/dsim/test/boost/intrusive/intrusive.cpp
===================================================================
--- trunk/dsim/test/boost/intrusive/intrusive.cpp (rev 0)
+++ trunk/dsim/test/boost/intrusive/intrusive.cpp 2010-09-11 15:42:49 UTC (rev 129)
@@ -0,0 +1,71 @@
+#include <boost/intrusive/list.hpp>
+#include <vector>
+
+using namespace boost::intrusive;
+
+/** Object to be inserted in the intrusive list. */
+class MyClass : public list_base_hook<> {
+ int _int;
+public:
+ list_member_hook<> member_hook_;
+
+ MyClass (int i) : _int (i) {}
+};
+
+//Define a list that will store MyClass using the base hook
+typedef list<MyClass> BaseList;
+
+//Define a list that will store MyClass using the member hook
+typedef member_hook
+<MyClass, list_member_hook<>, &MyClass::member_hook_> MemberOption;
+typedef list<MyClass, MemberOption> MemberList;
+
+
+// /////////////////////// M A I N /////////////////////
+int main() {
+
+ typedef std::vector<MyClass>::iterator VectIt;
+ typedef std::vector<MyClass>::reverse_iterator VectRit;
+
+ //Create several MyClass objects, each one with a different value
+ std::vector<MyClass> values;
+ for (int i = 0; i < 100; ++i) {
+ values.push_back (MyClass(i));
+ }
+
+ BaseList baselist;
+ MemberList memberlist;
+
+ //Now insert them in the reverse order in the base hook list
+ for (VectIt it(values.begin()), itend(values.end()); it != itend; ++it) {
+ baselist.push_front (*it);
+ }
+
+ //Now insert them in the same order as in vector in the member hook list
+ for (VectIt it(values.begin()), itend(values.end()); it != itend; ++it) {
+ memberlist.push_back (*it);
+ }
+
+ //Now test lists
+ {
+ BaseList::reverse_iterator rbit(baselist.rbegin()), rbitend(baselist.rend());
+ MemberList::iterator mit (memberlist.begin()), mitend(memberlist.end());
+ VectIt it (values.begin()), itend (values.end());
+
+ //Test the objects inserted in the base hook list
+ for (; it != itend; ++it, ++rbit) {
+ if (&*rbit != &*it) {
+ return 1;
+ }
+ }
+
+ //Test the objects inserted in the member hook list
+ for (it = values.begin(); it != itend; ++it, ++mit) {
+ if (&*mit != &*it) {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-11 00:48:22
|
Revision: 128
http://dsim.svn.sourceforge.net/dsim/?rev=128&view=rev
Author: denis_arnaud
Date: 2010-09-11 00:48:16 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
[Dev] Added missing sub-directory.
Modified Paths:
--------------
trunk/dsim/dsim/Makefile.am
Modified: trunk/dsim/dsim/Makefile.am
===================================================================
--- trunk/dsim/dsim/Makefile.am 2010-09-10 14:00:25 UTC (rev 127)
+++ trunk/dsim/dsim/Makefile.am 2010-09-11 00:48:16 UTC (rev 128)
@@ -6,7 +6,7 @@
MAINTAINERCLEANFILES = Makefile.in
-SUBDIRS = basic bom factory command service config
+SUBDIRS = basic bom factory command service config core
EXTRA_DIST = config_msvc.h
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: <den...@us...> - 2010-09-07 15:18:57
|
Revision: 126
http://dsim.svn.sourceforge.net/dsim/?rev=126&view=rev
Author: denis_arnaud
Date: 2010-09-07 15:18:51 +0000 (Tue, 07 Sep 2010)
Log Message:
-----------
[Test] Fixed Makefile.
Modified Paths:
--------------
trunk/dsim/test/dsim/Makefile.am
Modified: trunk/dsim/test/dsim/Makefile.am
===================================================================
--- trunk/dsim/test/dsim/Makefile.am 2010-09-07 11:54:20 UTC (rev 125)
+++ trunk/dsim/test/dsim/Makefile.am 2010-09-07 15:18:51 UTC (rev 126)
@@ -14,8 +14,9 @@
XFAIL_TESTS = #
SimulationTestSuite_SOURCES = SimulationTestSuite.hpp SimulationTestSuite.cpp
-SimulationTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS) $(STDAIR_CFLAGS)
+SimulationTestSuite_CXXFLAGS = $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS) \
+ $(EXTRACC_CFLAGS) $(STDAIR_CFLAGS)
SimulationTestSuite_LDADD =
SimulationTestSuite_LDFLAGS = \
- $(BOOST_LIBS) $(CPPUNIT_LIBS) $(STDAIR_LIBS) $(EXTRACC_LIBS) \
+ $(BOOST_LIBS) $(CPPUNIT_LIBS) $(EXTRACC_LIBS) $(STDAIR_LIBS) \
$(top_builddir)/dsim/core/libdsim.la
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-07 11:54:27
|
Revision: 125
http://dsim.svn.sourceforge.net/dsim/?rev=125&view=rev
Author: denis_arnaud
Date: 2010-09-07 11:54:20 +0000 (Tue, 07 Sep 2010)
Log Message:
-----------
[Conf] Fixed wrong config header specification.
Modified Paths:
--------------
trunk/dsim/configure.ac
trunk/dsim/dsim/DSIM_Service.hpp
Property Changed:
----------------
trunk/dsim/dsim/
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2010-09-07 11:30:40 UTC (rev 124)
+++ trunk/dsim/configure.ac 2010-09-07 11:54:20 UTC (rev 125)
@@ -3,7 +3,7 @@
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (C) 2007-2010 Denis Arnaud <den...@us...>])
AC_INIT([DSIM],[99.99.99],[den...@us...],[dsim])
-AC_CONFIG_HEADER([dsim/DSIM_Service.hpp])
+AC_CONFIG_HEADER([dsim/config.h])
AC_CONFIG_SRCDIR([dsim])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([config])
Property changes on: trunk/dsim/dsim
___________________________________________________________________
Modified: svn:ignore
- .deps
.libs
Makefile.in
Makefile
+ .deps
.libs
stamp-h1
config.h
config.h.in
Makefile.in
Makefile
Modified: trunk/dsim/dsim/DSIM_Service.hpp
===================================================================
--- trunk/dsim/dsim/DSIM_Service.hpp 2010-09-07 11:30:40 UTC (rev 124)
+++ trunk/dsim/dsim/DSIM_Service.hpp 2010-09-07 11:54:20 UTC (rev 125)
@@ -1,242 +1,113 @@
-/* dsim/DSIM_Service.hpp. Generated from DSIM_Service.hpp.in by configure. */
-/* dsim/DSIM_Service.hpp.in. Generated from configure.ac by autoheader. */
+#ifndef __DSIM_SVC_DSIM_SERVICE_HPP
+#define __DSIM_SVC_DSIM_SERVICE_HPP
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// StdAir
+#include <stdair/STDAIR_Types.hpp>
+// Dsim
+#include <dsim/DSIM_Types.hpp>
-#ifndef CONFIG_H
-#define CONFIG_H
+// Forward declarations.
+namespace stdair {
+ class AirlineFeatureSet;
+ class STDAIR_Service;
+ struct BasLogParams;
+ struct BasDBParams;
+}
+namespace DSIM {
-/* Define if you want exceptions handling */
-/* #undef DSIM_EXCEPTIONS */
+ // Forward declaration
+ class DSIM_ServiceContext;
+ struct RDSParameters;
+
+ /** Interface for the DSIM Services. */
+ class DSIM_Service {
+ public:
+ // ////////// Constructors and destructors //////////
+ /** Constructor.
+ <br>The init() method is called; see the corresponding documentation
+ for more details.
+ <br>A reference on an output stream is given, so that log
+ outputs can be directed onto that stream.
+ <br>Moreover, database connection parameters are given, so that a
+ session can be created on the corresponding database.
+ @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 demand file. */
+ DSIM_Service (const stdair::BasLogParams&, const stdair::BasDBParams&,
+ const stdair::Filename_T& iScheduleInputFilename,
+ const stdair::Filename_T& iDemandInputFilenames);
-/* define if the Boost library is available */
-#define HAVE_BOOST /**/
+ /** Constructor.
+ <br>The init() method is called; see the corresponding documentation
+ for more details.
+ <br>Moreover, as no reference on any output stream is given,
+ neither any database access parameter is given, it is assumed
+ that the StdAir log service has already been initialised with
+ the proper log output stream by some other methods in the
+ 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 demand file. */
+ DSIM_Service (stdair::STDAIR_ServicePtr_T,
+ const stdair::Filename_T& iScheduleInputFilename,
+ const stdair::Filename_T& iDemandInputFilenames);
-/* define if the Boost::Asio library is available */
-#define HAVE_BOOST_ASIO /**/
+ /** Destructor. */
+ ~DSIM_Service();
-/* define if the Boost::Date_Time library is available */
-#define HAVE_BOOST_DATE_TIME /**/
+
+ public:
+ // /////////// Business Methods /////////////
+ /** Perform a simulation. */
+ void simulate();
+
+ /** Display the list of airlines. */
+ void displayAirlineListFromDB() const;
-/* define if the Boost::FILESYSTEM library is available */
-#define HAVE_BOOST_FILESYSTEM /**/
+
+ private:
+ // /////// Construction and Destruction helper methods ///////
+ /** Default constructor. */
+ DSIM_Service ();
+ /** Default copy constructor. */
+ DSIM_Service (const DSIM_Service&);
-/* define if the Boost::IOStreams library is available */
-#define HAVE_BOOST_IOSTREAMS /**/
+ /** Initialise the (DSIM) service context (i.e., the
+ DSIM_ServiceContext object). */
+ void initServiceContext ();
-/* define if the Boost::Mpi library is available */
-#define HAVE_BOOST_MPI /**/
+ /** 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.
+ @param const stdair::BasDBParams& Parameters for the database access.
+ @param const stdair::AirlineFeatureSet& Set of airline features. */
+ void initStdAirService (const stdair::BasLogParams&,
+ const stdair::BasDBParams&);
+
+ /** Initialise.
+ <br>The CSV file, describing the airline schedules for the
+ 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 demand file. */
+ void init (const stdair::Filename_T& iScheduleInputFilename,
+ const stdair::Filename_T& iDemandInputFilename);
+
+ /** Finalise. */
+ void finalise ();
-/* define if the Boost::Mpi_Python library is available */
-#define HAVE_BOOST_MPI_PYTHON /**/
+
+ private:
+ // ///////// Service Context /////////
+ /** Dsim context. */
+ DSIM_ServiceContext* _dsimServiceContext;
-/* define if the Boost::PROGRAM_OPTIONS library is available */
-#define HAVE_BOOST_PROGRAM_OPTIONS /**/
-
-/* define if the Boost::Regex library is available */
-#define HAVE_BOOST_REGEX /**/
-
-/* define if the Boost::Serialization library is available */
-#define HAVE_BOOST_SERIALIZATION /**/
-
-/* define if the Boost::Signals library is available */
-#define HAVE_BOOST_SIGNALS /**/
-
-/* define if the Boost::SYSTEM library is available */
-#define HAVE_BOOST_SYSTEM /**/
-
-/* define if the Boost::THREAD library is available */
-#define HAVE_BOOST_THREAD /**/
-
-/* define if the Boost::Unit_test_framework library is available */
-#define HAVE_BOOST_UNIT_TEST_FRAMEWORK /**/
-
-/* Define to 1 if you have the <cmath> header file. */
-#define HAVE_CMATH 1
-
-/* Define to 1 if you have the declaration of `signgam', and to 0 if you
- don't. */
-#define HAVE_DECL_SIGNGAM 1
-
-/* Define to 1 if you have the <deque> header file. */
-#define HAVE_DEQUE 1
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the `erf' function. */
-#define HAVE_ERF 1
-
-/* Define to 1 if you have the `erfc' function. */
-#define HAVE_ERFC 1
-
-/* Define to 1 if you have the `finite' function. */
-#define HAVE_FINITE 1
-
-/* Define to 1 if you have the `fpclass' function. */
-/* #undef HAVE_FPCLASS */
-
-/* Define to 1 if you have the <fstream> header file. */
-#define HAVE_FSTREAM 1
-
-/* Define to 1 if you have the <ieeefp.h> header file. */
-/* #undef HAVE_IEEEFP_H */
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the <iomanip> header file. */
-#define HAVE_IOMANIP 1
-
-/* Define to 1 if you have the <iostream> header file. */
-#define HAVE_IOSTREAM 1
-
-/* Define to 1 if you have the `isfinite' function. */
-/* #undef HAVE_ISFINITE */
-
-/* Define to 1 if you have the `isinf' function. */
-#define HAVE_ISINF 1
-
-/* Define to 1 if you have the `isnan' function. */
-#define HAVE_ISNAN 1
-
-/* Define to 1 if you have the `lgamma' function. */
-#define HAVE_LGAMMA 1
-
-/* Define to 1 if you have the <limits> header file. */
-#define HAVE_LIMITS 1
-
-/* Define to 1 if you have the <list> header file. */
-#define HAVE_LIST 1
-
-/* Define to 1 if you have the `log1p' function. */
-#define HAVE_LOG1P 1
-
-/* Define to 1 if you have the <map> header file. */
-#define HAVE_MAP 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the <queue> header file. */
-#define HAVE_QUEUE 1
-
-/* Define to 1 if you have the `rint' function. */
-#define HAVE_RINT 1
-
-/* Define to 1 if you have the <sstream> header file. */
-#define HAVE_SSTREAM 1
-
-/* Define to 1 if you have the <stdexcept> header file. */
-#define HAVE_STDEXCEPT 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <string> header file. */
-#define HAVE_STRING 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the `tgamma' function. */
-#define HAVE_TGAMMA 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if you have the <vector> header file. */
-#define HAVE_VECTOR 1
-
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
- */
-#define LT_OBJDIR ".libs/"
-
-/* Name of package */
-#define PACKAGE "dsim"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "den...@us..."
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "DSIM"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "DSIM 99.99.99"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "dsim"
-
-/* Define to the home page for this package. */
-#define PACKAGE_URL ""
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "99.99.99"
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#define TIME_WITH_SYS_TIME 1
-
-/* Version number of package */
-#define VERSION "99.99.99"
-
-
-#if HAVE_CMATH
-# include <cmath>
-#endif
-
-/* Solaris uses <ieeefp.h> for declaring isnan() and finite() functions */
-#if HAVE_IEEEFP_H
-# include <ieeefp.h>
-#endif
-
-/* Microsoft Visual C++ .NET underscore prefixed functions */
-#if _MSC_VER
-# include <cfloat>
-# define HAVE_FINITE 1
-# define finite(x) _finite(x)
-# define HAVE_ISNAN 1
-# define isnan(x) _isnan(x)
-# define HAVE_FPCLASS 1
-# define fpclass(x) _fpclass(x)
-# define HAVE_JN 1
-# define jn(a, b) _jn(a, b)
-# define HAVE_YN 1
-# define yn(a, b) _yn(a, b)
-# define HAVE_J0 1
-# define j0(a) _j0(a)
-# define HAVE_J1 1
-# define j1(a) _j1(a)
-#endif
-
-#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
-# define HAVE_ISINF 1
-# define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
-#endif
-
-#if (! defined (HAVE_FINITE) && defined (HAVE_ISFINITE))
-# define HAVE_FINITE 1
-# define finite(a) isfinite(a)
-#endif
-
-#if (! defined(HAVE_FINITE) && defined(HAVE_ISNAN) && defined(HAVE_ISINF))
-# define HAVE_FINITE 1
-# define finite(a) (! isnan(a) && ! isinf(a))
-#endif
-
-#endif /* #ifndef CONFIG_H */
-
+ };
+}
+#endif // __DSIM_SVC_DSIM_SERVICE_HPP
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-09-07 11:30:47
|
Revision: 124
http://dsim.svn.sourceforge.net/dsim/?rev=124&view=rev
Author: denis_arnaud
Date: 2010-09-07 11:30:40 +0000 (Tue, 07 Sep 2010)
Log Message:
-----------
[Build] The StdAir and ExtraCC projects are no longer Subversion external references.
Modified Paths:
--------------
trunk/dsim/Makefile.am
trunk/dsim/configure.ac
trunk/dsim/doc/Makefile.am
trunk/dsim/dsim/DSIM_Service.hpp
trunk/dsim/dsim/Makefile.am
trunk/dsim/dsim/basic/Makefile.am
trunk/dsim/dsim/batches/Makefile.am
trunk/dsim/dsim/bom/Makefile.am
trunk/dsim/dsim/command/Makefile.am
trunk/dsim/dsim/core/Makefile.am
trunk/dsim/dsim/factory/Makefile.am
trunk/dsim/dsim/service/Makefile.am
trunk/dsim/test/Makefile.am
trunk/dsim/test/dsim/Makefile.am
Property Changed:
----------------
trunk/dsim/
trunk/dsim/test/
Property changes on: trunk/dsim
___________________________________________________________________
Modified: svn:externals
- config https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/config
db https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/db
stdair https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/stdair
trademgen https://trademgen.svn.sourceforge.net/svnroot/trademgen/trunk/trademgen/trademgen
airsched https://air-sched.svn.sourceforge.net/svnroot/air-sched/trunk/airsched/airsched
airrac https://airrac.svn.sourceforge.net/svnroot/airrac/trunk/airrac/airrac
avlcal https://avlcal.svn.sourceforge.net/svnroot/avlcal/trunk/avlcal/avlcal
airinv https://airinv.svn.sourceforge.net/svnroot/airinv/trunk/airinv/airinv
simfqt https://simfqt.svn.sourceforge.net/svnroot/simfqt/trunk/simfqt/simfqt
simcrs https://simcrs.svn.sourceforge.net/svnroot/simcrs/trunk/simcrs/simcrs
rmol https://rmol.svn.sourceforge.net/svnroot/rmol/trunk/rmol/rmol
travelccm https://travel-ccm.svn.sourceforge.net/svnroot/travel-ccm/trunk/travelccm/travelccm
extracppunit https://extracc.svn.sourceforge.net/svnroot/extracc/trunk/extracc/extracppunit
+ config https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/config
db https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/db
trademgen https://trademgen.svn.sourceforge.net/svnroot/trademgen/trunk/trademgen/trademgen
airsched https://air-sched.svn.sourceforge.net/svnroot/air-sched/trunk/airsched/airsched
airrac https://airrac.svn.sourceforge.net/svnroot/airrac/trunk/airrac/airrac
avlcal https://avlcal.svn.sourceforge.net/svnroot/avlcal/trunk/avlcal/avlcal
airinv https://airinv.svn.sourceforge.net/svnroot/airinv/trunk/airinv/airinv
simfqt https://simfqt.svn.sourceforge.net/svnroot/simfqt/trunk/simfqt/simfqt
simcrs https://simcrs.svn.sourceforge.net/svnroot/simcrs/trunk/simcrs/simcrs
rmol https://rmol.svn.sourceforge.net/svnroot/rmol/trunk/rmol/rmol
travelccm https://travel-ccm.svn.sourceforge.net/svnroot/travel-ccm/trunk/travelccm/travelccm
Modified: trunk/dsim/Makefile.am
===================================================================
--- trunk/dsim/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -21,12 +21,17 @@
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure \
config-h.in sic/stamp-h.in autogen.sh bootstrap
-#EXTRA_DIST = @PACKAGE@.spec @PACKAGE@.m4 @PACKAGE@.pc Makefile.common
+# Note 1: the RPM specification file (@PACKAGE@.spec) must not be distributed
+# with the rest of the source code. The tar-ball will be used by the packaging
+# process, from an external RPM specification file: duplicating it in the
+# tar-ball may only confuse things.
+# Note 2: Both @PACKAGE@.m4 and @PACKAGE@.pc must not be distributed, as they
+# will be generated by the configure script.
EXTRA_DIST =
# Build in these directories:
-SUBDIRS = stdair trademgen airsched airrac rmol airinv avlcal simfqt simcrs \
- travelccm dsim $(HTML_DOC_DIR) extracppunit $(TEST_DIR)
+SUBDIRS = trademgen airsched airrac rmol airinv avlcal simfqt simcrs \
+ travelccm dsim $(HTML_DOC_DIR) $(TEST_DIR)
# Configuration helpers
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/configure.ac 2010-09-07 11:30:40 UTC (rev 124)
@@ -3,18 +3,14 @@
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (C) 2007-2010 Denis Arnaud <den...@us...>])
AC_INIT([DSIM],[99.99.99],[den...@us...],[dsim])
-AC_CONFIG_HEADER([stdair/config.h])
-AC_CONFIG_SRCDIR([stdair/basic/BasConst.cpp])
+AC_CONFIG_HEADER([dsim/DSIM_Service.hpp])
+AC_CONFIG_SRCDIR([dsim])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_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"
-AC_SUBST(RPM_RELEASE)
-
# Shared library versioning for the main library
GENERIC_LIBRARY_VERSION="99:99:99"
# | | |
@@ -123,10 +119,10 @@
# thus directly accessible within the extracppunit directory.
# When that library will be widely avaible on Linux distributions,
# the external reference can be removed and the following line uncommented.
-#AM_PATH_EXTRACC
-#AC_SUBST(EXTRACC_VERSION)
-#AC_SUBST(EXTRACC_CFLAGS)
-#AC_SUBST(EXTRACC_LIBS)
+AM_PATH_EXTRACC
+AC_SUBST(EXTRACC_VERSION)
+AC_SUBST(EXTRACC_CFLAGS)
+AC_SUBST(EXTRACC_LIBS)
# -----------------------------------------------------------------------------
# Support for the GSL (GNU Scientific Library): http://www.gnu.org/software/gsl
@@ -198,6 +194,14 @@
AC_SUBST(SOCI_CFLAGS)
AC_SUBST(SOCI_LIBS)
+# -----------------------------------------------------------------------------
+# Support for StdAir (): http://sf.net/projects/stdair
+# -----------------------------------------------------------------------------
+AM_PATH_STDAIR
+AC_SUBST(STDAIR_VERSION)
+AC_SUBST(STDAIR_CFLAGS)
+AC_SUBST(STDAIR_LIBS)
+
# --------------------------------------------------------------------
# Support for TRAVEL-CCM (CCM Open Library): http://sf.net/projects/travel-ccm
# --------------------------------------------------------------------
@@ -379,15 +383,6 @@
dsim-config
dsim.m4
dsim.pc
- dsim.spec
- stdair/Makefile
- stdair/basic/Makefile
- stdair/bom/Makefile
- stdair/dbadaptor/Makefile
- stdair/factory/Makefile
- stdair/command/Makefile
- stdair/config/Makefile
- stdair/service/Makefile
trademgen/Makefile
trademgen/basic/Makefile
trademgen/bom/Makefile
@@ -482,7 +477,6 @@
dsim/config/Makefile
dsim/core/Makefile
dsim/batches/Makefile
- extracppunit/Makefile
doc/Makefile
doc/images/Makefile
doc/tutorial/Makefile
@@ -511,7 +505,6 @@
test/boost/serialization/Makefile
test/boost/signals/Makefile
test/boost/smart_pointers/Makefile
- test/stdair/Makefile
test/trademgen/Makefile
test/airsched/Makefile
test/airrac/Makefile
@@ -633,6 +626,11 @@
o XERCES_CFLAGS ... : ${XERCES_CFLAGS}
o XERCES_LIBS ..... : ${XERCES_LIBS}
+ - StdAir ........... :
+ o STDAIR_VERSION .. : ${STDAIR_VERSION}
+ o STDAIR_CFLAGS ... : ${STDAIR_CFLAGS}
+ o STDAIR_LIBS ..... : ${STDAIR_LIBS}
+
- ExtraCC ........... :
o EXTRACC_VERSION . : ${EXTRACC_VERSION}
o EXTRACC_CFLAGS .. : ${EXTRACC_CFLAGS}
Modified: trunk/dsim/doc/Makefile.am
===================================================================
--- trunk/dsim/doc/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/doc/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -3,13 +3,13 @@
include $(top_srcdir)/doc/tutorial/sources.mk
include $(top_srcdir)/doc/tutorial/src/sources.mk
# StdAir
-include $(top_srcdir)/stdair/basic/sources.mk
-include $(top_srcdir)/stdair/bom/sources.mk
-include $(top_srcdir)/stdair/factory/sources.mk
-include $(top_srcdir)/stdair/dbadaptor/sources.mk
-include $(top_srcdir)/stdair/command/sources.mk
-include $(top_srcdir)/stdair/service/sources.mk
-include $(top_srcdir)/stdair/sources.mk
+#include $(top_srcdir)/stdair/basic/sources.mk
+#include $(top_srcdir)/stdair/bom/sources.mk
+#include $(top_srcdir)/stdair/factory/sources.mk
+#include $(top_srcdir)/stdair/dbadaptor/sources.mk
+#include $(top_srcdir)/stdair/command/sources.mk
+#include $(top_srcdir)/stdair/service/sources.mk
+#include $(top_srcdir)/stdair/sources.mk
# TraDemGen
#include $(top_srcdir)/trademgen/basic/sources.mk
#include $(top_srcdir)/trademgen/bom/sources.mk
Modified: trunk/dsim/dsim/DSIM_Service.hpp
===================================================================
--- trunk/dsim/dsim/DSIM_Service.hpp 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/dsim/DSIM_Service.hpp 2010-09-07 11:30:40 UTC (rev 124)
@@ -1,113 +1,242 @@
-#ifndef __DSIM_SVC_DSIM_SERVICE_HPP
-#define __DSIM_SVC_DSIM_SERVICE_HPP
+/* dsim/DSIM_Service.hpp. Generated from DSIM_Service.hpp.in by configure. */
+/* dsim/DSIM_Service.hpp.in. Generated from configure.ac by autoheader. */
-// //////////////////////////////////////////////////////////////////////
-// Import section
-// //////////////////////////////////////////////////////////////////////
-// StdAir
-#include <stdair/STDAIR_Types.hpp>
-// Dsim
-#include <dsim/DSIM_Types.hpp>
-// Forward declarations.
-namespace stdair {
- class AirlineFeatureSet;
- class STDAIR_Service;
- struct BasLogParams;
- struct BasDBParams;
-}
+#ifndef CONFIG_H
+#define CONFIG_H
-namespace DSIM {
- // Forward declaration
- class DSIM_ServiceContext;
- struct RDSParameters;
-
- /** Interface for the DSIM Services. */
- class DSIM_Service {
- public:
- // ////////// Constructors and destructors //////////
- /** Constructor.
- <br>The init() method is called; see the corresponding documentation
- for more details.
- <br>A reference on an output stream is given, so that log
- outputs can be directed onto that stream.
- <br>Moreover, database connection parameters are given, so that a
- session can be created on the corresponding database.
- @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 demand file. */
- DSIM_Service (const stdair::BasLogParams&, const stdair::BasDBParams&,
- const stdair::Filename_T& iScheduleInputFilename,
- const stdair::Filename_T& iDemandInputFilenames);
+/* Define if you want exceptions handling */
+/* #undef DSIM_EXCEPTIONS */
- /** Constructor.
- <br>The init() method is called; see the corresponding documentation
- for more details.
- <br>Moreover, as no reference on any output stream is given,
- neither any database access parameter is given, it is assumed
- that the StdAir log service has already been initialised with
- the proper log output stream by some other methods in the
- 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 demand file. */
- DSIM_Service (stdair::STDAIR_ServicePtr_T,
- const stdair::Filename_T& iScheduleInputFilename,
- const stdair::Filename_T& iDemandInputFilenames);
+/* define if the Boost library is available */
+#define HAVE_BOOST /**/
- /** Destructor. */
- ~DSIM_Service();
+/* define if the Boost::Asio library is available */
+#define HAVE_BOOST_ASIO /**/
-
- public:
- // /////////// Business Methods /////////////
- /** Perform a simulation. */
- void simulate();
-
- /** Display the list of airlines. */
- void displayAirlineListFromDB() const;
+/* define if the Boost::Date_Time library is available */
+#define HAVE_BOOST_DATE_TIME /**/
-
- private:
- // /////// Construction and Destruction helper methods ///////
- /** Default constructor. */
- DSIM_Service ();
- /** Default copy constructor. */
- DSIM_Service (const DSIM_Service&);
+/* define if the Boost::FILESYSTEM library is available */
+#define HAVE_BOOST_FILESYSTEM /**/
- /** Initialise the (DSIM) service context (i.e., the
- DSIM_ServiceContext object). */
- void initServiceContext ();
+/* define if the Boost::IOStreams library is available */
+#define HAVE_BOOST_IOSTREAMS /**/
- /** 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.
- @param const stdair::BasDBParams& Parameters for the database access.
- @param const stdair::AirlineFeatureSet& Set of airline features. */
- void initStdAirService (const stdair::BasLogParams&,
- const stdair::BasDBParams&);
-
- /** Initialise.
- <br>The CSV file, describing the airline schedules for the
- 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 demand file. */
- void init (const stdair::Filename_T& iScheduleInputFilename,
- const stdair::Filename_T& iDemandInputFilename);
-
- /** Finalise. */
- void finalise ();
+/* define if the Boost::Mpi library is available */
+#define HAVE_BOOST_MPI /**/
-
- private:
- // ///////// Service Context /////////
- /** Dsim context. */
- DSIM_ServiceContext* _dsimServiceContext;
+/* define if the Boost::Mpi_Python library is available */
+#define HAVE_BOOST_MPI_PYTHON /**/
- };
-}
-#endif // __DSIM_SVC_DSIM_SERVICE_HPP
+/* define if the Boost::PROGRAM_OPTIONS library is available */
+#define HAVE_BOOST_PROGRAM_OPTIONS /**/
+
+/* define if the Boost::Regex library is available */
+#define HAVE_BOOST_REGEX /**/
+
+/* define if the Boost::Serialization library is available */
+#define HAVE_BOOST_SERIALIZATION /**/
+
+/* define if the Boost::Signals library is available */
+#define HAVE_BOOST_SIGNALS /**/
+
+/* define if the Boost::SYSTEM library is available */
+#define HAVE_BOOST_SYSTEM /**/
+
+/* define if the Boost::THREAD library is available */
+#define HAVE_BOOST_THREAD /**/
+
+/* define if the Boost::Unit_test_framework library is available */
+#define HAVE_BOOST_UNIT_TEST_FRAMEWORK /**/
+
+/* Define to 1 if you have the <cmath> header file. */
+#define HAVE_CMATH 1
+
+/* Define to 1 if you have the declaration of `signgam', and to 0 if you
+ don't. */
+#define HAVE_DECL_SIGNGAM 1
+
+/* Define to 1 if you have the <deque> header file. */
+#define HAVE_DEQUE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `erf' function. */
+#define HAVE_ERF 1
+
+/* Define to 1 if you have the `erfc' function. */
+#define HAVE_ERFC 1
+
+/* Define to 1 if you have the `finite' function. */
+#define HAVE_FINITE 1
+
+/* Define to 1 if you have the `fpclass' function. */
+/* #undef HAVE_FPCLASS */
+
+/* Define to 1 if you have the <fstream> header file. */
+#define HAVE_FSTREAM 1
+
+/* Define to 1 if you have the <ieeefp.h> header file. */
+/* #undef HAVE_IEEEFP_H */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <iomanip> header file. */
+#define HAVE_IOMANIP 1
+
+/* Define to 1 if you have the <iostream> header file. */
+#define HAVE_IOSTREAM 1
+
+/* Define to 1 if you have the `isfinite' function. */
+/* #undef HAVE_ISFINITE */
+
+/* Define to 1 if you have the `isinf' function. */
+#define HAVE_ISINF 1
+
+/* Define to 1 if you have the `isnan' function. */
+#define HAVE_ISNAN 1
+
+/* Define to 1 if you have the `lgamma' function. */
+#define HAVE_LGAMMA 1
+
+/* Define to 1 if you have the <limits> header file. */
+#define HAVE_LIMITS 1
+
+/* Define to 1 if you have the <list> header file. */
+#define HAVE_LIST 1
+
+/* Define to 1 if you have the `log1p' function. */
+#define HAVE_LOG1P 1
+
+/* Define to 1 if you have the <map> header file. */
+#define HAVE_MAP 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <queue> header file. */
+#define HAVE_QUEUE 1
+
+/* Define to 1 if you have the `rint' function. */
+#define HAVE_RINT 1
+
+/* Define to 1 if you have the <sstream> header file. */
+#define HAVE_SSTREAM 1
+
+/* Define to 1 if you have the <stdexcept> header file. */
+#define HAVE_STDEXCEPT 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <string> header file. */
+#define HAVE_STRING 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `tgamma' function. */
+#define HAVE_TGAMMA 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <vector> header file. */
+#define HAVE_VECTOR 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "dsim"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "den...@us..."
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "DSIM"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "DSIM 99.99.99"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "dsim"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "99.99.99"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "99.99.99"
+
+
+#if HAVE_CMATH
+# include <cmath>
+#endif
+
+/* Solaris uses <ieeefp.h> for declaring isnan() and finite() functions */
+#if HAVE_IEEEFP_H
+# include <ieeefp.h>
+#endif
+
+/* Microsoft Visual C++ .NET underscore prefixed functions */
+#if _MSC_VER
+# include <cfloat>
+# define HAVE_FINITE 1
+# define finite(x) _finite(x)
+# define HAVE_ISNAN 1
+# define isnan(x) _isnan(x)
+# define HAVE_FPCLASS 1
+# define fpclass(x) _fpclass(x)
+# define HAVE_JN 1
+# define jn(a, b) _jn(a, b)
+# define HAVE_YN 1
+# define yn(a, b) _yn(a, b)
+# define HAVE_J0 1
+# define j0(a) _j0(a)
+# define HAVE_J1 1
+# define j1(a) _j1(a)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+# define HAVE_ISINF 1
+# define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+#if (! defined (HAVE_FINITE) && defined (HAVE_ISFINITE))
+# define HAVE_FINITE 1
+# define finite(a) isfinite(a)
+#endif
+
+#if (! defined(HAVE_FINITE) && defined(HAVE_ISNAN) && defined(HAVE_ISINF))
+# define HAVE_FINITE 1
+# define finite(a) (! isnan(a) && ! isinf(a))
+#endif
+
+#endif /* #ifndef CONFIG_H */
+
Modified: trunk/dsim/dsim/Makefile.am
===================================================================
--- trunk/dsim/dsim/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/dsim/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -12,5 +12,5 @@
# Header files
-nobase_pkginclude_HEADERS = $(service_h_sources)
+nobase_pkginclude_HEADERS = $(dsim_service_h_sources)
#nobase_nodist_pkginclude_HEADERS = $(top_builddir)/@PACKAGE@/config.h
Modified: trunk/dsim/dsim/basic/Makefile.am
===================================================================
--- trunk/dsim/dsim/basic/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/dsim/basic/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -6,8 +6,9 @@
noinst_LTLIBRARIES = libdsimbas.la
libdsimbas_la_SOURCES = $(dsim_bas_h_sources) $(dsim_bas_cc_sources)
-libdsim_bas_la_CXXFLAGS =
+libdsimbas_la_CXXFLAGS = $(STDAIR_CFLAGS)
+libdsimbas_la_LDFLAGS =
-
+#
#pkgincludedir = $(includedir)/@PACKAGE@/basic
-#pkginclude_HEADERS = $(bas_h_sources)
+#pkginclude_HEADERS = $(dsim_bas_h_sources)
Modified: trunk/dsim/dsim/batches/Makefile.am
===================================================================
--- trunk/dsim/dsim/batches/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/dsim/batches/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -11,7 +11,7 @@
bin_PROGRAMS = simulate
simulate_SOURCES = $(dsim_batches_h_sources) $(dsim_batches_cc_sources)
-simulate_CXXFLAGS = $(BOOST_CFLAGS)
+simulate_CXXFLAGS = $(BOOST_CFLAGS) $(STDAIR_CFLAGS)
simulate_LDADD =
-simulate_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) $(SOCI_LIBS) \
+simulate_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) $(SOCI_LIBS) $(STDAIR_LIBS) \
$(top_builddir)/dsim/core/libdsim.la
Modified: trunk/dsim/dsim/bom/Makefile.am
===================================================================
--- trunk/dsim/dsim/bom/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/dsim/bom/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -3,12 +3,12 @@
include $(srcdir)/sources.mk
#
-noinst_LTLIBRARIES= libdsimbom.la
+noinst_LTLIBRARIES = libdsimbom.la
-libdsimbom_la_SOURCES= $(dsim_bom_h_sources) $(dsim_bom_cc_sources)
-libdsimbom_la_CXXFLAGS =
+libdsimbom_la_SOURCES = $(dsim_bom_h_sources) $(dsim_bom_cc_sources)
+libdsimbom_la_CXXFLAGS = $(STDAIR_CFLAGS)
libdsimbom_la_LDFLAGS =
-
+#
#pkgincludedir = $(includedir)/@PACKAGE@/bom
-#pkginclude_HEADERS = $(bom_h_sources)
+#pkginclude_HEADERS = $(dsim_bom_h_sources)
Modified: trunk/dsim/dsim/command/Makefile.am
===================================================================
--- trunk/dsim/dsim/command/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/dsim/command/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -6,12 +6,10 @@
noinst_LTLIBRARIES = libdsimcmd.la
libdsimcmd_la_SOURCES = $(dsim_cmd_h_sources) $(dsim_cmd_cc_sources)
-libdsimcmd_la_CXXFLAGS = $(BOOST_CFLAGS) $(SOCI_CFLAGS)
+libdsimcmd_la_CXXFLAGS = $(BOOST_CFLAGS) $(SOCI_CFLAGS) $(STDAIR_CFLAGS)
libdsimcmd_la_LIBADD =
-libdsimcmd_la_LDFLAGS = $(BOOST_LIBS) $(SOCI_LIBS) \
- $(top_builddir)/simcrs/core/libsimcrs.la \
- $(top_builddir)/trademgen/core/libtrademgen.la
+libdsimcmd_la_LDFLAGS =
-
+#
#pkgincludedir = $(includedir)/@PACKAGE@/command
-#pkginclude_HEADERS = $(cmd_h_sources)
+#pkginclude_HEADERS = $(dsim_cmd_h_sources)
Modified: trunk/dsim/dsim/core/Makefile.am
===================================================================
--- trunk/dsim/dsim/core/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/dsim/core/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -21,8 +21,7 @@
$(top_builddir)/dsim/service/libdsimsvc.la
libdsim_la_LDFLAGS = \
$(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \
- $(BOOST_FILESYSTEM_LIB) \
- $(top_builddir)/stdair/libstdair.la \
+ $(BOOST_FILESYSTEM_LIB) $(STDAIR_LIBS) \
$(top_builddir)/airsched/core/libairsched.la \
$(top_builddir)/simcrs/core/libsimcrs.la \
$(top_builddir)/trademgen/core/libtrademgen.la \
Modified: trunk/dsim/dsim/factory/Makefile.am
===================================================================
--- trunk/dsim/dsim/factory/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/dsim/factory/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -3,11 +3,12 @@
include $(srcdir)/sources.mk
#
-noinst_LTLIBRARIES= libdsimfac.la
+noinst_LTLIBRARIES = libdsimfac.la
-libdsimfac_la_SOURCES= $(dsim_fac_h_sources) $(dsim_fac_cc_sources)
-libdsimfac_la_CXXFLAGS =
+libdsimfac_la_SOURCES = $(dsim_fac_h_sources) $(dsim_fac_cc_sources)
+libdsimfac_la_CXXFLAGS = $(STDAIR_CFLAGS)
+libdsimfac_la_LDFLAGS =
-
+#
#pkgincludedir = $(includedir)/@PACKAGE@/factory
-#pkginclude_HEADERS = $(fac_h_sources)
+#pkginclude_HEADERS = $(dsim_fac_h_sources)
Modified: trunk/dsim/dsim/service/Makefile.am
===================================================================
--- trunk/dsim/dsim/service/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/dsim/service/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -1,4 +1,4 @@
-## dsim/command sub-directory
+## dsim/service sub-directory
include $(top_srcdir)/Makefile.common
include $(srcdir)/sources.mk
@@ -6,8 +6,9 @@
noinst_LTLIBRARIES = libdsimsvc.la
libdsimsvc_la_SOURCES = $(dsim_svc_h_sources) $(dsim_svc_cc_sources)
-libdsimsvc_la_CXXFLAGS = $(BOOST_CFLAGS)
+libdsimsvc_la_CXXFLAGS = $(BOOST_CFLAGS) $(STDAIR_CFLAGS)
+libdsimsvc_la_LDFLAGS =
-
+#
#pkgincludedir = $(includedir)/@PACKAGE@/service
-#pkginclude_HEADERS = $(svc_h_sources)
+#pkginclude_HEADERS = $(dsim_svc_h_sources)
Property changes on: trunk/dsim/test
___________________________________________________________________
Modified: svn:externals
- samples https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/test/samples
stdair https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/test/stdair
airsched https://air-sched.svn.sourceforge.net/svnroot/air-sched/trunk/airsched/test/airsched
airrac https://airrac.svn.sourceforge.net/svnroot/airrac/trunk/airrac/test/airrac
avlcal https://avlcal.svn.sourceforge.net/svnroot/avlcal/trunk/avlcal/test/avlcal
simfqt https://simfqt.svn.sourceforge.net/svnroot/simfqt/trunk/simfqt/test/simfqt
airinv https://airinv.svn.sourceforge.net/svnroot/airinv/trunk/airinv/test/airinv
rmol https://rmol.svn.sourceforge.net/svnroot/rmol/trunk/rmol/test/rmol
simcrs https://simcrs.svn.sourceforge.net/svnroot/simcrs/trunk/simcrs/test/simcrs
trademgen https://trademgen.svn.sourceforge.net/svnroot/trademgen/trunk/trademgen/test/trademgen
travelccm https://travel-ccm.svn.sourceforge.net/svnroot/travel-ccm/trunk/travelccm/test/travelccm
+ samples https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/test/samples
airsched https://air-sched.svn.sourceforge.net/svnroot/air-sched/trunk/airsched/test/airsched
airrac https://airrac.svn.sourceforge.net/svnroot/airrac/trunk/airrac/test/airrac
avlcal https://avlcal.svn.sourceforge.net/svnroot/avlcal/trunk/avlcal/test/avlcal
simfqt https://simfqt.svn.sourceforge.net/svnroot/simfqt/trunk/simfqt/test/simfqt
airinv https://airinv.svn.sourceforge.net/svnroot/airinv/trunk/airinv/test/airinv
rmol https://rmol.svn.sourceforge.net/svnroot/rmol/trunk/rmol/test/rmol
simcrs https://simcrs.svn.sourceforge.net/svnroot/simcrs/trunk/simcrs/test/simcrs
trademgen https://trademgen.svn.sourceforge.net/svnroot/trademgen/trunk/trademgen/test/trademgen
travelccm https://travel-ccm.svn.sourceforge.net/svnroot/travel-ccm/trunk/travelccm/test/travelccm
Modified: trunk/dsim/test/Makefile.am
===================================================================
--- trunk/dsim/test/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/test/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -5,7 +5,7 @@
##
SUBDIRS = boost samples \
- stdair trademgen airsched airrac rmol airinv avlcal simfqt simcrs \
+ trademgen airsched airrac rmol airinv avlcal simfqt simcrs \
travelccm dsim
EXTRA_DIST =
Modified: trunk/dsim/test/dsim/Makefile.am
===================================================================
--- trunk/dsim/test/dsim/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
+++ trunk/dsim/test/dsim/Makefile.am 2010-09-07 11:30:40 UTC (rev 124)
@@ -14,10 +14,8 @@
XFAIL_TESTS = #
SimulationTestSuite_SOURCES = SimulationTestSuite.hpp SimulationTestSuite.cpp
-SimulationTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS)
+SimulationTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS) $(STDAIR_CFLAGS)
SimulationTestSuite_LDADD =
SimulationTestSuite_LDFLAGS = \
- $(BOOST_LIBS) $(CPPUNIT_LIBS) \
- $(top_builddir)/extracppunit/libextracppunit.la \
- $(top_builddir)/stdair/libstdair.la \
- $(top_builddir)/dsim/core/libdsim.la
+ $(BOOST_LIBS) $(CPPUNIT_LIBS) $(STDAIR_LIBS) $(EXTRACC_LIBS) \
+ $(top_builddir)/dsim/core/libdsim.la
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cla...@us...> - 2010-09-06 16:05:57
|
Revision: 123
http://dsim.svn.sourceforge.net/dsim/?rev=123&view=rev
Author: clacombe
Date: 2010-09-06 16:05:51 +0000 (Mon, 06 Sep 2010)
Log Message:
-----------
[Config] keep stdair directory for the lib creation only
Modified Paths:
--------------
trunk/dsim/configure.ac
trunk/dsim/doc/Makefile.am
trunk/dsim/dsim/Makefile.am
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2010-09-06 15:56:17 UTC (rev 122)
+++ trunk/dsim/configure.ac 2010-09-06 16:05:51 UTC (rev 123)
@@ -388,7 +388,6 @@
stdair/command/Makefile
stdair/config/Makefile
stdair/service/Makefile
- stdair/batches/Makefile
trademgen/Makefile
trademgen/basic/Makefile
trademgen/bom/Makefile
Modified: trunk/dsim/doc/Makefile.am
===================================================================
--- trunk/dsim/doc/Makefile.am 2010-09-06 15:56:17 UTC (rev 122)
+++ trunk/dsim/doc/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
@@ -10,7 +10,6 @@
include $(top_srcdir)/stdair/command/sources.mk
include $(top_srcdir)/stdair/service/sources.mk
include $(top_srcdir)/stdair/sources.mk
-include $(top_srcdir)/stdair/batches/sources.mk
# TraDemGen
#include $(top_srcdir)/trademgen/basic/sources.mk
#include $(top_srcdir)/trademgen/bom/sources.mk
Modified: trunk/dsim/dsim/Makefile.am
===================================================================
--- trunk/dsim/dsim/Makefile.am 2010-09-06 15:56:17 UTC (rev 122)
+++ trunk/dsim/dsim/Makefile.am 2010-09-06 16:05:51 UTC (rev 123)
@@ -6,7 +6,7 @@
MAINTAINERCLEANFILES = Makefile.in
-SUBDIRS = basic bom factory command service config batches
+SUBDIRS = basic bom factory command service config
EXTRA_DIST = config_msvc.h
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cla...@us...> - 2010-09-06 15:56:25
|
Revision: 122
http://dsim.svn.sourceforge.net/dsim/?rev=122&view=rev
Author: clacombe
Date: 2010-09-06 15:56:17 +0000 (Mon, 06 Sep 2010)
Log Message:
-----------
[Config] keep stdair directory for the lib creation only
Modified Paths:
--------------
trunk/dsim/configure.ac
trunk/dsim/doc/Makefile.am
trunk/dsim/dsim/Makefile.am
trunk/dsim/dsim/core/Makefile.am
trunk/dsim/test/boost/mpi/log_server/Makefile.am
trunk/dsim/test/dsim/Makefile.am
trunk/dsim/test/master_slave/Makefile.am
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2010-08-30 12:58:03 UTC (rev 121)
+++ trunk/dsim/configure.ac 2010-09-06 15:56:17 UTC (rev 122)
@@ -388,7 +388,6 @@
stdair/command/Makefile
stdair/config/Makefile
stdair/service/Makefile
- stdair/core/Makefile
stdair/batches/Makefile
trademgen/Makefile
trademgen/basic/Makefile
Modified: trunk/dsim/doc/Makefile.am
===================================================================
--- trunk/dsim/doc/Makefile.am 2010-08-30 12:58:03 UTC (rev 121)
+++ trunk/dsim/doc/Makefile.am 2010-09-06 15:56:17 UTC (rev 122)
@@ -9,7 +9,7 @@
include $(top_srcdir)/stdair/dbadaptor/sources.mk
include $(top_srcdir)/stdair/command/sources.mk
include $(top_srcdir)/stdair/service/sources.mk
-include $(top_srcdir)/stdair/core/sources.mk
+include $(top_srcdir)/stdair/sources.mk
include $(top_srcdir)/stdair/batches/sources.mk
# TraDemGen
#include $(top_srcdir)/trademgen/basic/sources.mk
Modified: trunk/dsim/dsim/Makefile.am
===================================================================
--- trunk/dsim/dsim/Makefile.am 2010-08-30 12:58:03 UTC (rev 121)
+++ trunk/dsim/dsim/Makefile.am 2010-09-06 15:56:17 UTC (rev 122)
@@ -6,7 +6,7 @@
MAINTAINERCLEANFILES = Makefile.in
-SUBDIRS = basic bom factory command service core config batches
+SUBDIRS = basic bom factory command service config batches
EXTRA_DIST = config_msvc.h
Modified: trunk/dsim/dsim/core/Makefile.am
===================================================================
--- trunk/dsim/dsim/core/Makefile.am 2010-08-30 12:58:03 UTC (rev 121)
+++ trunk/dsim/dsim/core/Makefile.am 2010-09-06 15:56:17 UTC (rev 122)
@@ -22,7 +22,7 @@
libdsim_la_LDFLAGS = \
$(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \
$(BOOST_FILESYSTEM_LIB) \
- $(top_builddir)/stdair/core/libstdair.la \
+ $(top_builddir)/stdair/libstdair.la \
$(top_builddir)/airsched/core/libairsched.la \
$(top_builddir)/simcrs/core/libsimcrs.la \
$(top_builddir)/trademgen/core/libtrademgen.la \
Modified: trunk/dsim/test/boost/mpi/log_server/Makefile.am
===================================================================
--- trunk/dsim/test/boost/mpi/log_server/Makefile.am 2010-08-30 12:58:03 UTC (rev 121)
+++ trunk/dsim/test/boost/mpi/log_server/Makefile.am 2010-09-06 15:56:17 UTC (rev 122)
@@ -15,7 +15,7 @@
log_server_SOURCES = log_server.cpp
log_server_CXXFLAGS = $(BOOST_CFLAGS) $(MPIGEN_CFLAGS)
log_server_LDFLAGS = $(BOOST_LIBS) $(BOOST_MPI_LIB) \
- $(top_builddir)/stdair/core/libstdair.la \
+ $(top_builddir)/stdair/libstdair.la \
$(top_builddir)/airsched/core/libairsched.la
#
Modified: trunk/dsim/test/dsim/Makefile.am
===================================================================
--- trunk/dsim/test/dsim/Makefile.am 2010-08-30 12:58:03 UTC (rev 121)
+++ trunk/dsim/test/dsim/Makefile.am 2010-09-06 15:56:17 UTC (rev 122)
@@ -19,5 +19,5 @@
SimulationTestSuite_LDFLAGS = \
$(BOOST_LIBS) $(CPPUNIT_LIBS) \
$(top_builddir)/extracppunit/libextracppunit.la \
- $(top_builddir)/stdair/core/libstdair.la \
+ $(top_builddir)/stdair/libstdair.la \
$(top_builddir)/dsim/core/libdsim.la
Modified: trunk/dsim/test/master_slave/Makefile.am
===================================================================
--- trunk/dsim/test/master_slave/Makefile.am 2010-08-30 12:58:03 UTC (rev 121)
+++ trunk/dsim/test/master_slave/Makefile.am 2010-09-06 15:56:17 UTC (rev 122)
@@ -13,7 +13,7 @@
master_CXXFLAGS = $(BOOST_CFLAGS) $(MPIGEN_CFLAGS)
master_LDADD =
master_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_LIBS) $(BOOST_MPI_LIB) \
- $(top_builddir)/stdair/core/libstdair.la \
+ $(top_builddir)/stdair/libstdair.la \
$(top_builddir)/airsched/core/libairsched.la
@@ -21,7 +21,7 @@
slave_CXXFLAGS = $(BOOST_CFLAGS) $(MPIGEN_CFLAGS)
slave_LDADD =
slave_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_LIBS) $(BOOST_MPI_LIB) \
- $(top_builddir)/stdair/core/libstdair.la \
+ $(top_builddir)/stdair/libstdair.la \
$(top_builddir)/airsched/core/libairsched.la
@@ -29,5 +29,5 @@
log_server_CXXFLAGS = $(BOOST_CFLAGS) $(MPIGEN_CFLAGS)
log_server_LDADD =
log_server_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_LIBS) $(BOOST_MPI_LIB) \
- $(top_builddir)/stdair/core/libstdair.la \
+ $(top_builddir)/stdair/libstdair.la \
$(top_builddir)/airsched/core/libairsched.la
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-08-30 12:58:09
|
Revision: 121
http://dsim.svn.sourceforge.net/dsim/?rev=121&view=rev
Author: denis_arnaud
Date: 2010-08-30 12:58:03 +0000 (Mon, 30 Aug 2010)
Log Message:
-----------
[Test] Suppressed unused source code file.
Modified Paths:
--------------
trunk/dsim/test/dsim/Makefile.am
trunk/dsim/test/dsim/SimulationTestSuite.cpp
Removed Paths:
-------------
trunk/dsim/test/dsim/simulate.cpp
Property Changed:
----------------
trunk/dsim/test/dsim/
Property changes on: trunk/dsim/test/dsim
___________________________________________________________________
Modified: svn:ignore
- .deps
.libs
Makefile.in
Makefile
simulate
simulate.log
SimulationTestSuite
SimulationTestSuite_results.xml
+ .deps
.libs
Makefile.in
Makefile
SimulationTestSuite
SimulationTestSuite_results.xml
SimulationTestSuite.log
Modified: trunk/dsim/test/dsim/Makefile.am
===================================================================
--- trunk/dsim/test/dsim/Makefile.am 2010-08-20 14:56:17 UTC (rev 120)
+++ trunk/dsim/test/dsim/Makefile.am 2010-08-30 12:58:03 UTC (rev 121)
@@ -21,11 +21,3 @@
$(top_builddir)/extracppunit/libextracppunit.la \
$(top_builddir)/stdair/core/libstdair.la \
$(top_builddir)/dsim/core/libdsim.la
-
-#simulate_SOURCES = simulate.cpp
-#simulate_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS)
-#simulate_LDADD =
-#simulate_LDFLAGS = $(BOOST_LIBS) \
-# $(top_builddir)/stdair/core/libstdair.la \
-# $(top_builddir)/dsim/core/libdsim.la
-
Modified: trunk/dsim/test/dsim/SimulationTestSuite.cpp
===================================================================
--- trunk/dsim/test/dsim/SimulationTestSuite.cpp 2010-08-20 14:56:17 UTC (rev 120)
+++ trunk/dsim/test/dsim/SimulationTestSuite.cpp 2010-08-30 12:58:03 UTC (rev 121)
@@ -29,7 +29,7 @@
const stdair::Filename_T lDemandInputFilename ("../samples/demand01.csv");
// Output log File
- const std::string lLogFilename ("simulate.log");
+ const std::string lLogFilename ("SimulationTestSuite.log");
// Set the log parameters
std::ofstream logOutputFile;
Deleted: trunk/dsim/test/dsim/simulate.cpp
===================================================================
--- trunk/dsim/test/dsim/simulate.cpp 2010-08-20 14:56:17 UTC (rev 120)
+++ trunk/dsim/test/dsim/simulate.cpp 2010-08-30 12:58:03 UTC (rev 121)
@@ -1,59 +0,0 @@
-// STL
-#include <cassert>
-#include <iostream>
-#include <sstream>
-#include <fstream>
-#include <string>
-// StdAir
-#include <stdair/STDAIR_Types.hpp>
-#include <stdair/basic/BasLogParams.hpp>
-#include <stdair/basic/BasDBParams.hpp>
-// DSIM
-#include <dsim/DSIM_Service.hpp>
-#include <dsim/config/dsim-paths.hpp>
-
-// ///////// M A I N ////////////
-int main (int argc, char* argv[]) {
-
- try {
-
- // Schedule input file name
- const std::string lScheduleInputFilename ("../samples/schedule01.csv");
-
- // Demand input file name
- const stdair::Filename_T lDemandInputFilename ("../samples/demand01.csv");
-
- // Output log File
- const std::string lLogFilename ("simulate.log");
-
- // Set the log parameters
- std::ofstream logOutputFile;
- // Open and clean the log outputfile
- logOutputFile.open (lLogFilename.c_str());
- logOutputFile.clear();
-
- // Initialise the simulation context
- const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
- const stdair::BasDBParams lDBParams ("dsim", "dsim", "localhost", "3306",
- "dsim");
- DSIM::DSIM_Service dsimService (lLogParams, lDBParams,
- lScheduleInputFilename,
- lDemandInputFilename);
- // Perform a simulation
- dsimService.simulate();
-
- } 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;
- }
-
- return 0;
-}
-
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: <den...@us...> - 2010-08-20 10:41:33
|
Revision: 119
http://dsim.svn.sourceforge.net/dsim/?rev=119&view=rev
Author: denis_arnaud
Date: 2010-08-20 10:41:24 +0000 (Fri, 20 Aug 2010)
Log Message:
-----------
[Build] Added a missing tab in the Makefile.
Modified Paths:
--------------
trunk/dsim/Makefile.am
Modified: trunk/dsim/Makefile.am
===================================================================
--- trunk/dsim/Makefile.am 2010-07-29 13:55:55 UTC (rev 118)
+++ trunk/dsim/Makefile.am 2010-08-20 10:41:24 UTC (rev 119)
@@ -53,7 +53,7 @@
snapshot-src:
- $(MAKE) dist distdir=@PACKAGE_TARNAME@-`date +"%Y%m%d"`
+ $(MAKE) dist distdir=@PACKAGE_TARNAME@-`date +"%Y%m%d"`
snapshot-html:
$(MAKE) -C doc dist-html html_tarname=@PACKAGE_TARNAME@-doc-`date +"%Y%m%d"`
@@ -74,3 +74,4 @@
upload-tex: dist-tex
@UPLOAD_COMMAND@ @PACKAGE_TARNAME@-tex-@VERSION@.tar.gz \
@PACKAGE_TARNAME@-tex-@VERSION@.tar.bz2
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-07-29 13:56:01
|
Revision: 118
http://dsim.svn.sourceforge.net/dsim/?rev=118&view=rev
Author: denis_arnaud
Date: 2010-07-29 13:55:55 +0000 (Thu, 29 Jul 2010)
Log Message:
-----------
[Alpha dev] Comestic changes in the Boost.ASIO log server.
Modified Paths:
--------------
trunk/dsim/test/boost/asio/log_server/Makefile.am
trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp
trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp
trunk/dsim/test/boost/asio/log_server/tinyLog.cpp
trunk/dsim/test/boost/asio/log_server/tinyLog.hpp
Property Changed:
----------------
trunk/dsim/test/boost/asio/log_server/
Property changes on: trunk/dsim/test/boost/asio/log_server
___________________________________________________________________
Modified: svn:ignore
- .deps
.libs
Makefile.in
Makefile
client
server
server.log
+ .deps
.libs
Makefile.in
Makefile
client
server
server.log
synServer
asynServer
Modified: trunk/dsim/test/boost/asio/log_server/Makefile.am
===================================================================
--- trunk/dsim/test/boost/asio/log_server/Makefile.am 2010-07-29 12:06:21 UTC (rev 117)
+++ trunk/dsim/test/boost/asio/log_server/Makefile.am 2010-07-29 13:55:55 UTC (rev 118)
@@ -7,7 +7,7 @@
check_PROGRAMS = client synServer asynServer
-client_SOURCES = client.cpp
+client_SOURCES = client.cpp networkFunctions.cpp
client_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
client_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
client_LDADD =
Modified: trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp 2010-07-29 12:06:21 UTC (rev 117)
+++ trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp 2010-07-29 13:55:55 UTC (rev 118)
@@ -1,19 +1,27 @@
+// STL
+#include <iostream>
+#include <string>
+//
+#include <netdb.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+//
#include "networkFunctions.hpp"
-int service_to_port(std::string s){
+int service_to_port (const std::string& s) {
servent* a = getservbyname(s.c_str(), NULL);
endservent();
- if (a!= NULL)
+ if (a!= NULL) {
return htons(a -> s_port);
- else{
+ } else {
std::cout << "No service with name:" << s << " is found" << std::endl;
return -1;
}
}
-std::string port_to_service(int p){
+std::string port_to_service (const int p){
servent* a = getservbyport(htons(p), NULL);
endservent();
@@ -25,7 +33,7 @@
}
}
-std::string ip_to_hostname(std::string s){
+std::string ip_to_hostname (const std::string& s){
struct hostent *he;
struct in_addr ipv4addr;
inet_pton(AF_INET, s.c_str(), &ipv4addr);
@@ -47,4 +55,4 @@
// string add="173.163.134.217";
// std::cout << ip_to_hostname(add) << std::endl;
// return 0;
-// }
\ No newline at end of file
+// }
Modified: trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp 2010-07-29 12:06:21 UTC (rev 117)
+++ trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp 2010-07-29 13:55:55 UTC (rev 118)
@@ -1,28 +1,25 @@
-#ifndef __NETWORKFUNCTIONS__
-#define __NETWORKFUNCTIONS__
+#ifndef __DSIM_NETWORKFUNCTIONS__
+#define __DSIM_NETWORKFUNCTIONS__
-#include <iostream>
-#include <string>
+/**
+ * \brief Return the port corresponding to service name s using /etc/services
+ * <br>For ex: aria returns 2624
+ */
+int service_to_port (const std::string&);
-#include <netdb.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-/* return the port corresponding to service name s using /etc/services
-* For ex: aria returns 2624
-*/
-int service_to_port(std::string s);
+/**
+ * \brief contrary of service_to_port
+ * <br>ex: 22 -> ssh
+ */
+std::string port_to_service (const int p);
+/**
+ * \brief Ex: Takes 172.16.134.217 , returns nceorilnx03.nce.amadeus.net
+ */
+std::string ip_to_hostname (const std::string& s);
-/* contrary of service_to_port
-* ex: 22 -> ssh
-*/
-std::string port_to_service(int p);
-/* Ex: Takes 172.16.134.217 , returns nceorilnx03.nce.amadeus.net*/
-std::string ip_to_hostname(std::string s);
-
-
-#endif
\ No newline at end of file
+#endif // __DSIM_NETWORKFUNCTIONS__
Modified: trunk/dsim/test/boost/asio/log_server/tinyLog.cpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/tinyLog.cpp 2010-07-29 12:06:21 UTC (rev 117)
+++ trunk/dsim/test/boost/asio/log_server/tinyLog.cpp 2010-07-29 13:55:55 UTC (rev 118)
@@ -1,8 +1,19 @@
+
+// String, stream functions
+#include <string>
+#include <fstream>
+// Boost.ASIO
+#include <boost/asio.hpp>
+#include <boost/array.hpp>
+// Sleep funtion
+#include <unistd.h>
+//Some network functions
+#include "networkFunctions.cpp"
+//
#include "tinyLog.hpp"
-
-
-void send_file (std::string lServerName, int lServerPort, std::string filename){
+void send_file (const std::string& lServerName, const int lServerPort,
+ const std::string& filename) {
using namespace std;
int attempt=0; //Nb of attemps to connect to server
// testing if file exists
@@ -66,8 +77,8 @@
}
}
-
-void send_string(std::string lServerName, int lServerPort, std::string buffer){
+void send_string (const std::string& lServerName, const int lServerPort,
+ const std::string& buffer) {
using namespace std;
int attempt=0; //Nb of attemps to connect to server
Modified: trunk/dsim/test/boost/asio/log_server/tinyLog.hpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/tinyLog.hpp 2010-07-29 12:06:21 UTC (rev 117)
+++ trunk/dsim/test/boost/asio/log_server/tinyLog.hpp 2010-07-29 13:55:55 UTC (rev 118)
@@ -1,31 +1,26 @@
-#ifndef __TINYLOG__
-#define __TINYLOG__
+#ifndef __DSIM_TINYLOG__
+#define __DSIM_TINYLOG__
// String, stream functions
-#include <iostream>
#include <string>
-#include <fstream>
-// Boost.ASIO
-#include <boost/asio.hpp>
-#include <boost/array.hpp>
-// Sleep funtion
-#include <unistd.h>
-//Some network functions
-#include "networkFunctions.cpp"
-/* Send filename's content to server
-* lServerName: name of server,ex: localhost
-* lServerPort: listening port on server
-* filename: file to send to server
+/**
+ * \brief Send filename's content to server
+ * \param[in] lServerName: name of server,ex: localhost
+ * \param[in] lServerPort: listening port on server
+ * \param[in] filename: file to send to server
*/
-void send_file (std::string lServerName, int lServerPort, std::string filename);
+void send_file (const std::string& lServerName, const int lServerPort,
+ const std::string& filename);
-/* Send string buffer to server
-* lServerName: name of server,ex: localhost
-* lServerPort: listening port on server
-* filename: file to send to server
+/**
+ * \brief Send string buffer to server
+ * \param[in] lServerName: name of server,ex: localhost
+ * \param[in] lServerPort: listening port on server
+ * \param[in] filename: file to send to server
*/
-void send_string(std::string lServerName, int lServerPort, std::string buffer);
+void send_string (const std::string& lServerName, const int lServerPort,
+ const std::string& buffer);
-#endif
\ No newline at end of file
+#endif // __DSIM_TINYLOG__
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sng...@us...> - 2010-07-29 12:06:27
|
Revision: 117
http://dsim.svn.sourceforge.net/dsim/?rev=117&view=rev
Author: snguyenkim
Date: 2010-07-29 12:06:21 +0000 (Thu, 29 Jul 2010)
Log Message:
-----------
tinyLog library
Modified Paths:
--------------
trunk/dsim/test/boost/asio/log_server/client.cpp
trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp
Added Paths:
-----------
trunk/dsim/test/boost/asio/log_server/Makefile1
trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp
trunk/dsim/test/boost/asio/log_server/test.cpp
trunk/dsim/test/boost/asio/log_server/tinyLog.cpp
trunk/dsim/test/boost/asio/log_server/tinyLog.hpp
Added: trunk/dsim/test/boost/asio/log_server/Makefile1
===================================================================
--- trunk/dsim/test/boost/asio/log_server/Makefile1 (rev 0)
+++ trunk/dsim/test/boost/asio/log_server/Makefile1 2010-07-29 12:06:21 UTC (rev 117)
@@ -0,0 +1,12 @@
+CC=g++ -L/usr/lib/ -lboost_system -lboost_thread-mt -lboost_date_time -lboost_regex -lboost_serialization \
+ -lpthread -lc -lrt -licuuc -licui18n -licudata
+all: client test
+
+client: client.cpp
+ $(CC) client.cpp -L. -lNetworkFunctions -o client
+
+test: test.cpp
+ g++ test.cpp -L. -ltinyLog -o test
+
+clean: client test
+ rm -fv client test
Modified: trunk/dsim/test/boost/asio/log_server/client.cpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/client.cpp 2010-07-29 10:11:24 UTC (rev 116)
+++ trunk/dsim/test/boost/asio/log_server/client.cpp 2010-07-29 12:06:21 UTC (rev 117)
@@ -9,7 +9,7 @@
// Sleep funtion
#include <unistd.h>
//Some network functions
-#include "networkFunctions.cpp"
+#include "networkFunctions.hpp"
std::string lServerName = "localhost";
Modified: trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp 2010-07-29 10:11:24 UTC (rev 116)
+++ trunk/dsim/test/boost/asio/log_server/networkFunctions.cpp 2010-07-29 12:06:21 UTC (rev 117)
@@ -1,64 +1,50 @@
-// STL
-#include <fstream>
-#include <iostream>
-#include <string>
-#include <ctime>
-#include <unistd.h>
+#include "networkFunctions.hpp"
-#include <netdb.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-using namespace std;
-/* return the port corresponding to service name s using /etc/services
-For ex: aria returns 2624
-*/
-int service_to_port(string s){
+int service_to_port(std::string s){
servent* a = getservbyname(s.c_str(), NULL);
endservent();
if (a!= NULL)
return htons(a -> s_port);
else{
- cout << "No service with name:" << s << " is found" << endl;
+ std::cout << "No service with name:" << s << " is found" << std::endl;
return -1;
}
}
-string port_to_service(int p){
+
+std::string port_to_service(int p){
servent* a = getservbyport(htons(p), NULL);
endservent();
if (a!= NULL)
return a -> s_name;
else{
- cout << "No service with port:" << p << " is found" << endl;
+ std::cout << "No service with port:" << p << " is found" << std::endl;
return "";
}
}
-/* Ex: Takes 172.16.134.217 , returns nceorilnx03.nce.amadeus.net*/
-string ip_to_hostname(string s){
+
+std::string ip_to_hostname(std::string s){
struct hostent *he;
struct in_addr ipv4addr;
inet_pton(AF_INET, s.c_str(), &ipv4addr);
he = gethostbyaddr(&ipv4addr, sizeof ipv4addr, AF_INET);
- cout << "finish searching\n";
+ std::cout << "finish searching\n";
if (he!= NULL)
return he->h_name;
else{
- cout << "Can't find hostname corresponding to: " << s << endl;
+ std::cout << "Can't find hostname corresponding to: " << s << std::endl;
return "";
}
-
-
-
-
}
+
// int main(){
-// cout << service_to_port("ariaa") << endl;
-// cout << port_to_service(22) << endl;
+// std::cout << service_to_port("ariaa") << std::endl;
+// std::cout << port_to_service(22) << std::endl;
//
// // string add="172.16.134.217";
// string add="173.163.134.217";
-// cout << ip_to_hostname(add) << endl;
+// std::cout << ip_to_hostname(add) << std::endl;
// return 0;
// }
\ No newline at end of file
Added: trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp (rev 0)
+++ trunk/dsim/test/boost/asio/log_server/networkFunctions.hpp 2010-07-29 12:06:21 UTC (rev 117)
@@ -0,0 +1,28 @@
+
+#ifndef __NETWORKFUNCTIONS__
+#define __NETWORKFUNCTIONS__
+
+
+#include <iostream>
+#include <string>
+
+#include <netdb.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+
+/* return the port corresponding to service name s using /etc/services
+* For ex: aria returns 2624
+*/
+int service_to_port(std::string s);
+
+
+/* contrary of service_to_port
+* ex: 22 -> ssh
+*/
+std::string port_to_service(int p);
+
+/* Ex: Takes 172.16.134.217 , returns nceorilnx03.nce.amadeus.net*/
+std::string ip_to_hostname(std::string s);
+
+
+#endif
\ No newline at end of file
Added: trunk/dsim/test/boost/asio/log_server/test.cpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/test.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/log_server/test.cpp 2010-07-29 12:06:21 UTC (rev 117)
@@ -0,0 +1,5 @@
+#include "tinyLog.hpp"
+
+int main(){
+ send_string("localhost", 2624, "test");
+}
\ No newline at end of file
Added: trunk/dsim/test/boost/asio/log_server/tinyLog.cpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/tinyLog.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/log_server/tinyLog.cpp 2010-07-29 12:06:21 UTC (rev 117)
@@ -0,0 +1,118 @@
+#include "tinyLog.hpp"
+
+
+
+void send_file (std::string lServerName, int lServerPort, std::string filename){
+ using namespace std;
+ int attempt=0; //Nb of attemps to connect to server
+ // testing if file exists
+ fstream fst (filename.c_str(), ios::in);
+ if (fst == NULL){
+ cout << filename << " does not exist !" << endl;
+ exit(1);
+ }
+ std::string lServiceName= port_to_service(lServerPort);
+ // try to get a socket (communication canal)
+ while(1){
+
+ boost::asio::io_service lIOService;
+ boost::asio::ip::tcp::socket lSocket (lIOService);
+ boost::asio::ip::tcp::resolver lResolver (lIOService);
+ boost::asio::ip::tcp::resolver::query lQuery (lServerName, lServiceName);
+
+ boost::asio::ip::tcp::resolver::iterator lEnd;
+ boost::system::error_code lError = boost::asio::error::host_not_found;
+ try {
+ boost::asio::ip::tcp::resolver::iterator itEndPoint =lResolver.resolve (lQuery);
+
+ while (lError && itEndPoint != lEnd) {
+ const boost::asio::ip::tcp::endpoint lEndPoint = *itEndPoint;
+
+ lSocket.close();
+ lSocket.connect (lEndPoint, lError);
+ ++itEndPoint;
+ }
+
+ if (lError) {
+ std::cout << "Cannot find corresponding endpoint at:" << attempt << " attempts" << std::endl;
+ attempt ++;
+ sleep(2); // not good to be too active
+ continue;
+ throw boost::system::system_error (lError);
+ }
+ assert (!lError);
+// cout << "Socket is opened !\n";
+
+ // File sending part
+ char * buffer; //contains file's content
+
+ // get length of file:
+ fst.seekg (0, ios::end);
+ int length = fst.tellg();
+ fst.seekg (0, ios::beg);
+
+ cout << "file length:" << length << endl;
+ buffer = new char[length];
+ fst.read(buffer,length);
+
+ boost::system::error_code lIgnoredError;
+ boost::asio::write (lSocket, boost::asio::buffer (buffer),boost::asio::transfer_all(), lIgnoredError);
+
+ cout << "Transfer finished" << endl;
+ return;
+ } catch (std::exception& lException) {
+ std::cerr << lException.what() << std::endl;
+ }
+ }
+}
+
+
+void send_string(std::string lServerName, int lServerPort, std::string buffer){
+ using namespace std;
+ int attempt=0; //Nb of attemps to connect to server
+
+ std::string lServiceName= port_to_service(lServerPort);
+ // try to get a socket (communication canal)
+ while(1){
+
+ boost::asio::io_service lIOService;
+ boost::asio::ip::tcp::socket lSocket (lIOService);
+ boost::asio::ip::tcp::resolver lResolver (lIOService);
+ boost::asio::ip::tcp::resolver::query lQuery (lServerName, lServiceName);
+
+ boost::asio::ip::tcp::resolver::iterator lEnd;
+ boost::system::error_code lError = boost::asio::error::host_not_found;
+ try {
+ boost::asio::ip::tcp::resolver::iterator itEndPoint =lResolver.resolve (lQuery);
+
+ while (lError && itEndPoint != lEnd) {
+ const boost::asio::ip::tcp::endpoint lEndPoint = *itEndPoint;
+
+ lSocket.close();
+ lSocket.connect (lEndPoint, lError);
+ ++itEndPoint;
+ }
+
+ if (lError) {
+ std::cout << "Cannot find corresponding endpoint at:" << attempt << " attempts" << std::endl;
+ attempt ++;
+ sleep(2); // not good to be too active
+ continue;
+ throw boost::system::system_error (lError);
+ }
+ assert (!lError);
+// cout << "Socket is opened !\n";
+
+ boost::system::error_code lIgnoredError;
+ boost::asio::write (lSocket, boost::asio::buffer (buffer),boost::asio::transfer_all(), lIgnoredError);
+
+ cout << "Transfer finished" << endl;
+ return;
+ } catch (std::exception& lException) {
+ std::cerr << lException.what() << std::endl;
+ }
+ }
+}
+
+
+
Added: trunk/dsim/test/boost/asio/log_server/tinyLog.hpp
===================================================================
--- trunk/dsim/test/boost/asio/log_server/tinyLog.hpp (rev 0)
+++ trunk/dsim/test/boost/asio/log_server/tinyLog.hpp 2010-07-29 12:06:21 UTC (rev 117)
@@ -0,0 +1,31 @@
+#ifndef __TINYLOG__
+#define __TINYLOG__
+
+// String, stream functions
+#include <iostream>
+#include <string>
+#include <fstream>
+// Boost.ASIO
+#include <boost/asio.hpp>
+#include <boost/array.hpp>
+// Sleep funtion
+#include <unistd.h>
+//Some network functions
+#include "networkFunctions.cpp"
+
+/* Send filename's content to server
+* lServerName: name of server,ex: localhost
+* lServerPort: listening port on server
+* filename: file to send to server
+*/
+void send_file (std::string lServerName, int lServerPort, std::string filename);
+
+/* Send string buffer to server
+* lServerName: name of server,ex: localhost
+* lServerPort: listening port on server
+* filename: file to send to server
+*/
+void send_string(std::string lServerName, int lServerPort, std::string buffer);
+
+
+#endif
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|