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: <den...@us...> - 2009-12-31 11:15:08
|
Revision: 41
http://dsim.svn.sourceforge.net/dsim/?rev=41&view=rev
Author: denis_arnaud
Date: 2009-12-31 11:14:56 +0000 (Thu, 31 Dec 2009)
Log Message:
-----------
[Struct] Added SimFQT and AvlCal projects.
Modified Paths:
--------------
trunk/dsim/Makefile.am
trunk/dsim/configure.ac
trunk/dsim/test/Makefile.am
Property Changed:
----------------
trunk/dsim/test/
Modified: trunk/dsim/Makefile.am
===================================================================
--- trunk/dsim/Makefile.am 2009-12-30 16:08:23 UTC (rev 40)
+++ trunk/dsim/Makefile.am 2009-12-31 11:14:56 UTC (rev 41)
@@ -24,8 +24,8 @@
EXTRA_DIST = @PACKAGE@.spec @PACKAGE@.m4 @PACKAGE@.pc Makefile.common
# Build in these directories:
-SUBDIRS = stdair trademgen airsched airinv simcrs rmol travelccm dsim \
- extracppunit $(TEST_DIR)
+SUBDIRS = stdair trademgen airsched rmol airinv avlcal simfqt simcrs travelccm \
+ dsim extracppunit $(TEST_DIR)
# Configuration helpers
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-30 16:08:23 UTC (rev 40)
+++ trunk/dsim/configure.ac 2009-12-31 11:14:56 UTC (rev 41)
@@ -426,6 +426,16 @@
airsched/config/Makefile
airsched/core/Makefile
airsched/batches/Makefile
+ rmol/Makefile
+ rmol/basic/Makefile
+ rmol/field/Makefile
+ rmol/bom/Makefile
+ rmol/factory/Makefile
+ rmol/command/Makefile
+ rmol/service/Makefile
+ rmol/config/Makefile
+ rmol/core/Makefile
+ rmol/batches/Makefile
airinv/Makefile
airinv/basic/Makefile
airinv/bom/Makefile
@@ -435,6 +445,24 @@
airinv/config/Makefile
airinv/core/Makefile
airinv/batches/Makefile
+ avlcal/Makefile
+ avlcal/basic/Makefile
+ avlcal/bom/Makefile
+ avlcal/factory/Makefile
+ avlcal/command/Makefile
+ avlcal/service/Makefile
+ avlcal/config/Makefile
+ avlcal/core/Makefile
+ avlcal/batches/Makefile
+ simfqt/Makefile
+ simfqt/basic/Makefile
+ simfqt/bom/Makefile
+ simfqt/factory/Makefile
+ simfqt/command/Makefile
+ simfqt/service/Makefile
+ simfqt/config/Makefile
+ simfqt/core/Makefile
+ simfqt/batches/Makefile
simcrs/Makefile
simcrs/basic/Makefile
simcrs/bom/Makefile
@@ -444,16 +472,6 @@
simcrs/config/Makefile
simcrs/core/Makefile
simcrs/batches/Makefile
- rmol/Makefile
- rmol/basic/Makefile
- rmol/field/Makefile
- rmol/bom/Makefile
- rmol/factory/Makefile
- rmol/command/Makefile
- rmol/service/Makefile
- rmol/config/Makefile
- rmol/core/Makefile
- rmol/batches/Makefile
travelccm/Makefile
travelccm/basic/Makefile
travelccm/bom/Makefile
@@ -489,8 +507,10 @@
test/stdair/Makefile
test/trademgen/Makefile
test/airsched/Makefile
+ test/rmol/Makefile
test/airinv/Makefile
- test/rmol/Makefile
+ test/avlcal/Makefile
+ test/simfqt/Makefile
test/simcrs/Makefile
test/travelccm/Makefile
test/dsim/Makefile
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
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
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
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 2009-12-30 16:08:23 UTC (rev 40)
+++ trunk/dsim/test/Makefile.am 2009-12-31 11:14:56 UTC (rev 41)
@@ -5,7 +5,7 @@
##
SUBDIRS = boost samples \
- stdair trademgen airsched airinv rmol simcrs travelccm dsim
+ stdair trademgen airsched rmol airinv avlcal simfqt simcrs travelccm dsim
EXTRA_DIST =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-30 16:08:30
|
Revision: 40
http://dsim.svn.sourceforge.net/dsim/?rev=40&view=rev
Author: denis_arnaud
Date: 2009-12-30 16:08:23 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[Struct] Added the Travel-CCM project.
Modified Paths:
--------------
trunk/dsim/Makefile.am
trunk/dsim/configure.ac
trunk/dsim/test/Makefile.am
Property Changed:
----------------
trunk/dsim/test/
Modified: trunk/dsim/Makefile.am
===================================================================
--- trunk/dsim/Makefile.am 2009-12-30 15:14:59 UTC (rev 39)
+++ trunk/dsim/Makefile.am 2009-12-30 16:08:23 UTC (rev 40)
@@ -21,11 +21,10 @@
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
-EXTRA_DIST =
+EXTRA_DIST = @PACKAGE@.spec @PACKAGE@.m4 @PACKAGE@.pc Makefile.common
# Build in these directories:
-SUBDIRS = stdair trademgen airsched airinv simcrs rmol dsim \
+SUBDIRS = stdair trademgen airsched airinv simcrs rmol travelccm dsim \
extracppunit $(TEST_DIR)
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-30 15:14:59 UTC (rev 39)
+++ trunk/dsim/configure.ac 2009-12-30 16:08:23 UTC (rev 40)
@@ -454,6 +454,15 @@
rmol/config/Makefile
rmol/core/Makefile
rmol/batches/Makefile
+ travelccm/Makefile
+ travelccm/basic/Makefile
+ travelccm/bom/Makefile
+ travelccm/factory/Makefile
+ travelccm/command/Makefile
+ travelccm/service/Makefile
+ travelccm/core/Makefile
+ travelccm/config/Makefile
+ travelccm/batches/Makefile
dsim/Makefile
dsim/basic/Makefile
dsim/bom/Makefile
@@ -483,6 +492,7 @@
test/airinv/Makefile
test/rmol/Makefile
test/simcrs/Makefile
+ test/travelccm/Makefile
test/dsim/Makefile
)
AC_OUTPUT
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
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
+ 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
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 2009-12-30 15:14:59 UTC (rev 39)
+++ trunk/dsim/test/Makefile.am 2009-12-30 16:08:23 UTC (rev 40)
@@ -4,7 +4,8 @@
MAINTAINERCLEANFILES = Makefile.in
##
-SUBDIRS = boost samples stdair trademgen airsched airinv rmol simcrs dsim
+SUBDIRS = boost samples \
+ stdair trademgen airsched airinv rmol simcrs travelccm dsim
EXTRA_DIST =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-30 15:15:08
|
Revision: 39
http://dsim.svn.sourceforge.net/dsim/?rev=39&view=rev
Author: denis_arnaud
Date: 2009-12-30 15:14:59 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[Test] Added the (external reference on the) samples directory.
Modified Paths:
--------------
trunk/dsim/configure.ac
trunk/dsim/test/Makefile.am
Removed Paths:
-------------
trunk/dsim/test/samples/
Property Changed:
----------------
trunk/dsim/test/
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-30 14:34:30 UTC (rev 38)
+++ trunk/dsim/configure.ac 2009-12-30 15:14:59 UTC (rev 39)
@@ -465,6 +465,7 @@
dsim/batches/Makefile
extracppunit/Makefile
test/Makefile
+ test/samples/Makefile
test/boost/Makefile
test/boost/accumulators/Makefile
test/boost/asio/Makefile
Property changes on: trunk/dsim/test
___________________________________________________________________
Modified: svn:externals
- 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
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
+ 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
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
Modified: trunk/dsim/test/Makefile.am
===================================================================
--- trunk/dsim/test/Makefile.am 2009-12-30 14:34:30 UTC (rev 38)
+++ trunk/dsim/test/Makefile.am 2009-12-30 15:14:59 UTC (rev 39)
@@ -4,7 +4,7 @@
MAINTAINERCLEANFILES = Makefile.in
##
-SUBDIRS = boost stdair trademgen airsched airinv rmol simcrs dsim
+SUBDIRS = boost samples stdair trademgen airsched airinv rmol simcrs dsim
EXTRA_DIST =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-30 14:34:37
|
Revision: 38
http://dsim.svn.sourceforge.net/dsim/?rev=38&view=rev
Author: denis_arnaud
Date: 2009-12-30 14:34:30 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[Test] Added missing dependencies for the delivery (as a tar-ball) of tests.
Modified Paths:
--------------
trunk/dsim/test/boost/Makefile.am
trunk/dsim/test/boost/mpi/Makefile.am
Modified: trunk/dsim/test/boost/Makefile.am
===================================================================
--- trunk/dsim/test/boost/Makefile.am 2009-12-30 14:25:05 UTC (rev 37)
+++ trunk/dsim/test/boost/Makefile.am 2009-12-30 14:34:30 UTC (rev 38)
@@ -1,9 +1,10 @@
## test/boost sub-directory
include $(top_srcdir)/Makefile.common
+#
+MAINTAINERCLEANFILES = Makefile.in
+
##
SUBDIRS = accumulators asio mpi mpl serialization signals spirit
-MAINTAINERCLEANFILES = Makefile.in
-
EXTRA_DIST =
Modified: trunk/dsim/test/boost/mpi/Makefile.am
===================================================================
--- trunk/dsim/test/boost/mpi/Makefile.am 2009-12-30 14:25:05 UTC (rev 37)
+++ trunk/dsim/test/boost/mpi/Makefile.am 2009-12-30 14:34:30 UTC (rev 38)
@@ -1,17 +1,26 @@
-## test/mpi sub-directory
+## test/boost/mpi sub-directory
include $(top_srcdir)/Makefile.common
MAINTAINERCLEANFILES = Makefile.in
+#
+SUBDIRS =
+
+EXTRA_DIST = pympi.py
+
+#
check_PROGRAMS = mpi_c mpi mpi_p2p
+
# mpi_c must be compiled with mpic++
# Note: mpic++/mpiCC is a wrapper around the MPI C++ compiler, and knows
# where MPI is installed. So, there is no need to specify any other
# CFLAGS or LDFLAGS at that stage.
-mpi_c: mpi_c.cpp
+mpi_c_SOURCES = mpi_c.cpp
+mpi_c: $(mpi_c_SOURCES)
mpic++ -o $@ $<
+#
mpi_SOURCES = mpi.cpp
mpi_CXXFLAGS = $(BOOST_CFLAGS) $(MPICH2_CFLAGS)
mpi_LDFLAGS = $(BOOST_LIBS) $(BOOST_MPI_LIB)
@@ -22,4 +31,3 @@
mpi_p2p_LDFLAGS = $(BOOST_LIBS) $(BOOST_MPI_LIB)
mpi_p2p_LDADD =
-EXTRA_DIST =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-30 14:25:15
|
Revision: 37
http://dsim.svn.sourceforge.net/dsim/?rev=37&view=rev
Author: denis_arnaud
Date: 2009-12-30 14:25:05 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[Struct] Added a dependency (as Subversion external references) on the TraDemGen project.
Modified Paths:
--------------
trunk/dsim/configure.ac
trunk/dsim/test/Makefile.am
Property Changed:
----------------
trunk/dsim/test/
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-30 11:19:01 UTC (rev 36)
+++ trunk/dsim/configure.ac 2009-12-30 14:25:05 UTC (rev 37)
@@ -477,6 +477,7 @@
test/boost/serialization/Makefile
test/boost/signals/Makefile
test/stdair/Makefile
+ test/trademgen/Makefile
test/airsched/Makefile
test/airinv/Makefile
test/rmol/Makefile
Property changes on: trunk/dsim/test
___________________________________________________________________
Modified: svn:externals
- 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
airinv https://rmol.svn.sourceforge.net/svnroot/airinv/trunk/airinv/test/airinv
rmol https://rmol.svn.sourceforge.net/svnroot/rmol/trunk/rmol/test/rmol
simcrs https://rmol.svn.sourceforge.net/svnroot/simcrs/trunk/simcrs/test/simcrs
+ 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
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
Modified: trunk/dsim/test/Makefile.am
===================================================================
--- trunk/dsim/test/Makefile.am 2009-12-30 11:19:01 UTC (rev 36)
+++ trunk/dsim/test/Makefile.am 2009-12-30 14:25:05 UTC (rev 37)
@@ -4,7 +4,7 @@
MAINTAINERCLEANFILES = Makefile.in
##
-SUBDIRS = boost stdair airsched airinv rmol simcrs dsim
+SUBDIRS = boost stdair trademgen airsched airinv rmol simcrs dsim
EXTRA_DIST =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2009-12-30 11:28:36
|
Revision: 34
http://dsim.svn.sourceforge.net/dsim/?rev=34&view=rev
Author: quannaus
Date: 2009-12-30 10:14:40 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[Dev] Added the ConfigurationParameters and the RDSParameters holders.
Modified Paths:
--------------
trunk/dsim/dsim/DSIM_Service.hpp
trunk/dsim/dsim/bom/sources.mk
trunk/dsim/dsim/service/DSIM_Service.cpp
trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
Added Paths:
-----------
trunk/dsim/dsim/bom/ConfigurationParameters.cpp
trunk/dsim/dsim/bom/ConfigurationParameters.hpp
trunk/dsim/dsim/bom/RDSParameters.cpp
trunk/dsim/dsim/bom/RDSParameters.hpp
trunk/dsim/dsim/bom/StructAbstract.hpp
Modified: trunk/dsim/dsim/DSIM_Service.hpp
===================================================================
--- trunk/dsim/dsim/DSIM_Service.hpp 2009-12-30 10:13:43 UTC (rev 33)
+++ trunk/dsim/dsim/DSIM_Service.hpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -14,20 +14,21 @@
// Forward declaration
class DSIM_ServiceContext;
-
+ struct RDSParameters;
/** Interface for the DSIM Services. */
class DSIM_Service {
+
+ private:
+ // ///////// Service Context /////////
+ /** Dsim context. */
+ DSIM_ServiceContext* _dsimServiceContext;
+
public:
- // /////////// Business Methods /////////////
- /** Perform a simulation. */
- void simulate();
-
-
// ////////// Constructors and destructors //////////
/** Constructor.
@param std::ostream& Output log stream (for instance, std::cout). */
- DSIM_Service (std::ostream& ioLogStream);
+ DSIM_Service (const std::string&, std::ostream& ioLogStream);
/** Destructor. */
~DSIM_Service();
@@ -41,16 +42,16 @@
DSIM_Service (const DSIM_Service&);
/** Initialise. */
- void init (std::ostream& ioLogStream);
+ void init (const std::string&, std::ostream& ioLogStream);
/** Finalise. */
void finalise ();
-
- private:
- // ///////// Service Context /////////
- /** Dsim context. */
- DSIM_ServiceContext* _dsimServiceContext;
+ public:
+ // /////////// Business Methods /////////////
+ /** Perform a simulation. */
+ void simulate();
+
};
}
#endif // __DSIM_SVC_DSIM_SERVICE_HPP
Added: trunk/dsim/dsim/bom/ConfigurationParameters.cpp
===================================================================
--- trunk/dsim/dsim/bom/ConfigurationParameters.cpp (rev 0)
+++ trunk/dsim/dsim/bom/ConfigurationParameters.cpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -0,0 +1,39 @@
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <sstream>
+#include <cassert>
+// DSIM
+#include <dsim/bom/ConfigurationParameters.hpp>
+#include <dsim/service/Logger.hpp>
+
+namespace DSIM {
+
+ // ////////////////////////////////////////////////////////////////////
+ ConfigurationParameters::ConfigurationParameters () {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ ConfigurationParameters::
+ ConfigurationParameters (const ConfigurationParameters& iConfigurationParameters) {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ ConfigurationParameters::~ConfigurationParameters () {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ const std::string ConfigurationParameters::describe() const {
+ // Store current formatting flags of std::cout
+ std::ios::fmtflags oldFlags = std::cout.flags();
+
+ std::ostringstream ostr;
+
+ // Reset formatting flags of std::cout
+ std::cout.flags (oldFlags);
+
+ return ostr.str();
+ }
+
+}
Added: trunk/dsim/dsim/bom/ConfigurationParameters.hpp
===================================================================
--- trunk/dsim/dsim/bom/ConfigurationParameters.hpp (rev 0)
+++ trunk/dsim/dsim/bom/ConfigurationParameters.hpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -0,0 +1,38 @@
+#ifndef __DSIM_BOM_CONFIGURATIONPARAMETERS_HPP
+#define __DSIM_BOM_CONFIGURATIONPARAMETERS_HPP
+
+// //////////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////////
+// DSIM
+#include <dsim/bom/StructAbstract.hpp>
+
+namespace DSIM {
+
+ /** Structure wrapping the configuration parameters. */
+ struct ConfigurationParameters : public StructAbstract {
+
+ public:
+ // ///////// Attributes //////////
+
+ public:
+ /** Costructor. */
+ ConfigurationParameters ();
+ ConfigurationParameters (const ConfigurationParameters&);
+
+ /** Destructor. */
+ ~ConfigurationParameters ();
+
+
+ public:
+ // //////// GETTERS /////////
+
+ // //////// SETTERS /////////
+
+ /////////// DISPLAY METHOD ///////////
+ const std::string describe() const;
+
+ };
+
+}
+#endif //__DSIM_BOM_CONFIGURATIONPARAMETERS_HPP
Added: trunk/dsim/dsim/bom/RDSParameters.cpp
===================================================================
--- trunk/dsim/dsim/bom/RDSParameters.cpp (rev 0)
+++ trunk/dsim/dsim/bom/RDSParameters.cpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -0,0 +1,44 @@
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <sstream>
+#include <cassert>
+// DSIM
+#include <dsim/bom/RDSParameters.hpp>
+#include <dsim/service/Logger.hpp>
+
+namespace DSIM {
+
+ // ////////////////////////////////////////////////////////////////////
+ RDSParameters::RDSParameters () {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ RDSParameters::RDSParameters (const RDSParameters& iRDSParameters)
+ : _scheduleInputFilename (iRDSParameters._scheduleInputFilename) {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ RDSParameters::~RDSParameters () {
+ }
+
+ // ////////////////////////////////////////////////////////////////////
+ const std::string RDSParameters::describe() const {
+ // Store current formatting flags of std::cout
+ std::ios::fmtflags oldFlags = std::cout.flags();
+
+ std::ostringstream ostr;
+
+ ostr << "RDS Parameters: " << std::endl;
+
+ ostr << " Schedule file: " << _scheduleInputFilename;
+ ostr << std::endl;
+
+ // Reset formatting flags of std::cout
+ std::cout.flags (oldFlags);
+
+ return ostr.str();
+ }
+
+}
Added: trunk/dsim/dsim/bom/RDSParameters.hpp
===================================================================
--- trunk/dsim/dsim/bom/RDSParameters.hpp (rev 0)
+++ trunk/dsim/dsim/bom/RDSParameters.hpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -0,0 +1,47 @@
+#ifndef __DSIM_BOM_RDSPARAMETERS_HPP
+#define __DSIM_BOM_RDSPARAMETERS_HPP
+
+// //////////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////////
+// DSIM
+#include <dsim/bom/StructAbstract.hpp>
+
+namespace DSIM {
+
+ /** Structure wrapping the Reference Data Set parameters. */
+ struct RDSParameters : public StructAbstract {
+
+ public:
+ // ////////// Attributes ///////////
+ /** Schedule input filename. */
+ std::string _scheduleInputFilename;
+
+ public:
+ /** Costructor. */
+ RDSParameters ();
+ RDSParameters (const RDSParameters&);
+
+ /** Destructor. */
+ ~RDSParameters ();
+
+ public:
+ // //////// GETTERS /////////
+ /** Get the schedule input filename. */
+ const std::string& getScheduleInputFilename () const {
+ return _scheduleInputFilename;
+ }
+
+ // //////// SETTERS /////////
+ /** Set the schedule input filename. */
+ void setScheduleInputFilename (const std::string& iInputFilename) {
+ _scheduleInputFilename = iInputFilename;
+ }
+
+ /////////// DISPLAY METHOD ///////////
+ const std::string describe() const;
+
+ };
+
+}
+#endif //__DSIM_BOM_RDSPARAMETERS_HPP
Added: trunk/dsim/dsim/bom/StructAbstract.hpp
===================================================================
--- trunk/dsim/dsim/bom/StructAbstract.hpp (rev 0)
+++ trunk/dsim/dsim/bom/StructAbstract.hpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -0,0 +1,84 @@
+#ifndef __DSIM_BOM_STRUCTABSTRACT_HPP
+#define __DSIM_BOM_STRUCTABSTRACT_HPP
+
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <iostream>
+#include <sstream>
+
+namespace DSIM {
+
+ /** Base class for the Structures of the Business Object Model (BOM)
+ layer. */
+ struct StructAbstract {
+ public:
+
+ /** Destructor. */
+ virtual ~StructAbstract() {}
+
+ /** Dump a Business Object into an output stream.
+ @param ostream& the output stream. */
+ void toStream (std::ostream& ioOut) const {
+ ioOut << describe();
+ }
+
+ /** Read a Business Object from an input stream.
+ @param istream& the input stream. */
+ virtual void fromStream (std::istream& ioIn) {}
+
+ /** Display of the structure. */
+ virtual const std::string describe() const = 0;
+
+ protected:
+ /** Protected Default Constructor to ensure this class is abtract. */
+ StructAbstract() {}
+ };
+}
+
+/**
+ Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing
+ Output Operators" (p653) of his book "The C++ Standard Library: A Tutorial
+ and Reference", published by Addison-Wesley.
+*/
+template <class charT, class traits>
+inline
+std::basic_ostream<charT, traits>&
+operator<< (std::basic_ostream<charT, traits>& ioOut,
+ const DSIM::StructAbstract& iStruct) {
+ /**
+ string stream:
+ - with same format
+ - without special field width
+ */
+ std::basic_ostringstream<charT,traits> ostr;
+ ostr.copyfmt (ioOut);
+ ostr.width (0);
+
+ // Fill string stream
+ iStruct.toStream (ostr);
+
+ // Print string stream
+ ioOut << ostr.str();
+
+ return ioOut;
+}
+
+/**
+ Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing
+ Output Operators" (pp655-657) of his book "The C++ Standard Library:
+ A Tutorial and Reference", published by Addison-Wesley.
+*/
+template <class charT, class traits>
+inline
+std::basic_istream<charT, traits>&
+operator>> (std::basic_istream<charT, traits>& ioIn,
+ DSIM::StructAbstract& ioStruct) {
+ // Fill the Structure object with the input stream.
+ ioStruct.fromStream (ioIn);
+ return ioIn;
+
+}
+
+#endif // __DSIM_BOM_STRUCTABSTRACT_HPP
Modified: trunk/dsim/dsim/bom/sources.mk
===================================================================
--- trunk/dsim/dsim/bom/sources.mk 2009-12-30 10:13:43 UTC (rev 33)
+++ trunk/dsim/dsim/bom/sources.mk 2009-12-30 10:14:40 UTC (rev 34)
@@ -1,2 +1,7 @@
-bom_h_sources = $(top_srcdir)/dsim/bom/BomAbstract.hpp
-bom_cc_sources = $(top_srcdir)/dsim/bom/BomAbstract.cpp
+bom_h_sources = $(top_srcdir)/dsim/bom/BomAbstract.hpp \
+ $(top_srcdir)/dsim/bom/StructAbstract.hpp \
+ $(top_srcdir)/dsim/bom/ConfigurationParameters.hpp \
+ $(top_srcdir)/dsim/bom/RDSParameters.hpp
+bom_cc_sources = $(top_srcdir)/dsim/bom/BomAbstract.cpp \
+ $(top_srcdir)/dsim/bom/ConfigurationParameters.cpp \
+ $(top_srcdir)/dsim/bom/RDSParameters.cpp
Modified: trunk/dsim/dsim/service/DSIM_Service.cpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_Service.cpp 2009-12-30 10:13:43 UTC (rev 33)
+++ trunk/dsim/dsim/service/DSIM_Service.cpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -21,9 +21,10 @@
// //////////////////////////////////////////////////////////////////////
DSIM_Service::
- DSIM_Service (std::ostream& ioLogStream)
+ DSIM_Service (const std::string& iScheduleInputFilename,
+ std::ostream& ioLogStream)
: _dsimServiceContext (NULL) {
- init (ioLogStream);
+ init (iScheduleInputFilename, ioLogStream);
}
// //////////////////////////////////////////////////////////////////////
@@ -50,7 +51,8 @@
}
// //////////////////////////////////////////////////////////////////////
- void DSIM_Service::init (std::ostream& ioLogStream) {
+ void DSIM_Service::init (const std::string& iScheduleInputFilename,
+ std::ostream& ioLogStream) {
// Set the log file
logInit (LOG::DEBUG, ioLogStream);
@@ -64,7 +66,8 @@
// Initialise the SIMCRS service handler
const SIMCRS::CRSCode_T lCRSCode = "1S";
SIMCRS_ServicePtr_T lSIMCRS_Service =
- SIMCRS_ServicePtr_T (new SIMCRS::SIMCRS_Service (ioLogStream, lCRSCode));
+ SIMCRS_ServicePtr_T (new SIMCRS::SIMCRS_Service (ioLogStream, lCRSCode,
+ iScheduleInputFilename));
lDSIM_ServiceContext.setSIMCRS_Service (lSIMCRS_Service);
}
Modified: trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2009-12-30 10:13:43 UTC (rev 33)
+++ trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2009-12-30 10:14:40 UTC (rev 34)
@@ -10,6 +10,8 @@
#include <boost/shared_ptr.hpp>
// Dsim
#include <dsim/DSIM_Types.hpp>
+#include <dsim/bom/ConfigurationParameters.hpp>
+#include <dsim/bom/RDSParameters.hpp>
#include <dsim/service/ServiceAbstract.hpp>
// Forward declarations
@@ -22,10 +24,37 @@
namespace DSIM {
-
+
/** Class holding the context of the Dsim services. */
class DSIM_ServiceContext : public ServiceAbstract {
friend class FacDsimServiceContext;
+
+ private:
+ // ///////////// Children ////////////
+ /** CRS Service Handler. */
+ SIMCRS_ServicePtr_T _simcrsService;
+
+ private:
+ // //////////// Attributes //////////////////
+ /** Simulator ID. */
+ SimulatorID_T _simulatorID;
+
+ /** Configuration parameters. */
+ ConfigurationParameters _configurationParameters;
+
+ /** Reference Data Set parameters. */
+ RDSParameters _rdsParameters;
+
+ private:
+ // /////// Construction / initialisation ////////
+ /** Constructors. */
+ DSIM_ServiceContext ();
+ DSIM_ServiceContext (const SimulatorID_T&);
+ DSIM_ServiceContext (const DSIM_ServiceContext&);
+
+ /** Destructor. */
+ ~DSIM_ServiceContext();
+
public:
// ///////// Getters //////////
/** Get the simulator ID. */
@@ -33,6 +62,16 @@
return _simulatorID;
}
+ /** Get the configuration parameters. */
+ const ConfigurationParameters& getConfigurationParameters () const {
+ return _configurationParameters;
+ }
+
+ /** Get the RDS parameters. */
+ const RDSParameters& getRDSParameters () const {
+ return _rdsParameters;
+ }
+
/** Get a reference on the SIMCRS service handler. */
SIMCRS::SIMCRS_Service& getSIMCRS_Service () const {
return *_simcrsService.get();
@@ -44,6 +83,16 @@
_simulatorID = iSimulatorID;
}
+ /** Set the configuration parameters. */
+ void setConfigurationParameters (const ConfigurationParameters& iConfigurationParameters) {
+ _configurationParameters = iConfigurationParameters;
+ }
+
+ /** Set the RDS parameters. */
+ void setRDSParameters (const RDSParameters& iRDSParameters) {
+ _rdsParameters = iRDSParameters;
+ }
+
/** Set the pointer on the SIMCRS service handler. */
void setSIMCRS_Service (SIMCRS_ServicePtr_T ioSIMCRS_ServicePtr) {
_simcrsService = ioSIMCRS_ServicePtr;
@@ -55,29 +104,6 @@
/** Display the full DSIM_ServiceContext content. */
const std::string display() const;
-
-
- private:
- // /////// Construction / initialisation ////////
- /** Constructors. */
- DSIM_ServiceContext ();
- DSIM_ServiceContext (const SimulatorID_T&);
- DSIM_ServiceContext (const DSIM_ServiceContext&);
-
- /** Destructor. */
- ~DSIM_ServiceContext();
-
-
- private:
- // ///////////// Children ////////////
- /** CRS Service Handler. */
- SIMCRS_ServicePtr_T _simcrsService;
-
-
- private:
- // //////////// Attributes //////////////////
- /** Simulator ID. */
- SimulatorID_T _simulatorID;
};
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2009-12-30 11:28:04
|
Revision: 33
http://dsim.svn.sourceforge.net/dsim/?rev=33&view=rev
Author: quannaus
Date: 2009-12-30 10:13:43 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[Test] Update the test with the schedule input filename.
Modified Paths:
--------------
trunk/dsim/test/dsim/simulate.cpp
Modified: trunk/dsim/test/dsim/simulate.cpp
===================================================================
--- trunk/dsim/test/dsim/simulate.cpp 2009-12-29 17:57:04 UTC (rev 32)
+++ trunk/dsim/test/dsim/simulate.cpp 2009-12-30 10:13:43 UTC (rev 33)
@@ -13,6 +13,9 @@
try {
+ // Schedule input file name
+ std::string lScheduleInputFilename ("../samples/schedule01.csv");
+
// Output log File
std::string lLogFilename ("simulate.log");
@@ -23,7 +26,7 @@
logOutputFile.clear();
// Initialise the list of classes/buckets
- DSIM::DSIM_Service dsimService (logOutputFile);
+ DSIM::DSIM_Service dsimService (lScheduleInputFilename, logOutputFile);
// Perform a simulation
dsimService.simulate();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2009-12-30 11:19:07
|
Revision: 36
http://dsim.svn.sourceforge.net/dsim/?rev=36&view=rev
Author: quannaus
Date: 2009-12-30 11:19:01 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
Fixed a small bug.
Modified Paths:
--------------
trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
Modified: trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2009-12-30 10:37:35 UTC (rev 35)
+++ trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2009-12-30 11:19:01 UTC (rev 36)
@@ -77,7 +77,6 @@
/** Display the full DSIM_ServiceContext content. */
const std::string display() const;
- };
private:
// /////// Construction / initialisation ////////
@@ -104,6 +103,7 @@
/** Reference Data Set parameters. */
RDSParameters _rdsParameters;
+ };
}
#endif // __DSIM_SVC_DSIMSERVICECONTEXT_HPP
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2009-12-30 10:37:43
|
Revision: 35
http://dsim.svn.sourceforge.net/dsim/?rev=35&view=rev
Author: quannaus
Date: 2009-12-30 10:37:35 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[Dev] Reordered some parts in the header files.
Modified Paths:
--------------
trunk/dsim/dsim/DSIM_Service.hpp
trunk/dsim/dsim/bom/ConfigurationParameters.hpp
trunk/dsim/dsim/bom/RDSParameters.hpp
trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
Modified: trunk/dsim/dsim/DSIM_Service.hpp
===================================================================
--- trunk/dsim/dsim/DSIM_Service.hpp 2009-12-30 10:14:40 UTC (rev 34)
+++ trunk/dsim/dsim/DSIM_Service.hpp 2009-12-30 10:37:35 UTC (rev 35)
@@ -18,12 +18,12 @@
/** Interface for the DSIM Services. */
class DSIM_Service {
+ public:
+ // /////////// Business Methods /////////////
+ /** Perform a simulation. */
+ void simulate();
- private:
- // ///////// Service Context /////////
- /** Dsim context. */
- DSIM_ServiceContext* _dsimServiceContext;
-
+
public:
// ////////// Constructors and destructors //////////
/** Constructor.
@@ -47,10 +47,11 @@
/** Finalise. */
void finalise ();
- public:
- // /////////// Business Methods /////////////
- /** Perform a simulation. */
- void simulate();
+
+ private:
+ // ///////// Service Context /////////
+ /** Dsim context. */
+ DSIM_ServiceContext* _dsimServiceContext;
};
}
Modified: trunk/dsim/dsim/bom/ConfigurationParameters.hpp
===================================================================
--- trunk/dsim/dsim/bom/ConfigurationParameters.hpp 2009-12-30 10:14:40 UTC (rev 34)
+++ trunk/dsim/dsim/bom/ConfigurationParameters.hpp 2009-12-30 10:37:35 UTC (rev 35)
@@ -11,10 +11,15 @@
/** Structure wrapping the configuration parameters. */
struct ConfigurationParameters : public StructAbstract {
-
public:
- // ///////// Attributes //////////
+ // //////// GETTERS /////////
+ // //////// SETTERS /////////
+
+ /////////// DISPLAY METHOD ///////////
+ const std::string describe() const;
+
+
public:
/** Costructor. */
ConfigurationParameters ();
@@ -23,15 +28,8 @@
/** Destructor. */
~ConfigurationParameters ();
-
public:
- // //////// GETTERS /////////
-
- // //////// SETTERS /////////
-
- /////////// DISPLAY METHOD ///////////
- const std::string describe() const;
-
+ // ///////// Attributes //////////
};
}
Modified: trunk/dsim/dsim/bom/RDSParameters.hpp
===================================================================
--- trunk/dsim/dsim/bom/RDSParameters.hpp 2009-12-30 10:14:40 UTC (rev 34)
+++ trunk/dsim/dsim/bom/RDSParameters.hpp 2009-12-30 10:37:35 UTC (rev 35)
@@ -13,19 +13,6 @@
struct RDSParameters : public StructAbstract {
public:
- // ////////// Attributes ///////////
- /** Schedule input filename. */
- std::string _scheduleInputFilename;
-
- public:
- /** Costructor. */
- RDSParameters ();
- RDSParameters (const RDSParameters&);
-
- /** Destructor. */
- ~RDSParameters ();
-
- public:
// //////// GETTERS /////////
/** Get the schedule input filename. */
const std::string& getScheduleInputFilename () const {
@@ -41,6 +28,19 @@
/////////// DISPLAY METHOD ///////////
const std::string describe() const;
+
+ public:
+ /** Costructor. */
+ RDSParameters ();
+ RDSParameters (const RDSParameters&);
+
+ /** Destructor. */
+ ~RDSParameters ();
+
+ public:
+ // ////////// Attributes ///////////
+ /** Schedule input filename. */
+ std::string _scheduleInputFilename;
};
}
Modified: trunk/dsim/dsim/service/DSIM_ServiceContext.hpp
===================================================================
--- trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2009-12-30 10:14:40 UTC (rev 34)
+++ trunk/dsim/dsim/service/DSIM_ServiceContext.hpp 2009-12-30 10:37:35 UTC (rev 35)
@@ -28,33 +28,6 @@
/** Class holding the context of the Dsim services. */
class DSIM_ServiceContext : public ServiceAbstract {
friend class FacDsimServiceContext;
-
- private:
- // ///////////// Children ////////////
- /** CRS Service Handler. */
- SIMCRS_ServicePtr_T _simcrsService;
-
- private:
- // //////////// Attributes //////////////////
- /** Simulator ID. */
- SimulatorID_T _simulatorID;
-
- /** Configuration parameters. */
- ConfigurationParameters _configurationParameters;
-
- /** Reference Data Set parameters. */
- RDSParameters _rdsParameters;
-
- private:
- // /////// Construction / initialisation ////////
- /** Constructors. */
- DSIM_ServiceContext ();
- DSIM_ServiceContext (const SimulatorID_T&);
- DSIM_ServiceContext (const DSIM_ServiceContext&);
-
- /** Destructor. */
- ~DSIM_ServiceContext();
-
public:
// ///////// Getters //////////
/** Get the simulator ID. */
@@ -106,5 +79,31 @@
const std::string display() const;
};
+ private:
+ // /////// Construction / initialisation ////////
+ /** Constructors. */
+ DSIM_ServiceContext ();
+ DSIM_ServiceContext (const SimulatorID_T&);
+ DSIM_ServiceContext (const DSIM_ServiceContext&);
+
+ /** Destructor. */
+ ~DSIM_ServiceContext();
+
+ private:
+ // ///////////// Children ////////////
+ /** CRS Service Handler. */
+ SIMCRS_ServicePtr_T _simcrsService;
+
+ private:
+ // //////////// Attributes //////////////////
+ /** Simulator ID. */
+ SimulatorID_T _simulatorID;
+
+ /** Configuration parameters. */
+ ConfigurationParameters _configurationParameters;
+
+ /** Reference Data Set parameters. */
+ RDSParameters _rdsParameters;
+
}
#endif // __DSIM_SVC_DSIMSERVICECONTEXT_HPP
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-29 17:57:15
|
Revision: 32
http://dsim.svn.sourceforge.net/dsim/?rev=32&view=rev
Author: denis_arnaud
Date: 2009-12-29 17:57:04 +0000 (Tue, 29 Dec 2009)
Log Message:
-----------
[Test] Moved the dsim tests into a dedicated directory.
Modified Paths:
--------------
trunk/dsim/configure.ac
trunk/dsim/test/Makefile.am
Added Paths:
-----------
trunk/dsim/test/dsim/
trunk/dsim/test/dsim/Makefile.am
trunk/dsim/test/dsim/simulate.cpp
Removed Paths:
-------------
trunk/dsim/test/simulate.cpp
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-29 16:05:42 UTC (rev 31)
+++ trunk/dsim/configure.ac 2009-12-29 17:57:04 UTC (rev 32)
@@ -481,6 +481,7 @@
test/airinv/Makefile
test/rmol/Makefile
test/simcrs/Makefile
+ test/dsim/Makefile
)
AC_OUTPUT
Modified: trunk/dsim/test/Makefile.am
===================================================================
--- trunk/dsim/test/Makefile.am 2009-12-29 16:05:42 UTC (rev 31)
+++ trunk/dsim/test/Makefile.am 2009-12-29 17:57:04 UTC (rev 32)
@@ -4,25 +4,11 @@
MAINTAINERCLEANFILES = Makefile.in
##
-SUBDIRS = boost stdair airsched airinv rmol simcrs
+SUBDIRS = boost stdair airsched airinv rmol simcrs dsim
+EXTRA_DIST =
+
##
-check_PROGRAMS = simulate
+check_PROGRAMS =
TESTS = $(check_PROGRAMS)
XFAIL_TESTS = #
-
-#SimulationTestSuite_SOURCES = SimulationTestSuite.hpp \
- SimulationTestSuite.cpp
-#SimulationTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS)
-#SimulationTestSuite_LDADD = $(top_builddir)/test/com/libcppunitcore.la
-#SimulationTestSuite_LDFLAGS = \
-# $(BOOST_LIBS) $(CPPUNIT_LIBS) \
-# $(top_builddir)/dsim/libdsim.la
-
-simulate_SOURCES = simulate.cpp
-simulate_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS)
-simulate_LDADD =
-simulate_LDFLAGS = $(BOOST_LIBS) \
- $(top_builddir)/dsim/core/libdsim.la
-
-EXTRA_DIST =
Property changes on: trunk/dsim/test/dsim
___________________________________________________________________
Added: svn:ignore
+ .deps
.libs
Makefile.in
Makefile
simulate
simulate.log
Copied: trunk/dsim/test/dsim/Makefile.am (from rev 31, trunk/dsim/test/Makefile.am)
===================================================================
--- trunk/dsim/test/dsim/Makefile.am (rev 0)
+++ trunk/dsim/test/dsim/Makefile.am 2009-12-29 17:57:04 UTC (rev 32)
@@ -0,0 +1,28 @@
+## test sub-directory
+include $(top_srcdir)/Makefile.common
+
+MAINTAINERCLEANFILES = Makefile.in
+
+##
+SUBDIRS =
+
+EXTRA_DIST =
+
+##
+check_PROGRAMS = simulate
+TESTS = $(check_PROGRAMS)
+XFAIL_TESTS = #
+
+#SimulationTestSuite_SOURCES = SimulationTestSuite.hpp \
+ SimulationTestSuite.cpp
+#SimulationTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS)
+#SimulationTestSuite_LDADD = $(top_builddir)/test/com/libcppunitcore.la
+#SimulationTestSuite_LDFLAGS = \
+# $(BOOST_LIBS) $(CPPUNIT_LIBS) \
+# $(top_builddir)/dsim/libdsim.la
+
+simulate_SOURCES = simulate.cpp
+simulate_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS)
+simulate_LDADD =
+simulate_LDFLAGS = $(BOOST_LIBS) \
+ $(top_builddir)/dsim/core/libdsim.la
Copied: trunk/dsim/test/dsim/simulate.cpp (from rev 31, trunk/dsim/test/simulate.cpp)
===================================================================
--- trunk/dsim/test/dsim/simulate.cpp (rev 0)
+++ trunk/dsim/test/dsim/simulate.cpp 2009-12-29 17:57:04 UTC (rev 32)
@@ -0,0 +1,40 @@
+// STL
+#include <cassert>
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <string>
+// DSIM
+#include <dsim/DSIM_Service.hpp>
+#include <dsim/config/dsim-paths.hpp>
+
+// ///////// M A I N ////////////
+int main (int argc, char* argv[]) {
+
+ try {
+
+ // Output log File
+ 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 list of classes/buckets
+ DSIM::DSIM_Service dsimService (logOutputFile);
+
+ // Perform a simulation
+ dsimService.simulate();
+
+ } catch (const std::exception& stde) {
+ std::cerr << "Standard exception: " << stde.what() << std::endl;
+ return -1;
+
+ } catch (...) {
+ return -1;
+ }
+
+ return 0;
+}
Deleted: trunk/dsim/test/simulate.cpp
===================================================================
--- trunk/dsim/test/simulate.cpp 2009-12-29 16:05:42 UTC (rev 31)
+++ trunk/dsim/test/simulate.cpp 2009-12-29 17:57:04 UTC (rev 32)
@@ -1,40 +0,0 @@
-// STL
-#include <cassert>
-#include <iostream>
-#include <sstream>
-#include <fstream>
-#include <string>
-// DSIM
-#include <dsim/DSIM_Service.hpp>
-#include <dsim/config/dsim-paths.hpp>
-
-// ///////// M A I N ////////////
-int main (int argc, char* argv[]) {
-
- try {
-
- // Output log File
- 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 list of classes/buckets
- DSIM::DSIM_Service dsimService (logOutputFile);
-
- // Perform a simulation
- dsimService.simulate();
-
- } 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...> - 2009-12-29 16:05:55
|
Revision: 31
http://dsim.svn.sourceforge.net/dsim/?rev=31&view=rev
Author: quannaus
Date: 2009-12-29 16:05:42 +0000 (Tue, 29 Dec 2009)
Log Message:
-----------
[test] Added a schedule file sample.
Added Paths:
-----------
trunk/dsim/test/samples/
trunk/dsim/test/samples/schedule01.csv
Added: trunk/dsim/test/samples/schedule01.csv
===================================================================
--- trunk/dsim/test/samples/schedule01.csv (rev 0)
+++ trunk/dsim/test/samples/schedule01.csv 2009-12-29 16:05:42 UTC (rev 31)
@@ -0,0 +1,6 @@
+// Flights: AirlineCode; FlightNumber; Date-Range; ; DOW; Legs; Segments;
+// Legs: BoardPoint; OffPoint; BoardTime; ArrivalDateOffSet; ArrivalTime;
+// ElapsedTime; LegCabins;
+// LegCabins: CabinCode; Capacity;
+// Segments: Specific;
+AA; 117; 2009-01-15; 2009-01-28; 1000000; LHR; JFK; 08:20; 11:00; 07:40; Y; 300; 0; Y; YM;
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-29 14:14:48
|
Revision: 30
http://dsim.svn.sourceforge.net/dsim/?rev=30&view=rev
Author: denis_arnaud
Date: 2009-12-29 14:14:40 +0000 (Tue, 29 Dec 2009)
Log Message:
-----------
[Test] Added tests for the stdair, airinv and simcrs projects.
Modified Paths:
--------------
trunk/dsim/configure.ac
trunk/dsim/test/Makefile.am
Property Changed:
----------------
trunk/dsim/test/
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-29 13:34:09 UTC (rev 29)
+++ trunk/dsim/configure.ac 2009-12-29 14:14:40 UTC (rev 30)
@@ -476,8 +476,11 @@
test/boost/spirit/Makefile
test/boost/serialization/Makefile
test/boost/signals/Makefile
+ test/stdair/Makefile
test/airsched/Makefile
+ test/airinv/Makefile
test/rmol/Makefile
+ test/simcrs/Makefile
)
AC_OUTPUT
Property changes on: trunk/dsim/test
___________________________________________________________________
Modified: svn:externals
- airsched https://air-sched.svn.sourceforge.net/svnroot/air-sched/trunk/airsched/test/airsched
rmol https://rmol.svn.sourceforge.net/svnroot/rmol/trunk/rmol/test/rmol
+ 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
airinv https://rmol.svn.sourceforge.net/svnroot/airinv/trunk/airinv/test/airinv
rmol https://rmol.svn.sourceforge.net/svnroot/rmol/trunk/rmol/test/rmol
simcrs https://rmol.svn.sourceforge.net/svnroot/simcrs/trunk/simcrs/test/simcrs
Modified: trunk/dsim/test/Makefile.am
===================================================================
--- trunk/dsim/test/Makefile.am 2009-12-29 13:34:09 UTC (rev 29)
+++ trunk/dsim/test/Makefile.am 2009-12-29 14:14:40 UTC (rev 30)
@@ -4,7 +4,7 @@
MAINTAINERCLEANFILES = Makefile.in
##
-SUBDIRS = boost airsched rmol
+SUBDIRS = boost stdair airsched airinv rmol simcrs
##
check_PROGRAMS = simulate
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-29 13:34:22
|
Revision: 29
http://dsim.svn.sourceforge.net/dsim/?rev=29&view=rev
Author: denis_arnaud
Date: 2009-12-29 13:34:09 +0000 (Tue, 29 Dec 2009)
Log Message:
-----------
[Test] Added the tests on the Airline Schedule Manager (airsched) library.
Modified Paths:
--------------
trunk/dsim/configure.ac
trunk/dsim/test/Makefile.am
Property Changed:
----------------
trunk/dsim/test/
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-29 13:19:34 UTC (rev 28)
+++ trunk/dsim/configure.ac 2009-12-29 13:34:09 UTC (rev 29)
@@ -476,6 +476,7 @@
test/boost/spirit/Makefile
test/boost/serialization/Makefile
test/boost/signals/Makefile
+ test/airsched/Makefile
test/rmol/Makefile
)
AC_OUTPUT
Property changes on: trunk/dsim/test
___________________________________________________________________
Modified: svn:externals
- rmol https://rmol.svn.sourceforge.net/svnroot/rmol/trunk/rmol/test/rmol
+ airsched https://air-sched.svn.sourceforge.net/svnroot/air-sched/trunk/airsched/test/airsched
rmol https://rmol.svn.sourceforge.net/svnroot/rmol/trunk/rmol/test/rmol
Modified: trunk/dsim/test/Makefile.am
===================================================================
--- trunk/dsim/test/Makefile.am 2009-12-29 13:19:34 UTC (rev 28)
+++ trunk/dsim/test/Makefile.am 2009-12-29 13:34:09 UTC (rev 29)
@@ -4,7 +4,7 @@
MAINTAINERCLEANFILES = Makefile.in
##
-SUBDIRS = boost rmol
+SUBDIRS = boost airsched rmol
##
check_PROGRAMS = simulate
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-29 09:58:02
|
Revision: 27
http://dsim.svn.sourceforge.net/dsim/?rev=27&view=rev
Author: denis_arnaud
Date: 2009-12-29 09:57:50 +0000 (Tue, 29 Dec 2009)
Log Message:
-----------
[Conf] Added the configuration for MySQL.
Modified Paths:
--------------
trunk/dsim/configure.ac
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-28 18:24:08 UTC (rev 26)
+++ trunk/dsim/configure.ac 2009-12-29 09:57:50 UTC (rev 27)
@@ -203,6 +203,14 @@
AC_SUBST(BOOST_MPI_PYTHON_LIB)
# --------------------------------------------------------------------
+# Support for MySQL (C client API): http://www.mysql.org
+# --------------------------------------------------------------------
+AX_MYSQL
+AC_SUBST(MYSQL_VERSION)
+AC_SUBST(MYSQL_CFLAGS)
+AC_SUBST(MYSQL_LIBS)
+
+# --------------------------------------------------------------------
# Support for SOCI http://soci.sourceforge.net
# --------------------------------------------------------------------
AX_SOCI
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-28 18:24:20
|
Revision: 26
http://dsim.svn.sourceforge.net/dsim/?rev=26&view=rev
Author: denis_arnaud
Date: 2009-12-28 18:24:08 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[Test] Activated the embedded ExtraCC library, and added the RMOL test sub-directory.
Modified Paths:
--------------
trunk/dsim/Makefile.am
trunk/dsim/configure.ac
trunk/dsim/test/Makefile.am
Property Changed:
----------------
trunk/dsim/
Property changes on: trunk/dsim
___________________________________________________________________
Modified: svn:externals
- 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
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
+ 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
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
Modified: trunk/dsim/Makefile.am
===================================================================
--- trunk/dsim/Makefile.am 2009-12-28 15:16:19 UTC (rev 25)
+++ trunk/dsim/Makefile.am 2009-12-28 18:24:08 UTC (rev 26)
@@ -25,7 +25,8 @@
EXTRA_DIST =
# Build in these directories:
-SUBDIRS = stdair trademgen airsched airinv simcrs rmol dsim $(TEST_DIR)
+SUBDIRS = stdair trademgen airsched airinv simcrs rmol dsim \
+ extracppunit $(TEST_DIR)
# Configuration helpers
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-28 15:16:19 UTC (rev 25)
+++ trunk/dsim/configure.ac 2009-12-28 18:24:08 UTC (rev 26)
@@ -141,7 +141,11 @@
# -----------------------------------------------------------------------------
# Support for ExtraCC (Extra-CruiseControl): http://sf.net/projects/extracc
# -----------------------------------------------------------------------------
-AM_PATH_EXTRACC
+# Note: the ExtraCC is now imported as a Subversion external reference,
+# 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)
@@ -199,14 +203,6 @@
AC_SUBST(BOOST_MPI_PYTHON_LIB)
# --------------------------------------------------------------------
-# Support for MySQL++ (C++ client API): http://tangentsoft.net/mysql++
-# --------------------------------------------------------------------
-AX_MYSQLPP
-AC_SUBST(MYSQLPP_VERSION)
-AC_SUBST(MYSQLPP_CFLAGS)
-AC_SUBST(MYSQLPP_LIBS)
-
-# --------------------------------------------------------------------
# Support for SOCI http://soci.sourceforge.net
# --------------------------------------------------------------------
AX_SOCI
@@ -217,18 +213,22 @@
# --------------------------------------------------------------------
# Support for TRAVEL-CCM (CCM Open Library): http://sf.net/projects/travel-ccm
# --------------------------------------------------------------------
-AM_PATH_TRAVELCCM
-AC_SUBST(TRAVELCCM_VERSION)
-AC_SUBST(TRAVELCCM_CFLAGS)
-AC_SUBST(TRAVELCCM_LIBS)
+# Note: That library is imported as a Subversion external reference. So, there is
+# no need to import it as an independent library as well.
+#AM_PATH_TRAVELCCM
+#AC_SUBST(TRAVELCCM_VERSION)
+#AC_SUBST(TRAVELCCM_CFLAGS)
+#AC_SUBST(TRAVELCCM_LIBS)
# --------------------------------------------------------------------
# Support for RMOL (RM Open Library): http://sf.net/projects/rmol
# --------------------------------------------------------------------
-AM_PATH_RMOL([0.19])
-AC_SUBST(RMOL_VERSION)
-AC_SUBST(RMOL_CFLAGS)
-AC_SUBST(RMOL_LIBS)
+# Note: That library is imported as a Subversion external reference. So, there is
+# no need to import it as an independent library as well.
+#AM_PATH_RMOL([0.19])
+#AC_SUBST(RMOL_VERSION)
+#AC_SUBST(RMOL_CFLAGS)
+#AC_SUBST(RMOL_LIBS)
# ============ X E R C E S ==================
AX_XERCES_C
@@ -238,14 +238,6 @@
#
AC_CHECK_LIBRT
-# -----------------------------------------------------------
-# Xapian (Indexing & Search API: http://www.xapian.org
-# -----------------------------------------------------------
-XO_LIB_XAPIAN
-AC_SUBST(XAPIAN_VERSION)
-AC_SUBST(XAPIAN_CFLAGS)
-AC_SUBST(XAPIAN_LIBS)
-
# -------------------------------------------------------------------
# Support for documentation
# -------------------------------------------------------------------
@@ -463,6 +455,7 @@
dsim/config/Makefile
dsim/core/Makefile
dsim/batches/Makefile
+ extracppunit/Makefile
test/Makefile
test/boost/Makefile
test/boost/accumulators/Makefile
@@ -561,11 +554,6 @@
o MYSQL_CFLAGS .... : ${MYSQL_CFLAGS}
o MYSQL_LIBS ...... : ${MYSQL_LIBS}
- - MySQL++ ........... :
- o MYSQLPP_version . : ${MYSQLPP_VERSION}
- o MYSQLPP_CFLAGS .. : ${MYSQLPP_CFLAGS}
- o MYSQLPP_LIBS .... : ${MYSQLPP_LIBS}
-
- SOCI .............. :
o SOCI_version .... : ${SOCI_VERSION}
o SOCI_CFLAGS ..... : ${SOCI_CFLAGS}
@@ -576,26 +564,6 @@
o XERCES_CFLAGS ... : ${XERCES_CFLAGS}
o XERCES_LIBS ..... : ${XERCES_LIBS}
- - EXTRACC ........... :
- o EXTRACC_VERSION . : ${EXTRACC_VERSION}
- o EXTRACC_CFLAGS .. : ${EXTRACC_CFLAGS}
- o EXTRACC_LIBS .... : ${EXTRACC_LIBS}
-
- - TRAVELCCM ......... :
- o TRAVELCCM_VERSION : ${TRAVELCCM_VERSION}
- o TRAVELCCM_CFLAGS : ${TRAVELCCM_CFLAGS}
- o TRAVELCCM_LIBS .. : ${TRAVELCCM_LIBS}
-
- - RMOL .............. :
- o RMOL_VERSION .... : ${RMOL_VERSION}
- o RMOL_CFLAGS ..... : ${RMOL_CFLAGS}
- o RMOL_LIBS ....... : ${RMOL_LIBS}
-
- - XAPIAN ............ :
- o XAPIAN_VERSION .. : ${XAPIAN_VERSION}
- o XAPIAN_CFLAGS ... : ${XAPIAN_CFLAGS}
- o XAPIAN_LIBS ..... : ${XAPIAN_LIBS}
-
- CPPUNIT............ :
o CPPUNIT_VERSION . : ${CPPUNIT_VERSION}
o CPPUNIT_CFLAGS .. : ${CPPUNIT_CFLAGS}
Modified: trunk/dsim/test/Makefile.am
===================================================================
--- trunk/dsim/test/Makefile.am 2009-12-28 15:16:19 UTC (rev 25)
+++ trunk/dsim/test/Makefile.am 2009-12-28 18:24:08 UTC (rev 26)
@@ -4,7 +4,7 @@
MAINTAINERCLEANFILES = Makefile.in
##
-SUBDIRS = boost
+SUBDIRS = boost rmol
##
check_PROGRAMS = simulate
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-28 15:16:34
|
Revision: 25
http://dsim.svn.sourceforge.net/dsim/?rev=25&view=rev
Author: denis_arnaud
Date: 2009-12-28 15:16:19 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[Conf] Suppressed useless dependencies on SOCI and MySQL.
Modified Paths:
--------------
trunk/dsim/config/mysql.m4
trunk/dsim/config/soci.m4
trunk/dsim/configure.ac
trunk/dsim/dsim/bom/Makefile.am
trunk/dsim/test/Makefile.am
Property Changed:
----------------
trunk/dsim/test/
Modified: trunk/dsim/config/mysql.m4
===================================================================
--- trunk/dsim/config/mysql.m4 2009-12-28 10:52:19 UTC (rev 24)
+++ trunk/dsim/config/mysql.m4 2009-12-28 15:16:19 UTC (rev 25)
@@ -113,10 +113,10 @@
AC_MSG_RESULT([$MYSQL_libdir])
- case "$MYSQL_libdir" in
- /usr/lib) ;;
- *) LDFLAGS="$LDFLAGS -L${MYSQL_libdir}" ;;
- esac
+# case "$MYSQL_libdir" in
+# /usr/lib) ;;
+# *) LDFLAGS="$LDFLAGS -L${MYSQL_libdir}" ;;
+# esac
#
# Look for MySQL C API headers
Modified: trunk/dsim/config/soci.m4
===================================================================
--- trunk/dsim/config/soci.m4 2009-12-28 10:52:19 UTC (rev 24)
+++ trunk/dsim/config/soci.m4 2009-12-28 15:16:19 UTC (rev 25)
@@ -79,10 +79,10 @@
AC_MSG_RESULT([$SOCI_libdir])
- case "$SOCI_libdir" in
- /usr/lib) ;;
- *) LDFLAGS="$LDFLAGS -L${SOCI_libdir}" ;;
- esac
+# case "$SOCI_libdir" in
+# /usr/lib) ;;
+# *) LDFLAGS="$LDFLAGS -L${SOCI_libdir}" ;;
+# esac
#
@@ -119,8 +119,8 @@
then
SOCI_LIBS="-L${SOCI_libdir}"
fi
- SOCI_CFLAGS="-DSOCI_HEADERS_BURIED -DSOCI_MYSQL_HEADERS_BURIED $SOCI_CFLAGS"
- SOCI_LIBS="$SOCI_LIBS -l${SOCI_CORE_LIB} -l${SOCI_MYSQL_LIB} -ldl"
+ SOCI_CFLAGS="-DSOCI_HEADERS_BURIED -DSOCI_MYSQL_HEADERS_BURIED ${MYSQL_CFLAGS} ${SOCI_CFLAGS}"
+ SOCI_LIBS="${MYSQL_LIBS} ${SOCI_LIBS} -l${SOCI_CORE_LIB} -l${SOCI_MYSQL_LIB} -ldl"
AC_SUBST(SOCI_CFLAGS)
AC_SUBST(SOCI_LIBS)
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-28 10:52:19 UTC (rev 24)
+++ trunk/dsim/configure.ac 2009-12-28 15:16:19 UTC (rev 25)
@@ -475,6 +475,7 @@
test/boost/spirit/Makefile
test/boost/serialization/Makefile
test/boost/signals/Makefile
+ test/rmol/Makefile
)
AC_OUTPUT
Modified: trunk/dsim/dsim/bom/Makefile.am
===================================================================
--- trunk/dsim/dsim/bom/Makefile.am 2009-12-28 10:52:19 UTC (rev 24)
+++ trunk/dsim/dsim/bom/Makefile.am 2009-12-28 15:16:19 UTC (rev 25)
@@ -5,8 +5,8 @@
noinst_LTLIBRARIES= libbom.la
libbom_la_SOURCES= $(bom_h_sources) $(bom_cc_sources)
-libbom_la_CXXFLAGS = $(GSL_CFLAGS)
-libbom_la_LDFLAGS = $(GSL_LIBS)
+libbom_la_CXXFLAGS =
+libbom_la_LDFLAGS =
#pkgincludedir = $(includedir)/@PACKAGE@/bom
#pkginclude_HEADERS = $(bom_h_sources)
Property changes on: trunk/dsim/test
___________________________________________________________________
Added: svn:externals
+ rmol https://rmol.svn.sourceforge.net/svnroot/rmol/trunk/rmol/test/rmol
Modified: trunk/dsim/test/Makefile.am
===================================================================
--- trunk/dsim/test/Makefile.am 2009-12-28 10:52:19 UTC (rev 24)
+++ trunk/dsim/test/Makefile.am 2009-12-28 15:16:19 UTC (rev 25)
@@ -17,12 +17,12 @@
#SimulationTestSuite_LDADD = $(top_builddir)/test/com/libcppunitcore.la
#SimulationTestSuite_LDFLAGS = \
# $(BOOST_LIBS) $(CPPUNIT_LIBS) \
-# $(top_builddir)/@PACKAGE@/lib@PACKAGE@.la
+# $(top_builddir)/dsim/libdsim.la
simulate_SOURCES = simulate.cpp
simulate_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS)
simulate_LDADD =
simulate_LDFLAGS = $(BOOST_LIBS) \
- $(top_builddir)/@PACKAGE@/core/lib@PACKAGE@.la
+ $(top_builddir)/dsim/core/libdsim.la
EXTRA_DIST =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-28 10:52:40
|
Revision: 24
http://dsim.svn.sourceforge.net/dsim/?rev=24&view=rev
Author: denis_arnaud
Date: 2009-12-28 10:52:19 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[Test] Updated Boost.Spirit tests.
Modified Paths:
--------------
trunk/dsim/test/boost/spirit/Makefile.am
trunk/dsim/test/boost/spirit/full_calculator.cpp
trunk/dsim/test/boost/spirit/parameter_parser.cpp
trunk/dsim/test/boost/spirit/schedule_parser.cpp
trunk/dsim/test/boost/spirit/search_string_parser.cpp
Added Paths:
-----------
trunk/dsim/test/boost/spirit/functor_parser.cpp
trunk/dsim/test/boost/spirit/number_parser.cpp
trunk/dsim/test/boost/spirit/spirit_parser.cpp
trunk/dsim/test/boost/spirit/subrule_parser.cpp
Property Changed:
----------------
trunk/dsim/test/boost/spirit/
Property changes on: trunk/dsim/test/boost/spirit
___________________________________________________________________
Modified: svn:ignore
- .deps
.libs
Makefile.in
Makefile
levenshtein
parameter_parser
search_string_parser
schedule_parser
full_calculator
+ .deps
.libs
Makefile.in
Makefile
levenshtein
parameter_parser
search_string_parser
schedule_parser
full_calculator
spirit_parser
subrule_parser
number_parser
functor_parser
Modified: trunk/dsim/test/boost/spirit/Makefile.am
===================================================================
--- trunk/dsim/test/boost/spirit/Makefile.am 2009-12-28 00:16:49 UTC (rev 23)
+++ trunk/dsim/test/boost/spirit/Makefile.am 2009-12-28 10:52:19 UTC (rev 24)
@@ -3,17 +3,34 @@
MAINTAINERCLEANFILES = Makefile.in
-check_PROGRAMS = full_calculator parameter_parser schedule_parser \
- search_string_parser levenshtein
+check_PROGRAMS = full_calculator functor_parser number_parser \
+ parameter_parser spirit_parser subrule_parser \
+ schedule_parser search_string_parser levenshtein
full_calculator_SOURCES = full_calculator.cpp
full_calculator_CXXFLAGS = $(BOOST_CFLAGS)
-full_calculator_LDADD = $(BOOST_LIB)
+full_calculator_LDADD = $(BOOST_LIBS)
+functor_parser_SOURCES = functor_parser.cpp
+functor_parser_CXXFLAGS = $(BOOST_CFLAGS)
+functor_parser_LDADD = $(BOOST_LIBS)
+
+number_parser_SOURCES = number_parser.cpp
+number_parser_CXXFLAGS = $(BOOST_CFLAGS)
+number_parser_LDADD = $(BOOST_LIBS)
+
parameter_parser_SOURCES = parameter_parser.cpp
parameter_parser_CXXFLAGS = $(BOOST_CFLAGS)
-parameter_parser_LDADD = $(BOOST_LIB)
+parameter_parser_LDADD = $(BOOST_LIBS)
+spirit_parser_SOURCES = spirit_parser.cpp
+spirit_parser_CXXFLAGS = $(BOOST_CFLAGS)
+spirit_parser_LDADD = $(BOOST_LIBS)
+
+subrule_parser_SOURCES = subrule_parser.cpp
+subrule_parser_CXXFLAGS = $(BOOST_CFLAGS)
+subrule_parser_LDADD = $(BOOST_LIBS)
+
schedule_parser_SOURCES = schedule_parser.cpp
schedule_parser_CXXFLAGS = $(BOOST_CFLAGS)
schedule_parser_LDADD = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB)
Modified: trunk/dsim/test/boost/spirit/full_calculator.cpp
===================================================================
--- trunk/dsim/test/boost/spirit/full_calculator.cpp 2009-12-28 00:16:49 UTC (rev 23)
+++ trunk/dsim/test/boost/spirit/full_calculator.cpp 2009-12-28 10:52:19 UTC (rev 24)
@@ -14,14 +14,14 @@
// [ JDG 6/29/2002 ]
//
////////////////////////////////////////////////////////////////////////////
-#include <boost/spirit/core.hpp>
-#include <boost/spirit/attribute.hpp>
+#include <boost/spirit/home/classic/core.hpp>
+#include <boost/spirit/home/classic/attribute.hpp>
#include <iostream>
#include <string>
////////////////////////////////////////////////////////////////////////////
using namespace std;
-using namespace boost::spirit;
+using namespace boost::spirit::classic;
using namespace phoenix;
////////////////////////////////////////////////////////////////////////////
@@ -36,7 +36,7 @@
// driver code that uses the calculator below).
//
////////////////////////////////////////////////////////////////////////////
-struct calc_closure : boost::spirit::closure<calc_closure, double>
+struct calc_closure : boost::spirit::classic::closure<calc_closure, double>
{
member1 val;
};
@@ -53,7 +53,6 @@
expression
= term[expression.val = arg1]
>> *( ('+' >> term[expression.val += arg1])
- | ('+' >> term[expression.val -= arg1])
| ('-' >> term[expression.val -= arg1])
)
;
Added: trunk/dsim/test/boost/spirit/functor_parser.cpp
===================================================================
--- trunk/dsim/test/boost/spirit/functor_parser.cpp (rev 0)
+++ trunk/dsim/test/boost/spirit/functor_parser.cpp 2009-12-28 10:52:19 UTC (rev 24)
@@ -0,0 +1,160 @@
+/*=============================================================================
+ Copyright (c) 2002-2003 Joel de Guzman
+ Copyright (c) 2002 Juan Carlos Arevalo-Baeza
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to 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)
+=============================================================================*/
+#include <boost/spirit/home/classic/core.hpp>
+#include <boost/spirit/home/classic/utility/functor_parser.hpp>
+#include <boost/spirit/home/classic/actor/assign_actor.hpp>
+#include <iostream>
+#include <vector>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Demonstrates the functor_parser. This is discussed in the
+// "Functor Parser" chapter in the Spirit User's Guide.
+//
+///////////////////////////////////////////////////////////////////////////////
+using namespace std;
+using namespace boost::spirit::classic;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Our parser functor
+//
+///////////////////////////////////////////////////////////////////////////////
+struct number_parser
+{
+ typedef int result_t;
+ template <typename ScannerT>
+ int
+ operator()(ScannerT const& scan, result_t& result) const
+ {
+ if (scan.at_end())
+ return -1;
+
+ char ch = *scan;
+ if (ch < '0' || ch > '9')
+ return -1;
+
+ result = 0;
+ int len = 0;
+
+ do
+ {
+ result = result*10 + int(ch - '0');
+ ++len;
+ ++scan;
+ } while (!scan.at_end() && (ch = *scan, ch >= '0' && ch <= '9'));
+
+ return len;
+ }
+};
+
+functor_parser<number_parser> number_parser_p;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Our number parser functions
+//
+///////////////////////////////////////////////////////////////////////////////
+bool
+parse_number(char const* str, int& n)
+{
+ return parse(str, lexeme_d[number_parser_p[assign_a(n)]], space_p).full;
+}
+
+bool
+parse_numbers(char const* str, std::vector<int>& n)
+{
+ return
+ parse(
+ str,
+ lexeme_d[number_parser_p[push_back_a(n)]]
+ >> *(',' >> lexeme_d[number_parser_p[push_back_a(n)]]),
+ space_p
+ ).full;
+}
+
+////////////////////////////////////////////////////////////////////////////
+//
+// Main program
+//
+////////////////////////////////////////////////////////////////////////////
+int
+main()
+{
+ cout << "/////////////////////////////////////////////////////////\n\n";
+ cout << "\t\tA number parser implemented as a functor for Spirit...\n\n";
+ cout << "/////////////////////////////////////////////////////////\n\n";
+
+ cout << "Give me an integer number command\n";
+ cout << "Commands:\n";
+ cout << " A <num> --> parses a single number\n";
+ cout << " B <num>, <num>, ... --> parses a series of numbers ";
+ cout << "separated by commas\n";
+ cout << " Q --> quit\n\n";
+
+ string str;
+ while (getline(cin, str))
+ {
+ if (str.empty() || str[0] == 'q' || str[0] == 'Q')
+ break;
+
+ else if (str[0] == 'a' || str[0] == 'A')
+ {
+ int n;
+ if (parse_number(str.c_str()+1, n))
+ {
+ cout << "-------------------------\n";
+ cout << "Parsing succeeded\n";
+ cout << str << " Parses OK: " << n << endl;
+ cout << "-------------------------\n";
+ }
+ else
+ {
+ cout << "-------------------------\n";
+ cout << "Parsing failed\n";
+ cout << "-------------------------\n";
+ }
+ }
+
+ else if (str[0] == 'b' || str[0] == 'B')
+ {
+ std::vector<int> n;
+ if (parse_numbers(str.c_str()+1, n))
+ {
+ cout << "-------------------------\n";
+ cout << "Parsing succeeded\n";
+ int size = n.size();
+ cout << str << " Parses OK: " << size << " number(s): " << n[0];
+ for (int i = 1; i < size; ++i) {
+ cout << ", " << n[i];
+ }
+ cout << endl;
+ cout << "-------------------------\n";
+ }
+ else
+ {
+ cout << "-------------------------\n";
+ cout << "Parsing failed\n";
+ cout << "-------------------------\n";
+ }
+ }
+
+ else
+ {
+ cout << "-------------------------\n";
+ cout << "Unrecognized command!!";
+ cout << "-------------------------\n";
+ }
+ }
+
+ cout << "Bye... :-) \n\n";
+ return 0;
+}
Added: trunk/dsim/test/boost/spirit/number_parser.cpp
===================================================================
--- trunk/dsim/test/boost/spirit/number_parser.cpp (rev 0)
+++ trunk/dsim/test/boost/spirit/number_parser.cpp 2009-12-28 10:52:19 UTC (rev 24)
@@ -0,0 +1,143 @@
+/*=============================================================================
+ Copyright (c) 2002-2003 Joel de Guzman
+ Copyright (c) 2002 Juan Carlos Arevalo-Baeza
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to 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)
+=============================================================================*/
+#include <boost/spirit/home/classic/core.hpp>
+#include <boost/spirit/home/classic/utility/functor_parser.hpp>
+#include <boost/spirit/home/classic/actor/assign_actor.hpp>
+#include <iostream>
+#include <vector>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Demonstrates the functor_parser. This is discussed in the
+// "Functor Parser" chapter in the Spirit User's Guide.
+//
+///////////////////////////////////////////////////////////////////////////////
+using namespace std;
+using namespace boost::spirit::classic;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Our parser functor
+//
+///////////////////////////////////////////////////////////////////////////////
+struct number_parser {
+
+ typedef int result_t;
+
+ template <typename ScannerT>
+ int
+ operator()(ScannerT const& scan, result_t& result) const {
+ if (scan.at_end())
+ return -1;
+
+ char ch = *scan;
+ if (ch < '0' || ch > '9')
+ return -1;
+
+ result = 0;
+ int len = 0;
+
+ do
+ {
+ result = result*10 + int(ch - '0');
+ ++len;
+ ++scan;
+ } while (!scan.at_end() && (ch = *scan, ch >= '0' && ch <= '9'));
+
+ return len;
+ }
+};
+
+functor_parser<number_parser> number_parser_p;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Our number parser functions
+//
+///////////////////////////////////////////////////////////////////////////////
+bool parse_number(char const* str, int& n) {
+ return parse (str, lexeme_d[number_parser_p[assign_a(n)]], space_p).full;
+}
+
+bool parse_numbers (char const* str, std::vector<int>& n) {
+ return parse(
+ str,
+ lexeme_d[number_parser_p[push_back_a(n)]]
+ >> *(',' >> lexeme_d[number_parser_p[push_back_a(n)]]),
+ space_p
+ ).full;
+}
+
+////////////////////////////////////////////////////////////////////////////
+//
+// Main program
+//
+////////////////////////////////////////////////////////////////////////////
+int main() {
+ cout << "/////////////////////////////////////////////////////////\n\n";
+ cout << "\t\tA number parser implemented as a functor for Spirit...\n\n";
+ cout << "/////////////////////////////////////////////////////////\n\n";
+
+ cout << "Give me an integer number command\n";
+ cout << "Commands:\n";
+ cout << " A <num> --> parses a single number\n";
+ cout << " B <num>, <num>, ... --> parses a series of numbers ";
+ cout << "separated by commas\n";
+ cout << " Q --> quit\n\n";
+
+ std::string str;
+ while (getline(cin, str)) {
+ if (str.empty() || str[0] == 'q' || str[0] == 'Q') {
+ break;
+
+ } else if (str[0] == 'a' || str[0] == 'A') {
+ int n;
+
+ if (parse_number(str.c_str()+1, n)) {
+ cout << "-------------------------\n";
+ cout << "Parsing succeeded\n";
+ cout << str << " Parses OK: " << n << endl;
+ cout << "-------------------------\n";
+ } else {
+ cout << "-------------------------\n";
+ cout << "Parsing failed\n";
+ cout << "-------------------------\n";
+ }
+
+ } else if (str[0] == 'b' || str[0] == 'B') {
+ std::vector<int> n;
+ if (parse_numbers(str.c_str()+1, n)) {
+ cout << "-------------------------\n";
+ cout << "Parsing succeeded\n";
+ int size = n.size();
+ cout << str << " Parses OK: " << size << " number(s): " << n[0];
+ for (int i = 1; i < size; ++i) {
+ cout << ", " << n[i];
+ }
+ cout << endl;
+ cout << "-------------------------\n";
+
+ } else {
+ cout << "-------------------------\n";
+ cout << "Parsing failed\n";
+ cout << "-------------------------\n";
+ }
+
+ } else {
+ cout << "-------------------------\n";
+ cout << "Unrecognized command!!";
+ cout << "-------------------------\n";
+ }
+ }
+
+ cout << "Bye... :-) \n\n";
+ return 0;
+}
Modified: trunk/dsim/test/boost/spirit/parameter_parser.cpp
===================================================================
--- trunk/dsim/test/boost/spirit/parameter_parser.cpp 2009-12-28 00:16:49 UTC (rev 23)
+++ trunk/dsim/test/boost/spirit/parameter_parser.cpp 2009-12-28 10:52:19 UTC (rev 24)
@@ -23,17 +23,17 @@
#pragma warning(disable: 4355)
#endif // defined(_MSC_VER) && !defined(__COMO__)
-#include <boost/spirit/core.hpp>
-#include <boost/spirit/symbols/symbols.hpp>
+#include <boost/spirit/home/classic/core.hpp>
+#include <boost/spirit/home/classic/symbols/symbols.hpp>
-#include <boost/spirit/phoenix/tuples.hpp>
-#include <boost/spirit/phoenix/tuple_helpers.hpp>
-#include <boost/spirit/phoenix/primitives.hpp>
-#include <boost/spirit/attribute/closure.hpp>
+#include <boost/spirit/home/classic/phoenix/tuples.hpp>
+#include <boost/spirit/home/classic/phoenix/tuple_helpers.hpp>
+#include <boost/spirit/home/classic/phoenix/primitives.hpp>
+#include <boost/spirit/home/classic/attribute/closure.hpp>
///////////////////////////////////////////////////////////////////////////////
// used namespaces
-using namespace boost::spirit;
+using namespace boost::spirit::classic;
using namespace phoenix;
using namespace std;
@@ -99,7 +99,7 @@
// used closure type
//
///////////////////////////////////////////////////////////////////////////////
-struct var_decl_closure : boost::spirit::closure<var_decl_closure, declaration_type>
+struct var_decl_closure : boost::spirit::classic::closure<var_decl_closure, declaration_type>
{
member1 val;
};
@@ -116,7 +116,7 @@
{
public:
typedef
- symbol_inserter<T, boost::spirit::impl::tst<T, char> >
+ symbol_inserter<T, boost::spirit::classic::impl::tst<T, char> >
symbol_inserter_t;
symbols_with_data(symbol_inserter_t const &add_, InitT const &data_) :
@@ -140,7 +140,7 @@
template <typename T, typename CharT, typename InitT>
inline
symbols_with_data<T, InitT>
-symbols_gen(symbol_inserter<T, boost::spirit::impl::tst<T, CharT> > const &add_,
+symbols_gen(symbol_inserter<T, boost::spirit::classic::impl::tst<T, CharT> > const &add_,
InitT const &data_)
{
return symbols_with_data<T, InitT>(add_, data_);
Modified: trunk/dsim/test/boost/spirit/schedule_parser.cpp
===================================================================
--- trunk/dsim/test/boost/spirit/schedule_parser.cpp 2009-12-28 00:16:49 UTC (rev 23)
+++ trunk/dsim/test/boost/spirit/schedule_parser.cpp 2009-12-28 10:52:19 UTC (rev 24)
@@ -1,6 +1,5 @@
-// C
-#include <assert.h>
// STL
+#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
@@ -13,22 +12,22 @@
#include <boost/date_time/gregorian/gregorian.hpp>
// Boost Spirit (Parsing)
//#define BOOST_SPIRIT_DEBUG
-#include <boost/spirit/core.hpp>
-#include <boost/spirit/attribute.hpp>
-#include <boost/spirit/utility/functor_parser.hpp>
-#include <boost/spirit/utility/loops.hpp>
-#include <boost/spirit/utility/chset.hpp>
-#include <boost/spirit/utility/confix.hpp>
-#include <boost/spirit/iterator/file_iterator.hpp>
-#include <boost/spirit/actor/push_back_actor.hpp>
-#include <boost/spirit/actor/assign_actor.hpp>
+#include <boost/spirit/home/classic/core.hpp>
+#include <boost/spirit/home/classic/attribute.hpp>
+#include <boost/spirit/home/classic/utility/functor_parser.hpp>
+#include <boost/spirit/home/classic/utility/loops.hpp>
+#include <boost/spirit/home/classic/utility/chset.hpp>
+#include <boost/spirit/home/classic/utility/confix.hpp>
+#include <boost/spirit/home/classic/iterator/file_iterator.hpp>
+#include <boost/spirit/home/classic/actor/push_back_actor.hpp>
+#include <boost/spirit/home/classic/actor/assign_actor.hpp>
// Type definitions
typedef char char_t;
//typedef char const* iterator_t;
-typedef boost::spirit::file_iterator<char_t> iterator_t;
-typedef boost::spirit::scanner<iterator_t> scanner_t;
-typedef boost::spirit::rule<scanner_t> rule_t;
+typedef boost::spirit::classic::file_iterator<char_t> iterator_t;
+typedef boost::spirit::classic::scanner<iterator_t> scanner_t;
+typedef boost::spirit::classic::rule<scanner_t> rule_t;
/** LegCabin-Details. */
struct Cabin_T {
@@ -652,13 +651,13 @@
// /////////// Utilities /////////////
/** 1-digit-integer parser */
-boost::spirit::int_parser<unsigned int, 10, 1, 1> int1_p;
+boost::spirit::classic::int_parser<unsigned int, 10, 1, 1> int1_p;
/** 2-digit-integer parser */
-boost::spirit::uint_parser<int, 10, 2, 2> uint2_p;
+boost::spirit::classic::uint_parser<int, 10, 2, 2> uint2_p;
/** 4-digit-integer parser */
-boost::spirit::uint_parser<int, 10, 4, 4> uint4_p;
+boost::spirit::classic::uint_parser<int, 10, 4, 4> uint4_p;
/** Up-to-4-digit-integer parser */
-boost::spirit::uint_parser<int, 10, 1, 4> uint1_4_p;
+boost::spirit::classic::uint_parser<int, 10, 1, 4> uint1_4_p;
///////////////////////////////////////////////////////////////////////////////
//
@@ -706,11 +705,11 @@
EndOfFlight ::= ';'
*/
-using namespace boost::spirit;
+using namespace boost::spirit::classic;
/** Grammar for the Flight-Period parser. */
struct FlightPeriodParser :
- public boost::spirit::grammar<FlightPeriodParser> {
+ public boost::spirit::classic::grammar<FlightPeriodParser> {
FlightPeriodParser (FlightPeriod_T& ioFlightPeriod)
: _flightPeriod (ioFlightPeriod) {
@@ -720,8 +719,8 @@
struct definition {
definition (FlightPeriodParser const& self) {
- flight_period_list = *( boost::spirit::comment_p("//")
- | boost::spirit::comment_p("/*", "*/")
+ flight_period_list = *( boost::spirit::classic::comment_p("//")
+ | boost::spirit::classic::comment_p("/*", "*/")
| flight_period )
;
@@ -732,7 +731,7 @@
;
flight_period_end =
- boost::spirit::ch_p(';')
+ boost::spirit::classic::ch_p(';')
;
flight_key = airline_code
@@ -785,12 +784,12 @@
;
date_offset =
- boost::spirit::ch_p('/')
- >> (int1_p)[boost::spirit::assign_a(self._flightPeriod._dateOffSet)]
+ boost::spirit::classic::ch_p('/')
+ >> (int1_p)[boost::spirit::classic::assign_a(self._flightPeriod._dateOffSet)]
;
cabin_details = (chset_p("A-Z"))[store_cabin_code(self._flightPeriod)]
- >> ';' >> (boost::spirit::ureal_p)[store_capacity(self._flightPeriod)]
+ >> ';' >> (boost::spirit::classic::ureal_p)[store_capacity(self._flightPeriod)]
;
segment_key =
@@ -804,12 +803,12 @@
;
general_segments =
- boost::spirit::ch_p('0')[store_segment_specificity(self._flightPeriod)]
+ boost::spirit::classic::ch_p('0')[store_segment_specificity(self._flightPeriod)]
>> +(';' >> segment_cabin_details)
;
specific_segments =
- boost::spirit::ch_p('1')[store_segment_specificity(self._flightPeriod)]
+ boost::spirit::classic::ch_p('1')[store_segment_specificity(self._flightPeriod)]
>> +(';' >> segment_key >> full_segment_cabin_details)
;
@@ -844,13 +843,13 @@
BOOST_SPIRIT_DEBUG_NODE (segment_cabin_details);
}
- boost::spirit::rule<ScannerT> flight_period_list, flight_period,
+ boost::spirit::classic::rule<ScannerT> flight_period_list, flight_period,
flight_period_end, flight_key, airline_code, flight_number,
date, dow, leg, leg_key, leg_details, time, date_offset, cabin_details,
segment, segment_key, general_segments, specific_segments,
full_segment_cabin_details, segment_cabin_details;
- boost::spirit::rule<ScannerT> const& start() const { return flight_period_list; }
+ boost::spirit::classic::rule<ScannerT> const& start() const { return flight_period_list; }
};
FlightPeriod_T& _flightPeriod;
@@ -881,10 +880,10 @@
// Instantiate the structure that will hold the result of the parsing.
FlightPeriod_T lFlightPeriod;
FlightPeriodParser lFlightPeriodParser (lFlightPeriod);
- boost::spirit::parse_info<iterator_t> info =
- boost::spirit::parse (lFileIterator, lFileIteratorEnd,
+ boost::spirit::classic::parse_info<iterator_t> info =
+ boost::spirit::classic::parse (lFileIterator, lFileIteratorEnd,
lFlightPeriodParser,
- boost::spirit::space_p);
+ boost::spirit::classic::space_p);
// DEBUG
std::cout << "Flight Period:" << std::endl;
Modified: trunk/dsim/test/boost/spirit/search_string_parser.cpp
===================================================================
--- trunk/dsim/test/boost/spirit/search_string_parser.cpp 2009-12-28 00:16:49 UTC (rev 23)
+++ trunk/dsim/test/boost/spirit/search_string_parser.cpp 2009-12-28 10:52:19 UTC (rev 24)
@@ -1,6 +1,5 @@
-// C
-#include <assert.h>
// STL
+#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
@@ -13,22 +12,22 @@
#include <boost/date_time/gregorian/gregorian.hpp>
// Boost Spirit (Parsing)
#define BOOST_SPIRIT_DEBUG
-#include <boost/spirit/core.hpp>
-#include <boost/spirit/attribute.hpp>
-#include <boost/spirit/utility/functor_parser.hpp>
-#include <boost/spirit/utility/loops.hpp>
-#include <boost/spirit/utility/chset.hpp>
-#include <boost/spirit/utility/confix.hpp>
-#include <boost/spirit/iterator/file_iterator.hpp>
-#include <boost/spirit/actor/push_back_actor.hpp>
-#include <boost/spirit/actor/assign_actor.hpp>
+#include <boost/spirit/home/classic/core.hpp>
+#include <boost/spirit/home/classic/attribute.hpp>
+#include <boost/spirit/home/classic/utility/functor_parser.hpp>
+#include <boost/spirit/home/classic/utility/loops.hpp>
+#include <boost/spirit/home/classic/utility/chset.hpp>
+#include <boost/spirit/home/classic/utility/confix.hpp>
+#include <boost/spirit/home/classic/iterator/file_iterator.hpp>
+#include <boost/spirit/home/classic/actor/push_back_actor.hpp>
+#include <boost/spirit/home/classic/actor/assign_actor.hpp>
// Type definitions
typedef char char_t;
typedef char const* iterator_t;
-//typedef boost::spirit::file_iterator<char_t> iterator_t;
-typedef boost::spirit::scanner<iterator_t> scanner_t;
-typedef boost::spirit::rule<scanner_t> rule_t;
+//typedef boost::spirit::classic::file_iterator<char_t> iterator_t;
+typedef boost::spirit::classic::scanner<iterator_t> scanner_t;
+typedef boost::spirit::classic::rule<scanner_t> rule_t;
/** Place. */
struct Place_T {
@@ -321,19 +320,19 @@
// /////////// Utilities /////////////
/** 1-digit-integer parser */
-boost::spirit::int_parser<unsigned int, 10, 1, 1> int1_p;
+boost::spirit::classic::int_parser<unsigned int, 10, 1, 1> int1_p;
/** 1-digit-integer parser */
-boost::spirit::uint_parser<unsigned int, 10, 1, 1> uint1_p;
+boost::spirit::classic::uint_parser<unsigned int, 10, 1, 1> uint1_p;
/** Up-to-2-digit-integer parser */
-boost::spirit::uint_parser<unsigned int, 10, 1, 2> uint1_2_p;
+boost::spirit::classic::uint_parser<unsigned int, 10, 1, 2> uint1_2_p;
/** 2-digit-integer parser */
-boost::spirit::uint_parser<int, 10, 2, 2> uint2_p;
+boost::spirit::classic::uint_parser<int, 10, 2, 2> uint2_p;
/** Up-to-4-digit-integer parser */
-boost::spirit::uint_parser<int, 10, 2, 4> uint2_4_p;
+boost::spirit::classic::uint_parser<int, 10, 2, 4> uint2_4_p;
/** 4-digit-integer parser */
-boost::spirit::uint_parser<int, 10, 4, 4> uint4_p;
+boost::spirit::classic::uint_parser<int, 10, 4, 4> uint4_p;
/** Up-to-4-digit-integer parser */
-boost::spirit::uint_parser<int, 10, 1, 4> uint1_4_p;
+boost::spirit::classic::uint_parser<int, 10, 1, 4> uint1_4_p;
///////////////////////////////////////////////////////////////////////////////
//
@@ -366,11 +365,11 @@
pet_description ::= 'dog' | 'dogs' | 'cat' | 'cats'
*/
-using namespace boost::spirit;
+using namespace boost::spirit::classic;
/** Grammar for the search string parser. */
struct SearchStringParser :
- public boost::spirit::grammar<SearchStringParser> {
+ public boost::spirit::classic::grammar<SearchStringParser> {
SearchStringParser (SearchString_T& ioSearchString)
: _searchString (ioSearchString) {
@@ -401,9 +400,9 @@
date =
( month | day )
- >> boost::spirit::chset_p("/-")
+ >> boost::spirit::classic::chset_p("/-")
>> ( day | month )
- >> ! ( boost::spirit::chset_p("/-")
+ >> ! ( boost::spirit::classic::chset_p("/-")
>> year )
;
@@ -421,7 +420,7 @@
;
preferred_airlines =
- !(boost::spirit::sign_p)[store_airline_sign(self._searchString)]
+ !(boost::spirit::classic::sign_p)[store_airline_sign(self._searchString)]
>> airline_code | airline_name
;
@@ -478,13 +477,13 @@
BOOST_SPIRIT_DEBUG_NODE (passenger_pet_type);
}
- boost::spirit::rule<ScannerT> search_string, places, place_element,
+ boost::spirit::classic::rule<ScannerT> search_string, places, place_element,
dates, date, month, day, year,
preferred_airlines, airline_code, airline_name,
passengers, passenger_number, passenger_type, passenger_adult_type,
passenger_child_type, passenger_pet_type;
- boost::spirit::rule<ScannerT> const& start() const { return search_string; }
+ boost::spirit::classic::rule<ScannerT> const& start() const { return search_string; }
};
SearchString_T& _searchString;
@@ -501,9 +500,9 @@
// Instantiate the structure that will hold the result of the parsing.
SearchStringParser lSearchStringParser (ioSearchStringStruct);
- boost::spirit::parse_info<iterator_t> info =
- boost::spirit::parse (lStringIterator, lSearchStringParser,
- boost::spirit::space_p);
+ boost::spirit::classic::parse_info<iterator_t> info =
+ boost::spirit::classic::parse (lStringIterator, lSearchStringParser,
+ boost::spirit::classic::space_p);
oStream << "-------------------------" << std::endl;
Added: trunk/dsim/test/boost/spirit/spirit_parser.cpp
===================================================================
--- trunk/dsim/test/boost/spirit/spirit_parser.cpp (rev 0)
+++ trunk/dsim/test/boost/spirit/spirit_parser.cpp 2009-12-28 10:52:19 UTC (rev 24)
@@ -0,0 +1,90 @@
+// C
+#include <assert.h>
+// STL
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <string>
+#include <map>
+#include <vector>
+// Boost (Extended STL)
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/gregorian/gregorian.hpp>
+#include <boost/spirit/home/classic/core.hpp>
+#include <boost/spirit/home/classic/actor/push_back_actor.hpp>
+
+// Type definitions
+/** List of numbers. */
+typedef std::vector<double> NumberList_T;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Comma separated list parser
+//
+///////////////////////////////////////////////////////////////////////////////
+bool parse_numbers (const std::string& iInputString, NumberList_T& ioNbList) {
+ /** Grammar:
+ expression ::= real (',' real)*
+ */
+
+ const bool hasParsingSucceeded =
+ boost::spirit::classic::parse (iInputString.c_str(),
+ (
+ // Begin grammar
+ boost::spirit::classic::real_p[boost::spirit::classic::push_back_a(ioNbList)]
+ >> *(','
+ >> boost::spirit::classic::real_p[boost::spirit::classic::push_back_a(ioNbList)])
+ // End grammar
+ )
+ ,
+ boost::spirit::classic::space_p).full;
+
+ return hasParsingSucceeded;
+}
+
+// /////////////// M A I N /////////////////
+int main (int argc, char* argv[]) {
+ try {
+
+ // String to be parsed
+ std::string lToBeParsed ("10.5, 9.8, 7.456, 2.34");
+
+ // Read the command-line parameters
+ if (argc >= 1 && argv[1] != NULL) {
+ std::istringstream istr (argv[1]);
+ istr >> lToBeParsed;
+ }
+
+ std::cout << "String to be parsed: " << lToBeParsed << std::endl;
+
+ NumberList_T lNbList;
+ const bool hasParsingSucceeded = parse_numbers (lToBeParsed, lNbList);
+
+ if (hasParsingSucceeded == true) {
+ std::cout << "-------------------------" << std::endl;
+ std::cout << "Parsing succeeded: " << std::endl;
+
+ short i = 0;
+ for (NumberList_T::const_iterator itNb = lNbList.begin();
+ itNb != lNbList.end(); itNb++, i++) {
+ const double lNumber = *itNb;
+ std::cout << "[" << i << "]: " << lNumber << std::endl;
+ }
+
+ std::cout << "-------------------------" << std::endl;
+ } else {
+ std::cout << "-------------------------" << std::endl;
+ std::cout << "Parsing failed" << std::endl;
+ std::cout << "-------------------------" << std::endl;
+ }
+
+ } catch (const std::exception& stde) {
+ std::cerr << "Standard exception: " << stde.what() << std::endl;
+ return -1;
+
+ } catch (...) {
+ return -1;
+ }
+
+ return 0;
+}
Added: trunk/dsim/test/boost/spirit/subrule_parser.cpp
===================================================================
--- trunk/dsim/test/boost/spirit/subrule_parser.cpp (rev 0)
+++ trunk/dsim/test/boost/spirit/subrule_parser.cpp 2009-12-28 10:52:19 UTC (rev 24)
@@ -0,0 +1,129 @@
+/*=============================================================================
+ Copyright (c) 2002-2003 Joel de Guzman
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to 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)
+ =============================================================================*/
+///////////////////////////////////////////////////////////////////////////////
+//
+// This calculator example demontrates the use of subrules.
+// This is discussed in the "Subrule" chapter in the Spirit User's Guide.
+//
+// [ JDG 4/11/2002 ]
+//
+///////////////////////////////////////////////////////////////////////////////
+
+//#define BOOST_SPIRIT_DEBUG // define this for debug output
+#include <boost/spirit/home/classic/core.hpp>
+#include <iostream>
+#include <string>
+
+using namespace boost::spirit::classic;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Semantic actions
+//
+///////////////////////////////////////////////////////////////////////////////
+namespace {
+
+ void do_int (char const* str, char const* end) {
+ std::string s(str, end);
+ std::cout << "PUSH(" << s << ')' << std::endl;
+ }
+
+ void do_add(char const*, char const*) { std::cout << "ADD\n"; }
+ void do_subt(char const*, char const*) { std::cout << "SUBTRACT\n"; }
+ void do_mult(char const*, char const*) { std::cout << "MULTIPLY\n"; }
+ void do_div(char const*, char const*) { std::cout << "DIVIDE\n"; }
+ void do_neg(char const*, char const*) { std::cout << "NEGATE\n"; }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Our calculator grammar (using subrules)
+//
+///////////////////////////////////////////////////////////////////////////////
+struct calculator : public grammar<calculator> {
+ template <typename ScannerT>
+ struct definition {
+
+ definition(calculator const& /*self*/) {
+ first = (
+
+ expression =
+ term
+ >> *( ('+' >> term)[&do_add]
+ | ('-' >> term)[&do_subt]
+ )
+ ,
+
+ term =
+ factor
+ >> *( ('*' >> factor)[&do_mult]
+ | ('/' >> factor)[&do_div]
+ )
+ ,
+
+ factor
+ = lexeme_d[(+digit_p)[&do_int]]
+ | '(' >> expression >> ')'
+ | ('-' >> factor)[&do_neg]
+ | ('+' >> factor)
+ );
+
+ BOOST_SPIRIT_DEBUG_NODE(first);
+ BOOST_SPIRIT_DEBUG_NODE(expression);
+ BOOST_SPIRIT_DEBUG_NODE(term);
+ BOOST_SPIRIT_DEBUG_NODE(factor);
+ }
+
+ subrule<0> expression;
+ subrule<1> term;
+ subrule<2> factor;
+
+ rule<ScannerT> first;
+ rule<ScannerT> const&
+ start() const { return first; }
+ };
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Main program
+//
+///////////////////////////////////////////////////////////////////////////////
+int main() {
+ std::cout << "/////////////////////////////////////////////////////////\n\n";
+ std::cout << "\t\tA calculator using subrules...\n\n";
+ std::cout << "/////////////////////////////////////////////////////////\n\n";
+ std::cout << "Type an expression...or [q or Q] to quit\n\n";
+
+ calculator calc; // Our parser
+
+ std::string str;
+ while (getline (std::cin, str)) {
+ if (str.empty() || str[0] == 'q' || str[0] == 'Q') {
+ break;
+ }
+
+ parse_info<> info = parse(str.c_str(), calc, space_p);
+
+ if (info.full) {
+ std::cout << "-------------------------" << std::endl;
+ std::cout << "Parsing succeeded" << std::endl;
+ std::cout << "-------------------------" << std::endl;
+
+ } else {
+ std::cout << "-------------------------" << std::endl;
+ std::cout << "Parsing failed" << std::endl;
+ std::cout << "stopped at: \": " << info.stop << "\"" << std::endl;
+ std::cout << "-------------------------" << std::endl;
+ }
+ }
+
+ std::cout << "Bye... :-)" << std::endl << std::endl;
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-28 01:33:40
|
Revision: 23
http://dsim.svn.sourceforge.net/dsim/?rev=23&view=rev
Author: denis_arnaud
Date: 2009-12-28 00:16:49 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[Test] Added Boost.MPI tutorial simple examples.
Modified Paths:
--------------
trunk/dsim/test/boost/mpi/Makefile.am
trunk/dsim/test/boost/mpi/mpi.cpp
Added Paths:
-----------
trunk/dsim/test/boost/mpi/mpi_p2p.cpp
Property Changed:
----------------
trunk/dsim/test/boost/mpi/
Property changes on: trunk/dsim/test/boost/mpi
___________________________________________________________________
Modified: svn:ignore
- .deps
.libs
Makefile.in
Makefile
mpi_c
mpi
+ .deps
.libs
Makefile.in
Makefile
mpi_c
mpi
mpi_p2p
Modified: trunk/dsim/test/boost/mpi/Makefile.am
===================================================================
--- trunk/dsim/test/boost/mpi/Makefile.am 2009-12-26 01:46:01 UTC (rev 22)
+++ trunk/dsim/test/boost/mpi/Makefile.am 2009-12-28 00:16:49 UTC (rev 23)
@@ -3,7 +3,7 @@
MAINTAINERCLEANFILES = Makefile.in
-check_PROGRAMS = mpi_c mpi
+check_PROGRAMS = mpi_c mpi mpi_p2p
# mpi_c must be compiled with mpic++
# Note: mpic++/mpiCC is a wrapper around the MPI C++ compiler, and knows
@@ -17,4 +17,9 @@
mpi_LDFLAGS = $(BOOST_LIBS) $(BOOST_MPI_LIB)
mpi_LDADD =
+mpi_p2p_SOURCES = mpi_p2p.cpp
+mpi_p2p_CXXFLAGS = $(BOOST_CFLAGS) $(MPICH2_CFLAGS)
+mpi_p2p_LDFLAGS = $(BOOST_LIBS) $(BOOST_MPI_LIB)
+mpi_p2p_LDADD =
+
EXTRA_DIST =
Modified: trunk/dsim/test/boost/mpi/mpi.cpp
===================================================================
--- trunk/dsim/test/boost/mpi/mpi.cpp 2009-12-26 01:46:01 UTC (rev 22)
+++ trunk/dsim/test/boost/mpi/mpi.cpp 2009-12-28 00:16:49 UTC (rev 23)
@@ -7,14 +7,14 @@
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
-// /////////// M A I N ////////////////
+
+// ///////////////////////// M A I N ///////////////////////////
int main (int argc, char* argv[]) {
- // boost::mpi::environment env (argc, argv);
- // boost::mpi::communicator world;
- //std::cout << "I am process " << world.rank() << " of " << world.size()
- // << "." << std::endl;
- std::cout << "OpenMPI should run, but not Boost.MPI yet" << std::endl;
+ boost::mpi::environment env (argc, argv);
+ boost::mpi::communicator world;
+ std::cout << "I am process " << world.rank() << " of " << world.size()
+ << "." << std::endl;
return 0;
}
Added: trunk/dsim/test/boost/mpi/mpi_p2p.cpp
===================================================================
--- trunk/dsim/test/boost/mpi/mpi_p2p.cpp (rev 0)
+++ trunk/dsim/test/boost/mpi/mpi_p2p.cpp 2009-12-28 00:16:49 UTC (rev 23)
@@ -0,0 +1,33 @@
+// STL
+#include <iostream>
+#include <string>
+// Boost.MPI
+#include <boost/mpi.hpp>
+#include <boost/serialization/string.hpp>
+
+
+// ///////////////////////// M A I N ///////////////////////////
+int main (int argc, char* argv[]) {
+ boost::mpi::environment env (argc, argv);
+ boost::mpi::communicator world;
+
+ if (world.rank() == 0) {
+ world.send (1, 0, std::string("Hello"));
+
+ std::string msg;
+ world.recv(1, 1, msg);
+
+ std::cout << msg << "!" << std::endl;
+
+ } else {
+ std::string msg;
+ world.recv (0, 0, msg);
+
+ std::cout << msg << ", ";
+ std::cout.flush();
+
+ world.send (0, 1, std::string ("world"));
+ }
+
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-26 01:46:09
|
Revision: 22
http://dsim.svn.sourceforge.net/dsim/?rev=22&view=rev
Author: denis_arnaud
Date: 2009-12-26 01:46:01 +0000 (Sat, 26 Dec 2009)
Log Message:
-----------
[Test] Added a simple test to check the MPI installation.
Modified Paths:
--------------
trunk/dsim/test/boost/mpi/Makefile.am
Added Paths:
-----------
trunk/dsim/test/boost/mpi/mpi_c.cpp
Modified: trunk/dsim/test/boost/mpi/Makefile.am
===================================================================
--- trunk/dsim/test/boost/mpi/Makefile.am 2009-12-26 01:40:41 UTC (rev 21)
+++ trunk/dsim/test/boost/mpi/Makefile.am 2009-12-26 01:46:01 UTC (rev 22)
@@ -3,12 +3,14 @@
MAINTAINERCLEANFILES = Makefile.in
-check_PROGRAMS = mpi
+check_PROGRAMS = mpi_c mpi
-#mpi_c_SOURCES = mpi_c.cpp
-#mpi_c_CXXFLAGS = $(MPICH2_CFLAGS)
-#mpi_c_LDFLAGS = $(MPICH2_LIB)
-#mpi_c_LDADD =
+# mpi_c must be compiled with mpic++
+# Note: mpic++/mpiCC is a wrapper around the MPI C++ compiler, and knows
+# where MPI is installed. So, there is no need to specify any other
+# CFLAGS or LDFLAGS at that stage.
+mpi_c: mpi_c.cpp
+ mpic++ -o $@ $<
mpi_SOURCES = mpi.cpp
mpi_CXXFLAGS = $(BOOST_CFLAGS) $(MPICH2_CFLAGS)
Added: trunk/dsim/test/boost/mpi/mpi_c.cpp
===================================================================
--- trunk/dsim/test/boost/mpi/mpi_c.cpp (rev 0)
+++ trunk/dsim/test/boost/mpi/mpi_c.cpp 2009-12-26 01:46:01 UTC (rev 22)
@@ -0,0 +1,35 @@
+//
+// Simple test of MPI, just to check that a MPI library is installed correctly
+//Source: http://www.boost.org/doc/libs/1_41_0/doc/html/mpi/getting_started.html
+#include <mpi.h>
+#include <iostream>
+
+// ///////////////////// M A I N //////////////////////
+int main(int argc, char* argv[]) {
+ MPI_Init (&argc, &argv);
+
+ int rank = -1;
+
+ MPI_Comm_rank (MPI_COMM_WORLD, &rank);
+
+ if (rank == 0) {
+ int value = 17;
+ int result = MPI_Send(&value, 1, MPI_INT, 1, 0, MPI_COMM_WORLD);
+
+ if (result == MPI_SUCCESS) {
+ std::cout << "Rank 0 OK!" << std::endl;
+ }
+
+ } else if (rank == 1) {
+ int value;
+ int result = MPI_Recv(&value, 1, MPI_INT, 0, 0, MPI_COMM_WORLD,
+ MPI_STATUS_IGNORE);
+
+ if (result == MPI_SUCCESS && value == 17)
+ std::cout << "Rank 1 OK!" << std::endl;
+ }
+
+ MPI_Finalize();
+
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-26 01:40:52
|
Revision: 21
http://dsim.svn.sourceforge.net/dsim/?rev=21&view=rev
Author: denis_arnaud
Date: 2009-12-26 01:40:41 +0000 (Sat, 26 Dec 2009)
Log Message:
-----------
[Test] Created a dedicated test suite for Boost tests.
Modified Paths:
--------------
trunk/dsim/Makefile.am
trunk/dsim/configure.ac
trunk/dsim/test/Makefile.am
Added Paths:
-----------
trunk/dsim/test/boost/
trunk/dsim/test/boost/Makefile.am
trunk/dsim/test/boost/accumulators/
trunk/dsim/test/boost/accumulators/Makefile.am
trunk/dsim/test/boost/accumulators/accu.cpp
trunk/dsim/test/boost/asio/
trunk/dsim/test/boost/asio/Makefile.am
trunk/dsim/test/boost/asio/daytime1.cpp
trunk/dsim/test/boost/asio/daytime2.cpp
trunk/dsim/test/boost/asio/daytime3.cpp
trunk/dsim/test/boost/asio/daytime4.cpp
trunk/dsim/test/boost/asio/daytime5.cpp
trunk/dsim/test/boost/asio/daytime6.cpp
trunk/dsim/test/boost/asio/daytime7.cpp
trunk/dsim/test/boost/asio/httpd/
trunk/dsim/test/boost/asio/httpd/Makefile.am
trunk/dsim/test/boost/asio/httpd/connection.cpp
trunk/dsim/test/boost/asio/httpd/connection.hpp
trunk/dsim/test/boost/asio/httpd/header.hpp
trunk/dsim/test/boost/asio/httpd/mime_types.cpp
trunk/dsim/test/boost/asio/httpd/mime_types.hpp
trunk/dsim/test/boost/asio/httpd/posix_main.cpp
trunk/dsim/test/boost/asio/httpd/reply.cpp
trunk/dsim/test/boost/asio/httpd/reply.hpp
trunk/dsim/test/boost/asio/httpd/request.hpp
trunk/dsim/test/boost/asio/httpd/request_handler.cpp
trunk/dsim/test/boost/asio/httpd/request_handler.hpp
trunk/dsim/test/boost/asio/httpd/request_parser.cpp
trunk/dsim/test/boost/asio/httpd/request_parser.hpp
trunk/dsim/test/boost/asio/httpd/server.cpp
trunk/dsim/test/boost/asio/httpd/server.hpp
trunk/dsim/test/boost/asio/httpd/win_main.cpp
trunk/dsim/test/boost/asio/logd/
trunk/dsim/test/boost/asio/logd/Makefile.am
trunk/dsim/test/boost/asio/logd/log/
trunk/dsim/test/boost/asio/logd/logd.cpp
trunk/dsim/test/boost/asio/logger/
trunk/dsim/test/boost/asio/logger/Makefile.am
trunk/dsim/test/boost/asio/logger/basic_logger.hpp
trunk/dsim/test/boost/asio/logger/daytime_client.cpp
trunk/dsim/test/boost/asio/logger/logger.hpp
trunk/dsim/test/boost/asio/logger/logger_service.cpp
trunk/dsim/test/boost/asio/logger/logger_service.hpp
trunk/dsim/test/boost/asio/logger/stream_socket_service.hpp
trunk/dsim/test/boost/asio/timer1.cpp
trunk/dsim/test/boost/asio/timer2.cpp
trunk/dsim/test/boost/asio/timer3.cpp
trunk/dsim/test/boost/asio/timer4.cpp
trunk/dsim/test/boost/asio/timer5.cpp
trunk/dsim/test/boost/mpi/
trunk/dsim/test/boost/mpi/Makefile.am
trunk/dsim/test/boost/mpi/mpi.cpp
trunk/dsim/test/boost/mpi/pympi.py
trunk/dsim/test/boost/mpl/
trunk/dsim/test/boost/mpl/Makefile.am
trunk/dsim/test/boost/mpl/mpl.cpp
trunk/dsim/test/boost/mpl/test_mpl.sh
trunk/dsim/test/boost/serialization/
trunk/dsim/test/boost/serialization/Makefile.am
trunk/dsim/test/boost/serialization/serial1.cpp
trunk/dsim/test/boost/signals/
trunk/dsim/test/boost/signals/Makefile.am
trunk/dsim/test/boost/signals/multislots.cpp
trunk/dsim/test/boost/spirit/
trunk/dsim/test/boost/spirit/Makefile.am
trunk/dsim/test/boost/spirit/full_calculator.cpp
trunk/dsim/test/boost/spirit/levenshtein.cpp
trunk/dsim/test/boost/spirit/levenshtein_new.cpp
trunk/dsim/test/boost/spirit/parameter_parser.cpp
trunk/dsim/test/boost/spirit/schedule_parser.cpp
trunk/dsim/test/boost/spirit/search_string_parser.cpp
trunk/dsim/test/boost/spirit/test_full_calculator.sh
trunk/dsim/test/boost/spirit/test_parameter_parser.sh
trunk/dsim/test/boost/spirit/test_schedule_parser.sh
trunk/dsim/test/boost/spirit/world_schedule.csv
Modified: trunk/dsim/Makefile.am
===================================================================
--- trunk/dsim/Makefile.am 2009-12-24 16:05:27 UTC (rev 20)
+++ trunk/dsim/Makefile.am 2009-12-26 01:40:41 UTC (rev 21)
@@ -25,7 +25,7 @@
EXTRA_DIST =
# Build in these directories:
-SUBDIRS = stdair trademgen airsched airinv simcrs rmol $(TEST_DIR)
+SUBDIRS = stdair trademgen airsched airinv simcrs rmol dsim $(TEST_DIR)
# Configuration helpers
Modified: trunk/dsim/configure.ac
===================================================================
--- trunk/dsim/configure.ac 2009-12-24 16:05:27 UTC (rev 20)
+++ trunk/dsim/configure.ac 2009-12-26 01:40:41 UTC (rev 21)
@@ -464,6 +464,17 @@
dsim/core/Makefile
dsim/batches/Makefile
test/Makefile
+ test/boost/Makefile
+ test/boost/accumulators/Makefile
+ test/boost/asio/Makefile
+ test/boost/asio/httpd/Makefile
+ test/boost/asio/logd/Makefile
+ test/boost/asio/logger/Makefile
+ test/boost/mpi/Makefile
+ test/boost/mpl/Makefile
+ test/boost/spirit/Makefile
+ test/boost/serialization/Makefile
+ test/boost/signals/Makefile
)
AC_OUTPUT
Modified: trunk/dsim/test/Makefile.am
===================================================================
--- trunk/dsim/test/Makefile.am 2009-12-24 16:05:27 UTC (rev 20)
+++ trunk/dsim/test/Makefile.am 2009-12-26 01:40:41 UTC (rev 21)
@@ -4,7 +4,7 @@
MAINTAINERCLEANFILES = Makefile.in
##
-SUBDIRS =
+SUBDIRS = boost
##
check_PROGRAMS = simulate
Property changes on: trunk/dsim/test/boost
___________________________________________________________________
Added: svn:ignore
+ .deps
.libs
Makefile.in
Makefile
Added: trunk/dsim/test/boost/Makefile.am
===================================================================
--- trunk/dsim/test/boost/Makefile.am (rev 0)
+++ trunk/dsim/test/boost/Makefile.am 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,9 @@
+## test/boost sub-directory
+include $(top_srcdir)/Makefile.common
+
+##
+SUBDIRS = accumulators asio mpi mpl serialization signals spirit
+
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST =
Property changes on: trunk/dsim/test/boost/accumulators
___________________________________________________________________
Added: svn:ignore
+ .deps
.libs
Makefile.in
Makefile
accu
Added: trunk/dsim/test/boost/accumulators/Makefile.am
===================================================================
--- trunk/dsim/test/boost/accumulators/Makefile.am (rev 0)
+++ trunk/dsim/test/boost/accumulators/Makefile.am 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,21 @@
+## test/architecture sub-directory
+include $(top_srcdir)/Makefile.common
+
+MAINTAINERCLEANFILES = Makefile.in
+
+##
+SUBDIRS =
+
+EXTRA_DIST =
+##
+
+check_PROGRAMS = accu
+#TESTS = $(check_PROGRAMS)
+TESTS =
+XFAIL_TESTS = #IndexBuildingTestSuite
+
+accu_SOURCES = accu.cpp
+accu_CXXFLAGS= $(BOOST_CFLAGS)
+accu_LDFLAGS = $(BOOST_LIBS)
+accu_LDADD =
+
Added: trunk/dsim/test/boost/accumulators/accu.cpp
===================================================================
--- trunk/dsim/test/boost/accumulators/accu.cpp (rev 0)
+++ trunk/dsim/test/boost/accumulators/accu.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,171 @@
+// STL
+#include <iostream>
+#include <algorithm>
+// Boost
+#include <boost/ref.hpp>
+#include <boost/bind.hpp>
+#include <boost/array.hpp>
+#include <boost/foreach.hpp>
+// Boost Accumulators
+#include <boost/accumulators/accumulators.hpp>
+#include <boost/accumulators/statistics.hpp>
+
+// using namespace boost;
+namespace boostacc = boost::accumulators;
+
+// Helper that uses BOOST_FOREACH to display a range of doubles
+template<typename Range>
+void output_range(Range const &rng) {
+ bool first = true;
+ BOOST_FOREACH(double d, rng) {
+ if(!first) std::cout << ", ";
+ std::cout << d;
+ first = false;
+ }
+ std::cout << '\n';
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// example1
+//
+// Calculate some useful stats using accumulator_set<> and std::for_each()
+//
+void example1() {
+ boostacc::accumulator_set<double,
+ boostacc::stats<boostacc::tag::min,
+ boostacc::tag::mean(boostacc::immediate),
+ boostacc::tag::sum,
+ boostacc::tag::moment<2> > > acc;
+
+ boost::array<double, 4> data = {0., 1., -1., 3.14159};
+
+ // std::for_each pushes each sample into the accumulator one at a
+ // time, and returns a copy of the accumulator.
+ acc = std::for_each(data.begin(), data.end(), acc);
+
+ // The following would be equivalent, and could be more efficient
+ // because it doesn't pass and return the entire accumulator set
+ // by value.
+ //std::for_each(data.begin(), data.end(), bind<void>(ref(acc), _1));
+
+ std::cout << " min(acc) = " << (boostacc::min)(acc) << std::endl;
+ std::cout << " mean(acc) = " << boostacc::mean(acc) << std::endl;
+
+ // since mean depends on count and sum, we can get their results, too.
+ std::cout << " count(acc) = " << boostacc::count(acc) << std::endl;
+ std::cout << " sum(acc) = " << boostacc::sum(acc) << std::endl;
+ std::cout << " moment<2>(acc) = " << boostacc::moment<2>(acc) << std::endl;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// example2
+//
+// Calculate some tail statistics. This demonstrates how to specify
+// constructor and accumulator parameters. Note that the tail statistics
+// return multiple values, which are returned in an iterator_range.
+//
+// It pushes data in and displays the intermediate results to demonstrate
+// how the tail statistics are updated.
+void example2() {
+ // An accumulator which tracks the right tail (largest N items) and
+ // some data that are covariate with them. N == 4.
+ boostacc::accumulator_set<double,
+ boostacc::stats<
+ boostacc::tag::tail_variate<double,
+ boostacc::tag::covariate1, boostacc::right> > > acc (boostacc::tag::tail<boostacc::right>::cache_size = 4);
+
+ acc(2.1, boostacc::covariate1 = .21);
+ acc(1.1, boostacc::covariate1 = .11);
+ acc(2.1, boostacc::covariate1 = .21);
+ acc(1.1, boostacc::covariate1 = .11);
+
+ std::cout << " tail = "; output_range(boostacc::tail(acc));
+ std::cout << " tail_variate = "; output_range(boostacc::tail_variate(acc));
+ std::cout << std::endl;
+
+ acc(21.1, boostacc::covariate1 = 2.11);
+ acc(11.1, boostacc::covariate1 = 1.11);
+ acc(21.1, boostacc::covariate1 = 2.11);
+ acc(11.1, boostacc::covariate1 = 1.11);
+
+ std::cout << " tail = "; output_range(boostacc::tail(acc));
+ std::cout << " tail_variate = "; output_range(boostacc::tail_variate(acc));
+ std::cout << std::endl;
+
+ acc(42.1, boostacc::covariate1 = 4.21);
+ acc(41.1, boostacc::covariate1 = 4.11);
+ acc(42.1, boostacc::covariate1 = 4.21);
+ acc(41.1, boostacc::covariate1 = 4.11);
+
+ std::cout << " tail = "; output_range(boostacc::tail(acc));
+ std::cout << " tail_variate = "; output_range(boostacc::tail_variate(acc));
+ std::cout << std::endl;
+
+ acc(32.1, boostacc::covariate1 = 3.21);
+ acc(31.1, boostacc::covariate1 = 3.11);
+ acc(32.1, boostacc::covariate1 = 3.21);
+ acc(31.1, boostacc::covariate1 = 3.11);
+
+ std::cout << " tail = "; output_range(boostacc::tail(acc));
+ std::cout << " tail_variate = "; output_range(boostacc::tail_variate(acc));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// example3
+//
+// Demonstrate how to calculate weighted statistics. This example demonstrates
+// both a simple weighted statistical calculation, and a more complicated
+// calculation where the weight statistics are calculated and stored in an
+// external weight accumulataor.
+void example3() {
+ // weight == double
+ double w = 1.;
+
+ // Simple weighted calculation
+ {
+ // stats that depend on the weight are made external
+ boostacc::accumulator_set<double,
+ boostacc::stats<boostacc::tag::mean>, double> acc;
+
+ acc(0., boostacc::weight = w);
+ acc(1., boostacc::weight = w);
+ acc(-1., boostacc::weight = w);
+ acc(3.14159, boostacc::weight = w);
+
+ std::cout << " mean(acc) = " << boostacc::mean(acc) << std::endl;
+ }
+
+ // Weighted calculation with an external weight accumulator
+ {
+ // stats that depend on the weight are made external
+ boostacc::accumulator_set<double, boostacc::stats<boostacc::tag::mean>,
+ boostacc::external<double> > acc;
+
+ // Here's an external weight accumulator
+ boostacc::accumulator_set<void, boostacc::stats<boostacc::tag::sum_of_weights>, double> weight_acc;
+
+ weight_acc(boostacc::weight = w); acc(0., boostacc::weight = w);
+ weight_acc(boostacc::weight = w); acc(1., boostacc::weight = w);
+ weight_acc(boostacc::weight = w); acc(-1., boostacc::weight = w);
+ weight_acc(boostacc::weight = w); acc(3.14159, boostacc::weight = w);
+
+ std::cout << " mean(acc) = "
+ << boostacc::mean(acc, boostacc::weights = weight_acc)
+ << std::endl;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// main
+int main (int argc, char* argv[]) {
+ std::cout << "Example 1:" << std::endl;
+ example1();
+
+ std::cout << std::endl << "Example 2:" << std::endl;
+ example2();
+
+ std::cout << std::endl << "Example 3:" << std::endl;
+ example3();
+
+ return 0;
+}
Property changes on: trunk/dsim/test/boost/asio
___________________________________________________________________
Added: svn:ignore
+ .deps
.libs
Makefile.in
Makefile
daytime1
daytime2
daytime3
daytime4
daytime5
daytime6
daytime7
timer1
timer2
timer3
timer4
timer5
Added: trunk/dsim/test/boost/asio/Makefile.am
===================================================================
--- trunk/dsim/test/boost/asio/Makefile.am (rev 0)
+++ trunk/dsim/test/boost/asio/Makefile.am 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,72 @@
+## test/asio sub-directory
+include $(top_srcdir)/Makefile.common
+
+##
+SUBDIRS = logger logd httpd
+
+MAINTAINERCLEANFILES = Makefile.in
+
+check_PROGRAMS = timer1 timer2 timer3 timer4 timer5 \
+ daytime1 daytime2 daytime3 daytime4 daytime5 daytime6 daytime7
+
+timer1_SOURCES = timer1.cpp
+timer1_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+timer1_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+timer1_LDADD =
+
+timer2_SOURCES = timer2.cpp
+timer2_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+timer2_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+timer2_LDADD =
+
+timer3_SOURCES = timer3.cpp
+timer3_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+timer3_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+timer3_LDADD =
+
+timer4_SOURCES = timer4.cpp
+timer4_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+timer4_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+timer4_LDADD =
+
+timer5_SOURCES = timer5.cpp
+timer5_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+timer5_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+timer5_LDADD =
+
+daytime1_SOURCES = daytime1.cpp
+daytime1_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+daytime1_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+daytime1_LDADD =
+
+daytime2_SOURCES = daytime2.cpp
+daytime2_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+daytime2_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+daytime2_LDADD =
+
+daytime3_SOURCES = daytime3.cpp
+daytime3_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+daytime3_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+daytime3_LDADD =
+
+daytime4_SOURCES = daytime4.cpp
+daytime4_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+daytime4_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+daytime4_LDADD =
+
+daytime5_SOURCES = daytime5.cpp
+daytime5_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+daytime5_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+daytime5_LDADD =
+
+daytime6_SOURCES = daytime6.cpp
+daytime6_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+daytime6_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+daytime6_LDADD =
+
+daytime7_SOURCES = daytime7.cpp
+daytime7_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+daytime7_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+daytime7_LDADD =
+
+EXTRA_DIST =
Added: trunk/dsim/test/boost/asio/daytime1.cpp
===================================================================
--- trunk/dsim/test/boost/asio/daytime1.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/daytime1.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,82 @@
+// Boost.ASIO Tutorial - Daytime1:
+// http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tutdaytime1.html
+// STL
+#include <iostream>
+#include <string>
+// Boost.ASIO
+#include <boost/asio.hpp>
+#include <boost/array.hpp>
+
+// /////////// M A I N ////////////////
+int main (int argc, char* argv[]) {
+
+ // Host name
+ std::string lHostname = "localhost";
+
+ // Service name (as specified within /etc/services)
+ // The "aria" service corresponds to the port 2624
+ const std::string lServiceName = "aria";
+
+ try {
+
+ if (argc >= 2) {
+ lHostname = argv[1];
+ }
+
+ boost::asio::io_service lIOService;
+
+ boost::asio::ip::tcp::resolver lResolver (lIOService);
+
+ boost::asio::ip::tcp::resolver::query lQuery (lHostname, lServiceName);
+
+ boost::asio::ip::tcp::resolver::iterator itEndPoint =
+ lResolver.resolve (lQuery);
+ boost::asio::ip::tcp::resolver::iterator lEnd;
+
+ boost::asio::ip::tcp::socket lSocket (lIOService);
+ boost::system::error_code lError = boost::asio::error::host_not_found;
+
+ while (lError && itEndPoint != lEnd) {
+ const boost::asio::ip::tcp::endpoint lEndPoint = *itEndPoint;
+
+ // DEBUG
+ std::cout << "Testing end point: " << std::endl;
+
+ lSocket.close();
+ lSocket.connect (lEndPoint, lError);
+ ++itEndPoint;
+ }
+
+ if (lError) {
+ throw boost::system::system_error (lError);
+ }
+ assert (!lError);
+
+ // DEBUG
+ const boost::asio::ip::tcp::endpoint lValidEndPoint;
+ std::cout << "Valid end point: " << lValidEndPoint << std::endl;
+
+ for (;;) {
+ boost::array<char, 128> lBuffer;
+ boost::system::error_code lError;
+
+ size_t lLength = lSocket.read_some (boost::asio::buffer (lBuffer), lError);
+
+ if (lError == boost::asio::error::eof) {
+ // Connection closed cleanly by peer.
+ break;
+
+ } else if (lError) {
+ // Some other error.
+ throw boost::system::system_error (lError);
+ }
+
+ std::cout.write (lBuffer.data(), lLength);
+ }
+
+ } catch (std::exception& lException) {
+ std::cerr << lException.what() << std::endl;
+ }
+
+ return 0;
+}
Added: trunk/dsim/test/boost/asio/daytime2.cpp
===================================================================
--- trunk/dsim/test/boost/asio/daytime2.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/daytime2.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,46 @@
+// Boost.ASIO Tutorial - Daytime2:
+// http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tutdaytime2.html
+// STL
+#include <iostream>
+#include <string>
+#include <ctime>
+// Boost.ASIO
+#include <iostream>
+#include <boost/asio.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+// //////////////////////////////////////////////////////////
+std::string make_daytime_string() {
+ const std::time_t now = std::time(0);
+ return std::ctime (&now);
+}
+
+// //////////////////// M A I N /////////////////////////////
+int main (int argc, char* argv[]) {
+
+ try {
+
+ boost::asio::io_service lIOService;
+
+ // Create a listener for IP/TCP v4, listening on port 2624 (corresponding
+ // to the "aria" service, as specified within the /etc/services file)
+ boost::asio::ip::tcp::acceptor lAcceptor (lIOService,
+ boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), 2624));
+
+ for (;;) {
+ boost::asio::ip::tcp::socket lSocket (lIOService);
+ lAcceptor.accept (lSocket);
+ const std::string lMessage = make_daytime_string();
+
+ boost::system::error_code lIgnoredError;
+ boost::asio::write (lSocket, boost::asio::buffer (lMessage),
+ boost::asio::transfer_all(), lIgnoredError);
+ }
+
+ } catch (std::exception& lException) {
+ std::cerr << lException.what() << std::endl;
+ }
+
+ return 0;
+}
+
Added: trunk/dsim/test/boost/asio/daytime3.cpp
===================================================================
--- trunk/dsim/test/boost/asio/daytime3.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/daytime3.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,145 @@
+// Boost.ASIO Tutorial - Daytime3:
+// http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tutdaytime3.html
+// STL
+#include <cassert>
+#include <ctime>
+#include <iostream>
+#include <string>
+// Boost.ASIO
+#include <iostream>
+#include <boost/asio.hpp>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+// //////////////////////////////////////////////////////////
+std::string make_daytime_string() {
+ const std::time_t now = std::time(0);
+ return std::ctime (&now);
+}
+
+// //////////////////////////////////////////////////////////
+/** Class handling TCP connections for a given server. */
+class TCPConnection :
+ public boost::enable_shared_from_this<TCPConnection> {
+public:
+ /** Pointer on a TCP connection. */
+ typedef boost::shared_ptr<TCPConnection> Pointer_T;
+
+ /** Create a TCP connection, from a given Boost.ASIO service. */
+ static Pointer_T create (boost::asio::io_service& ioIOService) {
+ TCPConnection* oConnectionPtr = new TCPConnection (ioIOService);
+ assert (oConnectionPtr != NULL);
+ return Pointer_T (oConnectionPtr);
+ }
+
+ /** Get the underlying TCP socket. */
+ boost::asio::ip::tcp::socket& socket() {
+ return _socket;
+ }
+
+ /** Process the incoming client request, by giving it back the time of day. */
+ void start() {
+
+ _message = make_daytime_string();
+
+ boost::system::error_code lIgnoredError;
+ boost::asio::async_write (_socket, boost::asio::buffer (_message),
+ boost::bind (&TCPConnection::handleWrite,
+ shared_from_this(),
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred));
+ }
+
+
+private:
+ // //////////// Constructors & Destructors /////////////
+ /** Constructor. */
+ TCPConnection (boost::asio::io_service& ioIOService)
+ : _socket (ioIOService) {
+ }
+
+ void handleWrite (const boost::system::error_code& iErrorCode,
+ const size_t iTransferredBytes) {
+ }
+
+
+private:
+ // ///////////////// Technical Methods ///////////////////
+
+
+private:
+ // /////////// Attributes /////////////
+ /** Time of day. */
+ std::string _message;
+
+ /** TCP/IP socket. */
+ boost::asio::ip::tcp::socket _socket;
+};
+
+
+/** Class starting a TCP server, and handling incoming requests. */
+class TCPServer {
+public:
+ // //////////// Constructors & Destructors /////////////
+ /** Constructor.
+ <br>Create a listener for IP/TCP v4, listening on port 2624 (corresponding
+ to the "aria" service, as specified within the /etc/services file) */
+ TCPServer (boost::asio::io_service& ioIOService)
+ : _acceptor (ioIOService,
+ boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(),
+ 2624)) {
+ startAccept();
+ }
+
+
+private:
+ // ///////////////// Technical Methods ///////////////////
+ /** Accept (socket) connection from any client. */
+ void startAccept() {
+ TCPConnection::Pointer_T lConnection =
+ TCPConnection::create (_acceptor.io_service());
+
+ boost::asio::ip::tcp::socket& lSocket = lConnection->socket();
+ _acceptor.async_accept (lSocket,
+ boost::bind (&TCPServer::handleAccept, this,
+ lConnection,
+ boost::asio::placeholders::error));
+ }
+
+ /** Process the (socket) connection from any client. */
+ void handleAccept (TCPConnection::Pointer_T ioConnection,
+ const boost::system::error_code& iError) {
+
+ if (!iError) {
+ ioConnection->start();
+ startAccept();
+ }
+ }
+
+
+private:
+ // /////////// Attributes /////////////
+ /** Connection acceptor. */
+ boost::asio::ip::tcp::acceptor _acceptor;
+};
+
+
+// //////////////////// M A I N /////////////////////////////
+int main (int argc, char* argv[]) {
+
+ try {
+
+ boost::asio::io_service lIOService;
+ TCPServer lServer (lIOService);
+
+ lIOService.run();
+
+ } catch (std::exception& lException) {
+ std::cerr << lException.what() << std::endl;
+ }
+
+ return 0;
+}
+
Added: trunk/dsim/test/boost/asio/daytime4.cpp
===================================================================
--- trunk/dsim/test/boost/asio/daytime4.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/daytime4.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,17 @@
+// Boost.ASIO Tutorial - Daytime4:
+// http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tutdaytime4.html
+// STL
+#include <iostream>
+// Boost.ASIO
+#include <boost/asio.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+// /////////// M A I N ////////////////
+int main (int argc, char* argv[]) {
+
+ boost::asio::io_service lIOService;
+
+ std::cout << "We have waited 1 second" << std::endl;
+
+ return 0;
+}
Added: trunk/dsim/test/boost/asio/daytime5.cpp
===================================================================
--- trunk/dsim/test/boost/asio/daytime5.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/daytime5.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,17 @@
+// Boost.ASIO Tutorial - Daytime5:
+// http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tutdaytime5.html
+// STL
+#include <iostream>
+// Boost.ASIO
+#include <boost/asio.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+// /////////// M A I N ////////////////
+int main (int argc, char* argv[]) {
+
+ boost::asio::io_service lIOService;
+
+ std::cout << "We have waited 1 second" << std::endl;
+
+ return 0;
+}
Added: trunk/dsim/test/boost/asio/daytime6.cpp
===================================================================
--- trunk/dsim/test/boost/asio/daytime6.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/daytime6.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,17 @@
+// Boost.ASIO Tutorial - Daytime6:
+// http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tutdaytime6.html
+// STL
+#include <iostream>
+// Boost.ASIO
+#include <boost/asio.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+// /////////// M A I N ////////////////
+int main (int argc, char* argv[]) {
+
+ boost::asio::io_service lIOService;
+
+ std::cout << "We have waited 1 second" << std::endl;
+
+ return 0;
+}
Added: trunk/dsim/test/boost/asio/daytime7.cpp
===================================================================
--- trunk/dsim/test/boost/asio/daytime7.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/daytime7.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,17 @@
+// Boost.ASIO Tutorial - Daytime7:
+// http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tutdaytime7.html
+// STL
+#include <iostream>
+// Boost.ASIO
+#include <boost/asio.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+// /////////// M A I N ////////////////
+int main (int argc, char* argv[]) {
+
+ boost::asio::io_service lIOService;
+
+ std::cout << "We have waited 1 second" << std::endl;
+
+ return 0;
+}
Property changes on: trunk/dsim/test/boost/asio/httpd
___________________________________________________________________
Added: svn:ignore
+ .deps
.libs
Makefile.in
Makefile
httpd_server
Added: trunk/dsim/test/boost/asio/httpd/Makefile.am
===================================================================
--- trunk/dsim/test/boost/asio/httpd/Makefile.am (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/Makefile.am 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,17 @@
+## test/asio/httpd sub-directory
+include $(top_srcdir)/Makefile.common
+
+MAINTAINERCLEANFILES = Makefile.in
+
+check_PROGRAMS = httpd_server
+
+httpd_server_SOURCES = \
+ header.hpp connection.hpp mime_types.hpp reply.hpp request.hpp \
+ request_handler.hpp request_parser.hpp server.hpp \
+ mime_types.cpp connection.cpp posix_main.cpp reply.cpp request_handler.cpp \
+ request_parser.cpp server.cpp win_main.cpp
+httpd_server_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS)
+httpd_server_LDFLAGS = $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_ASIO_LIB)
+httpd_server_LDADD =
+
+EXTRA_DIST =
Added: trunk/dsim/test/boost/asio/httpd/connection.cpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/connection.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/connection.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,87 @@
+//
+// connection.cpp
+// ~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#include "connection.hpp"
+#include <vector>
+#include <boost/bind.hpp>
+#include "request_handler.hpp"
+
+namespace http {
+
+ namespace server3 {
+
+ connection::connection(boost::asio::io_service& io_service,
+ request_handler& handler)
+ : strand_(io_service),
+ socket_(io_service),
+ request_handler_(handler) {
+ }
+
+ boost::asio::ip::tcp::socket& connection::socket() {
+ return socket_;
+ }
+
+ void connection::start() {
+ socket_.async_read_some(boost::asio::buffer(buffer_),
+ strand_.wrap(
+ boost::bind(&connection::handle_read, shared_from_this(),
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred)));
+ }
+
+ void connection::handle_read(const boost::system::error_code& e,
+ std::size_t bytes_transferred) {
+ if (!e) {
+ boost::tribool result;
+ boost::tie(result, boost::tuples::ignore) = request_parser_.parse(
+ request_, buffer_.data(), buffer_.data() + bytes_transferred);
+
+ if (result) {
+ request_handler_.handle_request(request_, reply_);
+ boost::asio::async_write(socket_, reply_.to_buffers(),
+ strand_.wrap(
+ boost::bind(&connection::handle_write, shared_from_this(),
+ boost::asio::placeholders::error)));
+ } else if (!result) {
+ reply_ = reply::stock_reply(reply::bad_request);
+ boost::asio::async_write(socket_, reply_.to_buffers(),
+ strand_.wrap(
+ boost::bind(&connection::handle_write, shared_from_this(),
+ boost::asio::placeholders::error)));
+ } else {
+ socket_.async_read_some(boost::asio::buffer(buffer_),
+ strand_.wrap(
+ boost::bind(&connection::handle_read, shared_from_this(),
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred)));
+ }
+ }
+
+ // If an error occurs then no new asynchronous operations are started. This
+ // means that all shared_ptr references to the connection object will
+ // disappear and the object will be destroyed automatically after this
+ // handler returns. The connection class's destructor closes the socket.
+ }
+
+ void connection::handle_write(const boost::system::error_code& e) {
+ if (!e) {
+ // Initiate graceful connection closure.
+ boost::system::error_code ignored_ec;
+ socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored_ec);
+ }
+
+ // No new asynchronous operations are started. This means that all shared_ptr
+ // references to the connection object will disappear and the object will be
+ // destroyed automatically after this handler returns. The connection class's
+ // destructor closes the socket.
+ }
+
+ } // namespace server3
+} // namespace http
Added: trunk/dsim/test/boost/asio/httpd/connection.hpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/connection.hpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/connection.hpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,77 @@
+//
+// connection.hpp
+// ~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#ifndef HTTP_SERVER3_CONNECTION_HPP
+#define HTTP_SERVER3_CONNECTION_HPP
+
+#include <boost/asio.hpp>
+#include <boost/array.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include "reply.hpp"
+#include "request.hpp"
+#include "request_handler.hpp"
+#include "request_parser.hpp"
+
+namespace http {
+
+ namespace server3 {
+
+ /// Represents a single connection from a client.
+ class connection
+ : public boost::enable_shared_from_this<connection>,
+ private boost::noncopyable {
+ public:
+ /// Construct a connection with the given io_service.
+ explicit connection(boost::asio::io_service& io_service,
+ request_handler& handler);
+
+ /// Get the socket associated with the connection.
+ boost::asio::ip::tcp::socket& socket();
+
+ /// Start the first asynchronous operation for the connection.
+ void start();
+
+ private:
+ /// Handle completion of a read operation.
+ void handle_read(const boost::system::error_code& e,
+ std::size_t bytes_transferred);
+
+ /// Handle completion of a write operation.
+ void handle_write(const boost::system::error_code& e);
+
+ /// Strand to ensure the connection's handlers are not called concurrently.
+ boost::asio::io_service::strand strand_;
+
+ /// Socket for the connection.
+ boost::asio::ip::tcp::socket socket_;
+
+ /// The handler used to process the incoming request.
+ request_handler& request_handler_;
+
+ /// Buffer for incoming data.
+ boost::array<char, 8192> buffer_;
+
+ /// The incoming request.
+ request request_;
+
+ /// The parser for the incoming request.
+ request_parser request_parser_;
+
+ /// The reply to be sent back to the client.
+ reply reply_;
+ };
+
+ typedef boost::shared_ptr<connection> connection_ptr;
+
+ } // namespace server3
+} // namespace http
+#endif // HTTP_SERVER3_CONNECTION_HPP
Added: trunk/dsim/test/boost/asio/httpd/header.hpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/header.hpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/header.hpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,27 @@
+//
+// header.hpp
+// ~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#ifndef HTTP_SERVER3_HEADER_HPP
+#define HTTP_SERVER3_HEADER_HPP
+
+#include <string>
+
+namespace http {
+
+ namespace server3 {
+
+ struct header {
+ std::string name;
+ std::string value;
+ };
+
+ } // namespace server3
+} // namespace http
+#endif // HTTP_SERVER3_HEADER_HPP
Added: trunk/dsim/test/boost/asio/httpd/mime_types.cpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/mime_types.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/mime_types.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,43 @@
+//
+// mime_types.cpp
+// ~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#include "mime_types.hpp"
+
+namespace http {
+
+ namespace server3 {
+
+ namespace mime_types {
+
+ struct mapping {
+ const char* extension;
+ const char* mime_type;
+ } mappings[] = {
+ { "gif", "image/gif" },
+ { "htm", "text/html" },
+ { "html", "text/html" },
+ { "jpg", "image/jpeg" },
+ { "png", "image/png" },
+ { 0, 0 } // Marks end of list.
+ };
+
+ std::string extension_to_type(const std::string& extension) {
+ for (mapping* m = mappings; m->extension; ++m) {
+ if (m->extension == extension) {
+ return m->mime_type;
+ }
+ }
+
+ return "text/plain";
+ }
+
+ } // namespace mime_types
+ } // namespace server3
+} // namespace http
Added: trunk/dsim/test/boost/asio/httpd/mime_types.hpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/mime_types.hpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/mime_types.hpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,29 @@
+//
+// mime_types.hpp
+// ~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#ifndef HTTP_SERVER3_MIME_TYPES_HPP
+#define HTTP_SERVER3_MIME_TYPES_HPP
+
+#include <string>
+
+namespace http {
+
+ namespace server3 {
+
+ namespace mime_types {
+
+ /// Convert a file extension into a MIME type.
+ std::string extension_to_type(const std::string& extension);
+
+ } // namespace mime_types
+ } // namespace server3
+} // namespace http
+
+#endif // HTTP_SERVER3_MIME_TYPES_HPP
Added: trunk/dsim/test/boost/asio/httpd/posix_main.cpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/posix_main.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/posix_main.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,73 @@
+//
+// posix_main.cpp
+// ~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#include <iostream>
+#include <string>
+#include <boost/asio.hpp>
+#include <boost/thread.hpp>
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+#include "server.hpp"
+
+#if !defined(_WIN32)
+
+#include <pthread.h>
+#include <signal.h>
+
+int main(int argc, char* argv[]) {
+
+ try {
+
+ // Check command line arguments.
+ if (argc != 5) {
+ std::cerr << "Usage: http_server <address> <port> <threads> <doc_root>\n";
+ std::cerr << " For IPv4, try:\n";
+ std::cerr << " receiver 0.0.0.0 80 1 .\n";
+ std::cerr << " For IPv6, try:\n";
+ std::cerr << " receiver 0::0 80 1 .\n";
+ return 1;
+ }
+
+ // Block all signals for background thread.
+ sigset_t new_mask;
+ sigfillset(&new_mask);
+ sigset_t old_mask;
+ pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
+
+ // Run server in background thread.
+ std::size_t num_threads = boost::lexical_cast<std::size_t>(argv[3]);
+ http::server3::server s(argv[1], argv[2], argv[4], num_threads);
+ boost::thread t(boost::bind(&http::server3::server::run, &s));
+
+ // Restore previous signals.
+ pthread_sigmask(SIG_SETMASK, &old_mask, 0);
+
+ // Wait for signal indicating time to shut down.
+ sigset_t wait_mask;
+ sigemptyset(&wait_mask);
+ sigaddset(&wait_mask, SIGINT);
+ sigaddset(&wait_mask, SIGQUIT);
+ sigaddset(&wait_mask, SIGTERM);
+ pthread_sigmask(SIG_BLOCK, &wait_mask, 0);
+ int sig = 0;
+ sigwait(&wait_mask, &sig);
+
+ // Stop the server.
+ s.stop();
+ t.join();
+
+ } catch (std::exception& e) {
+ std::cerr << "exception: " << e.what() << "\n";
+ }
+
+ return 0;
+}
+
+#endif // !defined(_WIN32)
Added: trunk/dsim/test/boost/asio/httpd/reply.cpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/reply.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/reply.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,253 @@
+//
+// reply.cpp
+// ~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#include "reply.hpp"
+#include <string>
+#include <boost/lexical_cast.hpp>
+
+namespace http {
+
+ namespace server3 {
+
+ namespace status_strings {
+
+ const std::string ok =
+ "HTTP/1.0 200 OK\r\n";
+ const std::string created =
+ "HTTP/1.0 201 Created\r\n";
+ const std::string accepted =
+ "HTTP/1.0 202 Accepted\r\n";
+ const std::string no_content =
+ "HTTP/1.0 204 No Content\r\n";
+ const std::string multiple_choices =
+ "HTTP/1.0 300 Multiple Choices\r\n";
+ const std::string moved_permanently =
+ "HTTP/1.0 301 Moved Permanently\r\n";
+ const std::string moved_temporarily =
+ "HTTP/1.0 302 Moved Temporarily\r\n";
+ const std::string not_modified =
+ "HTTP/1.0 304 Not Modified\r\n";
+ const std::string bad_request =
+ "HTTP/1.0 400 Bad Request\r\n";
+ const std::string unauthorized =
+ "HTTP/1.0 401 Unauthorized\r\n";
+ const std::string forbidden =
+ "HTTP/1.0 403 Forbidden\r\n";
+ const std::string not_found =
+ "HTTP/1.0 404 Not Found\r\n";
+ const std::string internal_server_error =
+ "HTTP/1.0 500 Internal Server Error\r\n";
+ const std::string not_implemented =
+ "HTTP/1.0 501 Not Implemented\r\n";
+ const std::string bad_gateway =
+ "HTTP/1.0 502 Bad Gateway\r\n";
+ const std::string service_unavailable =
+ "HTTP/1.0 503 Service Unavailable\r\n";
+
+ boost::asio::const_buffer to_buffer(reply::status_type status) {
+ switch (status) {
+ case reply::ok:
+ return boost::asio::buffer(ok);
+ case reply::created:
+ return boost::asio::buffer(created);
+ case reply::accepted:
+ return boost::asio::buffer(accepted);
+ case reply::no_content:
+ return boost::asio::buffer(no_content);
+ case reply::multiple_choices:
+ return boost::asio::buffer(multiple_choices);
+ case reply::moved_permanently:
+ return boost::asio::buffer(moved_permanently);
+ case reply::moved_temporarily:
+ return boost::asio::buffer(moved_temporarily);
+ case reply::not_modified:
+ return boost::asio::buffer(not_modified);
+ case reply::bad_request:
+ return boost::asio::buffer(bad_request);
+ case reply::unauthorized:
+ return boost::asio::buffer(unauthorized);
+ case reply::forbidden:
+ return boost::asio::buffer(forbidden);
+ case reply::not_found:
+ return boost::asio::buffer(not_found);
+ case reply::internal_server_error:
+ return boost::asio::buffer(internal_server_error);
+ case reply::not_implemented:
+ return boost::asio::buffer(not_implemented);
+ case reply::bad_gateway:
+ return boost::asio::buffer(bad_gateway);
+ case reply::service_unavailable:
+ return boost::asio::buffer(service_unavailable);
+ default:
+ return boost::asio::buffer(internal_server_error);
+ }
+ }
+
+ } // namespace status_strings
+
+ namespace misc_strings {
+
+ const char name_value_separator[] = { ':', ' ' };
+ const char crlf[] = { '\r', '\n' };
+
+ } // namespace misc_strings
+
+ std::vector<boost::asio::const_buffer> reply::to_buffers() {
+
+ std::vector<boost::asio::const_buffer> buffers;
+
+ buffers.push_back(status_strings::to_buffer(status));
+ for (std::size_t i = 0; i < headers.size(); ++i) {
+ header& h = headers[i];
+ buffers.push_back(boost::asio::buffer(h.name));
+ buffers.push_back(boost::asio::buffer(misc_strings::name_value_separator));
+ buffers.push_back(boost::asio::buffer(h.value));
+ buffers.push_back(boost::asio::buffer(misc_strings::crlf));
+ }
+
+ buffers.push_back(boost::asio::buffer(misc_strings::crlf));
+ buffers.push_back(boost::asio::buffer(content));
+ return buffers;
+ }
+
+ namespace stock_replies {
+
+ const char ok[] = "";
+ const char created[] =
+ "<html>"
+ "<head><title>Created</title></head>"
+ "<body><h1>201 Created</h1></body>"
+ "</html>";
+ const char accepted[] =
+ "<html>"
+ "<head><title>Accepted</title></head>"
+ "<body><h1>202 Accepted</h1></body>"
+ "</html>";
+ const char no_content[] =
+ "<html>"
+ "<head><title>No Content</title></head>"
+ "<body><h1>204 Content</h1></body>"
+ "</html>";
+ const char multiple_choices[] =
+ "<html>"
+ "<head><title>Multiple Choices</title></head>"
+ "<body><h1>300 Multiple Choices</h1></body>"
+ "</html>";
+ const char moved_permanently[] =
+ "<html>"
+ "<head><title>Moved Permanently</title></head>"
+ "<body><h1>301 Moved Permanently</h1></body>"
+ "</html>";
+ const char moved_temporarily[] =
+ "<html>"
+ "<head><title>Moved Temporarily</title></head>"
+ "<body><h1>302 Moved Temporarily</h1></body>"
+ "</html>";
+ const char not_modified[] =
+ "<html>"
+ "<head><title>Not Modified</title></head>"
+ "<body><h1>304 Not Modified</h1></body>"
+ "</html>";
+ const char bad_request[] =
+ "<html>"
+ "<head><title>Bad Request</title></head>"
+ "<body><h1>400 Bad Request</h1></body>"
+ "</html>";
+ const char unauthorized[] =
+ "<html>"
+ "<head><title>Unauthorized</title></head>"
+ "<body><h1>401 Unauthorized</h1></body>"
+ "</html>";
+ const char forbidden[] =
+ "<html>"
+ "<head><title>Forbidden</title></head>"
+ "<body><h1>403 Forbidden</h1></body>"
+ "</html>";
+ const char not_found[] =
+ "<html>"
+ "<head><title>Not Found</title></head>"
+ "<body><h1>404 Not Found</h1></body>"
+ "</html>";
+ const char internal_server_error[] =
+ "<html>"
+ "<head><title>Internal Server Error</title></head>"
+ "<body><h1>500 Internal Server Error</h1></body>"
+ "</html>";
+ const char not_implemented[] =
+ "<html>"
+ "<head><title>Not Implemented</title></head>"
+ "<body><h1>501 Not Implemented</h1></body>"
+ "</html>";
+ const char bad_gateway[] =
+ "<html>"
+ "<head><title>Bad Gateway</title></head>"
+ "<body><h1>502 Bad Gateway</h1></body>"
+ "</html>";
+ const char service_unavailable[] =
+ "<html>"
+ "<head><title>Service Unavailable</title></head>"
+ "<body><h1>503 Service Unavailable</h1></body>"
+ "</html>";
+
+ std::string to_string(reply::status_type status) {
+ switch (status) {
+ case reply::ok:
+ return ok;
+ case reply::created:
+ return created;
+ case reply::accepted:
+ return accepted;
+ case reply::no_content:
+ return no_content;
+ case reply::multiple_choices:
+ return multiple_choices;
+ case reply::moved_permanently:
+ return moved_permanently;
+ case reply::moved_temporarily:
+ return moved_temporarily;
+ case reply::not_modified:
+ return not_modified;
+ case reply::bad_request:
+ return bad_request;
+ case reply::unauthorized:
+ return unauthorized;
+ case reply::forbidden:
+ return forbidden;
+ case reply::not_found:
+ return not_found;
+ case reply::internal_server_error:
+ return internal_server_error;
+ case reply::not_implemented:
+ return not_implemented;
+ case reply::bad_gateway:
+ return bad_gateway;
+ case reply::service_unavailable:
+ return service_unavailable;
+ default:
+ return internal_server_error;
+ }
+ }
+
+ } // namespace stock_replies
+
+ reply reply::stock_reply(reply::status_type status) {
+ reply rep;
+ rep.status = status;
+ rep.content = stock_replies::to_string(status);
+ rep.headers.resize(2);
+ rep.headers[0].name = "Content-Length";
+ rep.headers[0].value = boost::lexical_cast<std::string>(rep.content.size());
+ rep.headers[1].name = "Content-Type";
+ rep.headers[1].value = "text/html";
+ return rep;
+ }
+
+ } // namespace server3
+} // namespace http
Added: trunk/dsim/test/boost/asio/httpd/reply.hpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/reply.hpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/reply.hpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,63 @@
+//
+// reply.hpp
+// ~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#ifndef HTTP_SERVER3_REPLY_HPP
+#define HTTP_SERVER3_REPLY_HPP
+
+#include <string>
+#include <vector>
+#include <boost/asio.hpp>
+#include "header.hpp"
+
+namespace http {
+
+ namespace server3 {
+
+ /// A reply to be sent to a client.
+ struct reply {
+
+ /// The status of the reply.
+ enum status_type {
+ ok = 200,
+ created = 201,
+ accepted = 202,
+ no_content = 204,
+ multiple_choices = 300,
+ moved_permanently = 301,
+ moved_temporarily = 302,
+ not_modified = 304,
+ bad_request = 400,
+ unauthorized = 401,
+ forbidden = 403,
+ not_found = 404,
+ internal_server_error = 500,
+ not_implemented = 501,
+ bad_gateway = 502,
+ service_unavailable = 503
+ } status;
+
+ /// The headers to be included in the reply.
+ std::vector<header> headers;
+
+ /// The content to be sent in the reply.
+ std::string content;
+
+ /// Convert the reply into a vector of buffers. The buffers do not own the
+ /// underlying memory blocks, therefore the reply object must remain valid and
+ /// not be changed until the write operation has completed.
+ std::vector<boost::asio::const_buffer> to_buffers();
+
+ /// Get a stock reply.
+ static reply stock_reply(status_type status);
+ };
+
+ } // namespace server3
+} // namespace http
+#endif // HTTP_SERVER3_REPLY_HPP
Added: trunk/dsim/test/boost/asio/httpd/request.hpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/request.hpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/request.hpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,33 @@
+//
+// request.hpp
+// ~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#ifndef HTTP_SERVER3_REQUEST_HPP
+#define HTTP_SERVER3_REQUEST_HPP
+
+#include <string>
+#include <vector>
+#include "header.hpp"
+
+namespace http {
+
+ namespace server3 {
+
+ /// A request received from a client.
+ struct request {
+ std::string method;
+ std::string uri;
+ int http_version_major;
+ int http_version_minor;
+ std::vector<header> headers;
+ };
+
+ } // namespace server3
+} // namespace http
+#endif // HTTP_SERVER3_REQUEST_HPP
Added: trunk/dsim/test/boost/asio/httpd/request_handler.cpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/request_handler.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/request_handler.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,115 @@
+//
+// request_handler.cpp
+// ~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#include "request_handler.hpp"
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <boost/lexical_cast.hpp>
+#include "mime_types.hpp"
+#include "reply.hpp"
+#include "request.hpp"
+
+namespace http {
+
+ namespace server3 {
+
+ request_handler::request_handler(const std::string& doc_root)
+ : doc_root_(doc_root) {
+ }
+
+ void request_handler::handle_request(const request& req, reply& rep) {
+ // Decode url to path.
+ std::string request_path;
+
+ if (!url_decode(req.uri, request_path)) {
+ rep = reply::stock_reply(reply::bad_request);
+ return;
+ }
+
+ // Request path must be absolute and not contain "..".
+ if (request_path.empty() || request_path[0] != '/'
+ || request_path.find("..") != std::string::npos) {
+ rep = reply::stock_reply(reply::bad_request);
+ return;
+ }
+
+ // If path ends in slash (i.e. is a directory) then add "index.html".
+ if (request_path[request_path.size() - 1] == '/') {
+ request_path += "index.html";
+ }
+
+ // Determine the file extension.
+ std::size_t last_slash_pos = request_path.find_last_of("/");
+ std::size_t last_dot_pos = request_path.find_last_of(".");
+ std::string extension;
+
+ if (last_dot_pos != std::string::npos && last_dot_pos > last_slash_pos) {
+ extension = request_path.substr(last_dot_pos + 1);
+ }
+
+ // Open the file to send back.
+ std::string full_path = doc_root_ + request_path;
+ std::ifstream is (full_path.c_str(), std::ios::in | std::ios::binary);
+
+ if (!is) {
+ rep = reply::stock_reply(reply::not_found);
+ return;
+ }
+
+ // Fill out the reply to be sent to the client.
+ rep.status = reply::ok;
+ char buf[512];
+ while (is.read(buf, sizeof(buf)).gcount() > 0)
+ rep.content.append(buf, is.gcount());
+ rep.headers.resize(2);
+ rep.headers[0].name = "Content-Length";
+ rep.headers[0].value = boost::lexical_cast<std::string>(rep.content.size());
+ rep.headers[1].name = "Content-Type";
+ rep.headers[1].value = mime_types::extension_to_type(extension);
+ }
+
+ bool request_handler::url_decode(const std::string& in, std::string& out) {
+ out.clear();
+ out.reserve(in.size());
+
+ for (std::size_t i = 0; i < in.size(); ++i) {
+
+ if (in[i] == '%') {
+
+ if (i + 3 <= in.size()) {
+ int value = 0;
+ std::istringstream is(in.substr(i + 1, 2));
+
+ if (is >> std::hex >> value) {
+ out += static_cast<char>(value);
+ i += 2;
+
+ } else {
+ return false;
+ }
+
+ } else {
+ return false;
+ }
+
+ } else if (in[i] == '+') {
+ out += ' ';
+
+ } else {
+ out += in[i];
+ }
+ }
+
+ return true;
+ }
+
+ } // namespace server3
+} // namespace http
Added: trunk/dsim/test/boost/asio/httpd/request_handler.hpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/request_handler.hpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/request_handler.hpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,45 @@
+//
+// request_handler.hpp
+// ~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#ifndef HTTP_SERVER3_REQUEST_HANDLER_HPP
+#define HTTP_SERVER3_REQUEST_HANDLER_HPP
+
+#include <string>
+#include <boost/noncopyable.hpp>
+
+namespace http {
+
+ namespace server3 {
+
+ struct reply;
+ struct request;
+
+ /// The common handler for all incoming requests.
+ class request_handler
+ : private boost::noncopyable {
+ public:
+ /// Construct with a directory containing files to be served.
+ explicit request_handler(const std::string& doc_root);
+
+ /// Handle a request and produce a reply.
+ void handle_request(const request& req, reply& rep);
+
+ private:
+ /// The directory containing the files to be served.
+ std::string doc_root_;
+
+ /// Perform URL-decoding on a string. Returns false if the encoding was
+ /// invalid.
+ static bool url_decode(const std::string& in, std::string& out);
+ };
+
+ } // namespace server3
+} // namespace http
+#endif // HTTP_SERVER3_REQUEST_HANDLER_HPP
Added: trunk/dsim/test/boost/asio/httpd/request_parser.cpp
===================================================================
--- trunk/dsim/test/boost/asio/httpd/request_parser.cpp (rev 0)
+++ trunk/dsim/test/boost/asio/httpd/request_parser.cpp 2009-12-26 01:40:41 UTC (rev 21)
@@ -0,0 +1,291 @@
+//
+// request_parser.cpp
+// ~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// 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)
+//
+
+#include "request_parser.hpp"
+#include "request.hpp"
+
+namespace http {
+
+ namespace server3 {
+
+ request_parser::request_parser()
+ : state_(method_start) {
+ }
+
+ void request_parser::reset() {
+ state_ = method_start;
+ }
+
+ boost::tribool request_parser::consume(request& req, char input) {
+
+ switch (state_) {
+
+ case method_start:
+ if (!is_char(input) || is_ctl(input) || is_tspecial(input)) {
+ return false;
+
+ } else {
+ state_ = method;
+ req.method.push_back(input);
+ return boost::indeterminate;
+ }
+
+ case method:
+ if (input == ' ') {
+ state_ = uri;
+ return boost::indeterminate;
+
+ } else if (!is_char(input) || is_ctl(input) || is_tspecial(input)) {
+ return false;
+
+ } else {
+ ...
[truncated message content] |
|
From: <den...@us...> - 2009-12-24 16:05:37
|
Revision: 20
http://dsim.svn.sourceforge.net/dsim/?rev=20&view=rev
Author: denis_arnaud
Date: 2009-12-24 16:05:27 +0000 (Thu, 24 Dec 2009)
Log Message:
-----------
[Dev] Now delegates the booking sell to the SimCRS and AirInv services.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
trunk/dsim/dsim/command/Simulator.hpp
trunk/dsim/dsim/service/Makefile.am
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2009-12-24 15:32:19 UTC (rev 19)
+++ trunk/dsim/dsim/command/Simulator.cpp 2009-12-24 16:05:27 UTC (rev 20)
@@ -31,6 +31,9 @@
// Make a booking
ioSIMCRS_Service.sell (lAirlineCode, lPartySize);
+ // DEBUG
+ DSIM_LOG_DEBUG ("The simulation has ended");
+
} catch (const std::exception& lStdError) {
DSIM_LOG_ERROR ("Error: " << lStdError.what());
throw SimulationException();
Modified: trunk/dsim/dsim/command/Simulator.hpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.hpp 2009-12-24 15:32:19 UTC (rev 19)
+++ trunk/dsim/dsim/command/Simulator.hpp 2009-12-24 16:05:27 UTC (rev 20)
@@ -20,7 +20,7 @@
private:
/** Perform a simulation. */
- static void simulate (SIMCRS::SIMCRS_Service& lSIMCRS_Service);
+ static void simulate (SIMCRS::SIMCRS_Service&);
private:
/** Constructors. */
Modified: trunk/dsim/dsim/service/Makefile.am
===================================================================
--- trunk/dsim/dsim/service/Makefile.am 2009-12-24 15:32:19 UTC (rev 19)
+++ trunk/dsim/dsim/service/Makefile.am 2009-12-24 16:05:27 UTC (rev 20)
@@ -5,7 +5,7 @@
noinst_LTLIBRARIES= libsvc.la
libsvc_la_SOURCES= $(svc_h_sources) $(svc_cc_sources)
-libsvc_la_CXXFLAGS = $(SOCI_CFLAGS)
+libsvc_la_CXXFLAGS = $(BOOST_CFLAGS)
#pkgincludedir = $(includedir)/@PACKAGE@/service
#pkginclude_HEADERS = $(svc_h_sources)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|