Przeglądaj źródła

Change organisation of tests directory and add boost::graph tests

Eric Ramat 11 lat temu
rodzic
commit
312369f545

+ 4 - 25
CMakeLists.txt

@@ -97,23 +97,10 @@ ENDIF (WIN32)
 SET(Boost_DETAILED_FAILURE_MSG FALSE)
 SET(Boost_DEBUG FALSE)
 
-FIND_PACKAGE(Boost COMPONENTS unit_test_framework serialization filesystem
-  system date_time regex thread)
-IF (NOT Boost_SERIALIZATION_FOUND)
-  MESSAGE(FATAL_ERROR "The boost serialization library is required")
-ENDIF (NOT Boost_SERIALIZATION_FOUND)
-IF (NOT Boost_FILESYSTEM_FOUND)
-  MESSAGE(FATAL_ERROR "The boost filesystem library is required")
-ENDIF (NOT Boost_FILESYSTEM_FOUND)
-IF (NOT Boost_REGEX_FOUND)
-  MESSAGE(FATAL_ERROR "The boost regex library is required")
-ENDIF (NOT Boost_REGEX_FOUND)
-IF (NOT Boost_DATE_TIME_FOUND)
-  MESSAGE(FATAL_ERROR "The boost date_time library is required")
-ENDIF (NOT Boost_DATE_TIME_FOUND)
-IF (NOT Boost_THREAD_FOUND)
-  MESSAGE(FATAL_ERROR "The boost thread library is required")
-ENDIF (NOT Boost_THREAD_FOUND)
+FIND_PACKAGE(Boost COMPONENTS graph)
+IF (NOT Boost_GRAPH_FOUND)
+  MESSAGE(FATAL_ERROR "The boost graph library is required")
+ENDIF (NOT Boost_GRAPH_FOUND)
 IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
   SET(Boost_SYSTEM_LIBRARY "")
 ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
@@ -122,11 +109,6 @@ IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
 ELSE (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
   SET(PARADEVS_HAVE_BOOST_SPIRIT2 1 CACHE INTERNAL "" FORCE)
 ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
-IF (WITH_TEST)
-  IF (Boost_UNIT_TEST_FRAMEWORK_FOUND)
-    SET(HAVE_UNITTESTFRAMEWORK 1 CACHE INTERNAL "" FORCE)
-  ENDIF (Boost_UNIT_TEST_FRAMEWORK_FOUND)
-ENDIF (WITH_TEST)
 
 #
  # Generate the config.h
@@ -188,9 +170,6 @@ ENDIF (PARADEVS_HAVE_EXECINFO)
 IF (Boost_FOUND)
   MESSAGE(STATUS "Build with boost..............: yes")
 ENDIF (Boost_FOUND)
-IF (HAVE_UNITTESTFRAMEWORK)
-  MESSAGE(STATUS "Build unit test...............: yes")
-ENDIF (HAVE_UNITTESTFRAMEWORK)
 MESSAGE(STATUS "- - - -")
 
 # vim:tw=0:ts=8:tw=0:sw=2:sts=2

+ 1 - 1
src/apps/CMakeLists.txt

@@ -10,7 +10,7 @@ LINK_DIRECTORIES(
   ${LIBXML_LIBRARY_DIRS}
   ${Boost_LIBRARY_DIRS})
 
-ADD_EXECUTABLE(paradevs main.cpp ../tests/mixed_tests.hpp)
+ADD_EXECUTABLE(paradevs main.cpp ${MIXED_TESTS_HPP})
 SET_TARGET_PROPERTIES(paradevs PROPERTIES ${PARADEVS_APP_PROPERTIES})
 
 TARGET_LINK_LIBRARIES(paradevs

+ 46 - 29
src/apps/main.cpp

@@ -30,7 +30,12 @@
 #include <common/scheduler/VectorScheduler.hpp>
 #include <common/scheduler/HeapScheduler.hpp>
 
-#include <tests/mixed_tests.hpp>
+#include <pdevs/Coordinator.hpp>
+
+#include <tests/mixed/models.hpp>
+#include <tests/mixed/graph_manager.hpp>
+
+using namespace paradevs::tests::mixed;
 
 template < int size >
 void run_flat_with_heap()
@@ -40,13 +45,16 @@ void run_flat_with_heap()
     std::cout << "run_flat_with_heap [" << size << "] ..." << std::endl;
 
     paradevs::common::RootCoordinator <
-        paradevs::MyTime, paradevs::pdevs::Coordinator <
-            paradevs::MyTime,
-            paradevs::common::scheduler::HeapScheduler < paradevs::MyTime >,
-            paradevs::LinearGraphManager < size > >
-        > rc(0, 100, "root", paradevs::pdevs::Parameters());
-
-    paradevs::common::Trace < paradevs::MyTime >::trace().clear();
+        MyTime, paradevs::pdevs::Coordinator <
+            MyTime,
+            paradevs::common::scheduler::HeapScheduler < MyTime >,
+            LinearGraphManager < size >,
+            paradevs::common::NoParameters,
+            paradevs::common::NoParameters >
+        > rc(0, 100, "root", paradevs::common::NoParameters(),
+             paradevs::common::NoParameters());
+
+    paradevs::common::Trace < MyTime >::trace().clear();
     rc.run();
 
     std::cout << "... OK -> " << t.elapsed() << std::endl;
@@ -60,13 +68,16 @@ void run_flat_with_vector()
     std::cout << "run_flat_with_vector [" << size << "] ..." << std::endl;
 
     paradevs::common::RootCoordinator <
-        paradevs::MyTime, paradevs::pdevs::Coordinator <
-            paradevs::MyTime,
-            paradevs::common::scheduler::VectorScheduler < paradevs::MyTime >,
-            paradevs::LinearGraphManager < size > >
-        > rc(0, 100, "root", paradevs::pdevs::Parameters());
-
-    paradevs::common::Trace < paradevs::MyTime >::trace().clear();
+        MyTime, paradevs::pdevs::Coordinator <
+            MyTime,
+            paradevs::common::scheduler::VectorScheduler < MyTime >,
+            LinearGraphManager < size >,
+            paradevs::common::NoParameters,
+            paradevs::common::NoParameters >
+        > rc(0, 100, "root", paradevs::common::NoParameters(),
+             paradevs::common::NoParameters());
+
+    paradevs::common::Trace < MyTime >::trace().clear();
     rc.run();
 
     std::cout << "... OK -> " << t.elapsed() << std::endl;
@@ -75,26 +86,32 @@ void run_flat_with_vector()
 void run_hierarchic_with_heap()
 {
     paradevs::common::RootCoordinator <
-        paradevs::MyTime, paradevs::pdevs::Coordinator <
-            paradevs::MyTime,
-            paradevs::common::scheduler::HeapScheduler < paradevs::MyTime >,
-            paradevs::Root2GraphManager >
-        > rc(0, 100, "root", paradevs::pdevs::Parameters());
-
-    paradevs::common::Trace < paradevs::MyTime >::trace().clear();
+        MyTime, paradevs::pdevs::Coordinator <
+            MyTime,
+            paradevs::common::scheduler::HeapScheduler < MyTime >,
+            Root2GraphManager,
+            paradevs::common::NoParameters,
+            paradevs::common::NoParameters >
+        > rc(0, 100, "root", paradevs::common::NoParameters(),
+             paradevs::common::NoParameters());
+
+    paradevs::common::Trace < MyTime >::trace().clear();
     rc.run();
 }
 
 void run_hierarchic_with_vector()
 {
     paradevs::common::RootCoordinator <
-        paradevs::MyTime, paradevs::pdevs::Coordinator <
-            paradevs::MyTime,
-            paradevs::common::scheduler::VectorScheduler < paradevs::MyTime >,
-            paradevs::Root3GraphManager >
-        > rc(0, 100, "root", paradevs::pdevs::Parameters());
-
-    paradevs::common::Trace < paradevs::MyTime >::trace().clear();
+        MyTime, paradevs::pdevs::Coordinator <
+            MyTime,
+            paradevs::common::scheduler::VectorScheduler < MyTime >,
+            Root3GraphManager,
+            paradevs::common::NoParameters,
+            paradevs::common::NoParameters >
+        > rc(0, 100, "root", paradevs::common::NoParameters(),
+             paradevs::common::NoParameters());
+
+    paradevs::common::Trace < MyTime >::trace().clear();
     rc.run();
 }
 

+ 1 - 1
src/common/CMakeLists.txt

@@ -11,7 +11,7 @@ LINK_DIRECTORIES(
   ${Boost_LIBRARY_DIRS})
 
 SET(COMMON_HPP Bag.hpp ExternalEvent.hpp InternalEvent.hpp Links.hpp Node.hpp
-  RootCoordinator.hpp Scheduler.hpp Time.hpp Trace.hpp)
+  Parameters.hpp RootCoordinator.hpp Scheduler.hpp Time.hpp Trace.hpp)
 
 INSTALL(FILES ${COMMON_HPP} DESTINATION ${PARADEVS_INCLUDE_DIRS}/common)
 

+ 3 - 0
src/common/ExternalEvent.hpp

@@ -72,6 +72,9 @@ public:
     Model < Time >* get_model() const
     { return _model; }
 
+    bool on_port(const std::string& port_name) const
+    { return _port_name == port_name; }
+
     void set_model(Model < Time >* model)
     { _model = model; }
 

+ 41 - 0
src/common/Parameters.hpp

@@ -0,0 +1,41 @@
+/**
+ * @file common/Parameters.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef COMMON_PARAMETERS
+#define COMMON_PARAMETERS 1
+
+namespace paradevs { namespace common {
+
+class NoParameters
+{
+public:
+    NoParameters()
+    { }
+};
+
+} } // namespace paradevs common
+
+#endif

+ 21 - 1
src/common/RootCoordinator.hpp

@@ -27,6 +27,8 @@
 #ifndef COMMON_ROOT_COORDINATOR
 #define COMMON_ROOT_COORDINATOR 1
 
+#include <common/Parameters.hpp>
+
 #include <string>
 
 namespace paradevs { namespace common {
@@ -35,11 +37,29 @@ template < class Time, class Coordinator >
 class RootCoordinator
 {
 public :
+    RootCoordinator(const typename Time::type& t_start,
+                    const typename Time::type& t_max,
+                    const std::string& root_name,
+                    const typename Coordinator::parameters_type& parameters,
+                    const typename Coordinator::graph_parameters_type&
+                    graph_parameters) :
+        _root(root_name, parameters, graph_parameters),
+        _t_max(t_max), _tn(t_start)
+    { }
+
     RootCoordinator(const typename Time::type& t_start,
                     const typename Time::type& t_max,
                     const std::string& root_name,
                     const typename Coordinator::parameters_type& parameters) :
-        _root(root_name, parameters), _t_max(t_max), _tn(t_start)
+        _root(root_name, parameters, NoParameters()),
+        _t_max(t_max), _tn(t_start)
+    { }
+
+    RootCoordinator(const typename Time::type& t_start,
+                    const typename Time::type& t_max,
+                    const std::string& root_name) :
+        _root(root_name, NoParameters(), NoParameters()),
+        _t_max(t_max), _tn(t_start)
     { }
 
     virtual ~RootCoordinator()

+ 3 - 14
src/common/scheduler/HeapScheduler.hpp

@@ -30,6 +30,7 @@
 #include <common/InternalEvent.hpp>
 
 #include <boost/heap/fibonacci_heap.hpp>
+#include <boost/heap/binomial_heap.hpp>
 
 #include <cmath>
 #include <sstream>
@@ -89,21 +90,9 @@ public:
                            InternalEvent < Time >(time, model)));
     }
 
-    void put_increase(typename Time::type time, Model < Time >* model)
+    void put(typename Time::type time, Model < Time >* model)
     {
-        if (std::isfinite(time)) {
-            HeapScheduler < Time >::erase(model->heap_id());
-            model->heap_id(HeapScheduler < Time >::push(
-                               InternalEvent < Time >(time, model)));
-        } else {
-            HeapScheduler < Time >::increase(
-                model->heap_id(), InternalEvent < Time >(time, model));
-        }
-    }
-
-    void put_decrease(typename Time::type time, Model < Time >* model)
-    {
-        HeapScheduler < Time >::decrease(
+        HeapScheduler < Time >::update(
             model->heap_id(), InternalEvent < Time >(time, model));
     }
 

+ 1 - 10
src/common/scheduler/VectorScheduler.hpp

@@ -72,16 +72,7 @@ public:
                   VectorScheduler < Time >::end());
     }
 
-    void put_increase(typename Time::type time, Model < Time >* model)
-    {
-        remove(model);
-        VectorScheduler < Time >::push_back(
-            InternalEvent < Time >(time, model));
-        std::sort(VectorScheduler < Time >::begin(),
-                  VectorScheduler < Time >::end());
-    }
-
-    void put_decrease(typename Time::type time, Model < Time >* model)
+    void put(typename Time::type time, Model < Time >* model)
     {
         remove(model);
         VectorScheduler < Time >::push_back(

+ 62 - 74
src/dtss/Coordinator.hpp

@@ -1,5 +1,5 @@
 /**
- * @file Coordinator.hpp
+ * @file dtss/Coordinator.hpp
  * @author The PARADEVS Development Team
  * See the AUTHORS or Authors.txt file
  */
@@ -28,6 +28,8 @@
 #define DTSS_COORDINATOR 1
 
 #include <common/Coordinator.hpp>
+#include <common/Parameters.hpp>
+#include <common/Trace.hpp>
 
 #include <cassert>
 #include <iostream>
@@ -44,15 +46,23 @@ public:
     typename Time::type _time_step;
 };
 
-template < class Time, class Policy, class GraphManager >
+template < class Time, class Policy, class GraphManager,
+           class Parameters = Parameters < Time >,
+           class GraphParameters = common::NoParameters >
 class Coordinator : public common::Coordinator < Time >
 {
+    typedef Coordinator < Time, Policy, GraphManager, Parameters,
+                          GraphParameters > type;
+
 public:
-    typedef Parameters < Time > parameters_type;
+    typedef Parameters parameters_type;
+    typedef GraphParameters graph_parameters_type;
 
     Coordinator(const std::string& name,
-                const Parameters < Time >& parameters) :
-        common::Coordinator < Time >(name), _graph_manager(this),
+                const Parameters& parameters,
+                const GraphParameters& graph_paramaters) :
+        common::Coordinator < Time >(name),
+        _graph_manager(this, graph_paramaters),
         _time_step(parameters._time_step)
     { }
 
@@ -64,35 +74,31 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Policy, GraphManager >::get_name(), t,
-                common::I_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Coordinator < Time, Policy, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Policy, GraphManager >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::I_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
         assert(_graph_manager.children().size() > 0);
 
         for (auto & child : _graph_manager.children()) {
-            child->start(Coordinator < Time, Policy, GraphManager >::_tn);
+            child->start(type::_tn);
         }
-        Coordinator < Time, Policy, GraphManager >::_tl = t;
-        Coordinator < Time, Policy, GraphManager >::_tn = t;
+        type::_tl = t;
+        type::_tn = t;
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Policy, GraphManager >::get_name(), t,
-                common::I_MESSAGE)
-            << ": AFTER => "
-            << "tl = " << Coordinator < Time, Policy, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Policy, GraphManager >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::I_MESSAGE)
+            << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        return Coordinator < Time, Policy, GraphManager >::_tn;
+        return type::_tn;
     }
 
     typename Time::type dispatch_events(common::Bag < Time > bag,
@@ -101,13 +107,10 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Policy, GraphManager >::get_name(), t,
-                common::Y_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Coordinator < Time, Policy, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Policy, GraphManager >::_tn
-            << " ; bag = " << bag.to_string();
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::Y_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn << " ; bag = " << bag.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
@@ -115,16 +118,14 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Policy, GraphManager >::get_name(), t,
-                common::Y_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Coordinator < Time, Policy, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Policy, GraphManager >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::Y_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        return Coordinator < Time, Policy, GraphManager >::_tn;
+        return type::_tn;
     }
 
     void observation(std::ostream& file) const
@@ -139,16 +140,14 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Policy, GraphManager >::get_name(), t,
-                common::OUTPUT)
-            << ": BEFORE => "
-            << "tl = " << Coordinator < Time, Policy, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Policy, GraphManager >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::OUTPUT)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        if (t == Coordinator < Time, Policy, GraphManager >::_tn) {
+        if (t == type::_tn) {
             for (auto & model : _graph_manager.children()) {
                 model->output(t);
             }
@@ -156,12 +155,9 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Policy, GraphManager >::get_name(), t,
-                common::OUTPUT)
-            << ": AFTER => "
-            << "tl = " << Coordinator < Time, Policy, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Policy, GraphManager >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::OUTPUT)
+            << ": AFTER => " << "tl = " << type::_tl << " ; tn = " << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
@@ -173,25 +169,22 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Policy, GraphManager >::get_name(), t,
-                common::POST_EVENT)
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::POST_EVENT)
             << ": BEFORE => " << event.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
-        if (t == Coordinator < Time, Policy, GraphManager >::_tn) {
+        if (t == type::_tn) {
             _graph_manager.post_event(t, event);
         } else {
-            _policy(t, event, Coordinator < Time, Policy, GraphManager >::_tl,
-                    Coordinator < Time, Policy, GraphManager >::_tn);
+            _policy(t, event, type::_tl, type::_tn);
         }
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Policy, GraphManager >::get_name(), t,
-                common::POST_EVENT)
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::POST_EVENT)
             << ": AFTER => " << event.to_string();
         common::Trace < Time >::trace().flush();
 #endif
@@ -203,39 +196,34 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Policy, GraphManager >::get_name(), t,
-                common::S_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Coordinator < Time, Policy, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Policy, GraphManager >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::S_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        if (t == Coordinator < Time, Policy, GraphManager >::_tn) {
+        if (t == type::_tn) {
             for (auto & event : _policy.bag()) {
                 post_event(t, event);
             }
             for (auto & model : _graph_manager.children()) {
                 model->transition(t);
             }
-            Coordinator < Time, Policy, GraphManager >::_tl = t;
-            Coordinator < Time, Policy, GraphManager >::_tn = t + _time_step;
+            type::_tl = t;
+            type::_tn = t + _time_step;
         }
-        Coordinator < Time, Policy, GraphManager >::clear_bag();
+        type::clear_bag();
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Policy, GraphManager >::get_name(), t,
-                common::S_MESSAGE)
-            << ": AFTER => "
-            << "tl = " << Coordinator < Time, Policy, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Policy, GraphManager >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::S_MESSAGE)
+            << ": AFTER => " << "tl = " << type::_tl << " ; tn = " << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        return Coordinator < Time, Policy, GraphManager >::_tn;
+        return type::_tn;
     }
 
 private:

+ 3 - 2
src/dtss/Dynamics.hpp

@@ -36,11 +36,12 @@
 
 namespace paradevs { namespace dtss {
 
-template < class Time >
+template < class Time, class Parameters >
 class Dynamics
 {
 public:
-    Dynamics(const std::string& name) : _name(name)
+    Dynamics(const std::string& name, const Parameters& /* parameters */) :
+        _name(name)
     { }
 
     virtual ~Dynamics()

+ 5 - 3
src/dtss/GraphManager.hpp

@@ -1,5 +1,5 @@
 /**
- * @file GraphManager.hpp
+ * @file dtss/GraphManager.hpp
  * @author The PARADEVS Development Team
  * See the AUTHORS or Authors.txt file
  */
@@ -30,14 +30,16 @@
 #include <common/Coordinator.hpp>
 #include <common/Links.hpp>
 #include <common/Model.hpp>
+#include <common/Parameters.hpp>
 
 namespace paradevs { namespace dtss {
 
-template < class Time >
+template < class Time, class GraphParameters = common::NoParameters >
 class GraphManager
 {
 public:
-    GraphManager(common::Coordinator < Time >* coordinator) :
+    GraphManager(common::Coordinator < Time >* coordinator,
+                 const GraphParameters& /* parameters */) :
         _coordinator(coordinator)
     { }
 

+ 44 - 55
src/dtss/Simulator.hpp

@@ -1,5 +1,5 @@
 /**
- * @file Simulator.hpp
+ * @file dtss/Simulator.hpp
  * @author The PARADEVS Development Team
  * See the AUTHORS or Authors.txt file
  */
@@ -28,6 +28,7 @@
 #define DTSS_SIMULATOR 1
 
 #include <common/Coordinator.hpp>
+#include <common/Parameters.hpp>
 #include <common/Simulator.hpp>
 #include <common/Trace.hpp>
 
@@ -35,12 +36,15 @@
 
 namespace paradevs { namespace dtss {
 
-template < class Time, class Dynamics >
+template < class Time, class Dynamics, class Parameters = common::NoParameters >
 class Simulator : public common::Simulator < Time >
 {
+    typedef Simulator < Time, Dynamics, Parameters > type;
+
 public:
-    Simulator(const std::string& name, typename Time::type time_step) :
-        common::Simulator < Time >(name), _dynamics(name),
+    Simulator(const std::string& name, typename Time::type time_step,
+        const Parameters& parameters) :
+        common::Simulator < Time >(name), _dynamics(name, parameters),
         _time_step(time_step)
     { }
 
@@ -52,31 +56,27 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::I_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Simulator < Time, Dynamics >::_tl
-            << " ; tn = " << Simulator < Time, Dynamics >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::I_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
         _dynamics.start(t);
-        Simulator < Time, Dynamics >::_tl = t;
-        Simulator < Time, Dynamics >::_tn = t;
+        type::_tl = t;
+        type::_tn = t;
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::I_MESSAGE)
-            << ": AFTER => "
-            << "tl = " << Simulator < Time, Dynamics >::_tl
-            << " ; tn = " << Simulator < Time, Dynamics >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::I_MESSAGE)
+            << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        return Simulator < Time, Dynamics >::_tn;
+        return type::_tn;
     }
 
     void observation(std::ostream &file) const
@@ -89,14 +89,12 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::OUTPUT)
-            << ": BEFORE";
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::OUTPUT) << ": BEFORE";
         common::Trace < Time >::trace().flush();
 #endif
 
-        if (t == Simulator < Time, Dynamics >::_tn) {
+        if (t == type::_tn) {
             common::Bag < Time > bag = _dynamics.lambda(t);
 
             if (not bag.empty()) {
@@ -104,17 +102,14 @@ public:
                     event.set_model(this);
                 }
                 dynamic_cast < common::Coordinator < Time >* >(
-                    Simulator < Time, Dynamics >::get_parent())
-                    ->dispatch_events(bag, t);
+                    type::get_parent())->dispatch_events(bag, t);
             }
         }
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::OUTPUT)
-            << ": AFTER";
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::OUTPUT) << ": AFTER";
         common::Trace < Time >::trace().flush();
 #endif
 
@@ -130,20 +125,18 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::POST_EVENT)
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::POST_EVENT)
             << ": BEFORE => " << event.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
-        Simulator < Time, Dynamics >::add_event(event);
+        type::add_event(event);
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::POST_EVENT)
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::POST_EVENT)
             << ": AFTER => " << event.to_string();
         common::Trace < Time >::trace().flush();
 #endif
@@ -155,34 +148,30 @@ public:
 
  #ifdef WITH_TRACE
        common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::S_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Simulator < Time, Dynamics >::_tl
-            << " ; tn = " << Simulator < Time, Dynamics >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::S_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        // assert(t == Simulator < Time, Dynamics >::_tn);
+        assert(t == type::_tn);
 
-        _dynamics.transition(Simulator < Time, Dynamics >::get_bag(), t);
-        Simulator < Time, Dynamics >::_tl = t;
-        Simulator < Time, Dynamics >::_tn = t + _time_step;
-        Simulator < Time, Dynamics >::clear_bag();
+        _dynamics.transition(type::get_bag(), t);
+        type::_tl = t;
+        type::_tn = t + _time_step;
+        type::clear_bag();
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::S_MESSAGE)
-            << ": AFTER => "
-            << "tl = " << Simulator < Time, Dynamics >::_tl
-            << " ; tn = " << Simulator < Time, Dynamics >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::S_MESSAGE)
+            << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        return Simulator < Time, Dynamics >::_tn;
+        return type::_tn;
     }
 
 private :

+ 72 - 104
src/pdevs/Coordinator.hpp

@@ -1,5 +1,5 @@
 /**
- * @file Coordinator.hpp
+ * @file pdevs/Coordinator.hpp
  * @author The PARADEVS Development Team
  * See the AUTHORS or Authors.txt file
  */
@@ -28,6 +28,7 @@
 #define PDEVS_COORDINATOR 1
 
 #include <common/Coordinator.hpp>
+#include <common/Parameters.hpp>
 #include <common/Trace.hpp>
 
 #include <cassert>
@@ -35,21 +36,23 @@
 
 namespace paradevs { namespace pdevs {
 
-class Parameters
-{
-public:
-    Parameters()
-    { }
-};
-
-template < class Time, class Scheduler, class GraphManager >
+template < class Time, class Scheduler, class GraphManager,
+           class Parameters = common::NoParameters,
+           class GraphParameters = common::NoParameters >
 class Coordinator : public common::Coordinator < Time >
 {
+    typedef Coordinator < Time, Scheduler, GraphManager,
+                          Parameters, GraphParameters > type;
+
 public:
     typedef Parameters parameters_type;
+    typedef GraphParameters graph_parameters_type;
 
-    Coordinator(const std::string& name, const Parameters& /* parameters */) :
-        common::Coordinator < Time >(name), _graph_manager(this)
+    Coordinator(const std::string& name,
+                const Parameters& /* parameters */,
+                const GraphParameters& graph_parameters) :
+        common::Coordinator < Time >(name),
+        _graph_manager(this, graph_parameters)
     { }
 
     virtual ~Coordinator()
@@ -60,12 +63,10 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::I_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Coordinator < Time, Scheduler, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Scheduler, GraphManager >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::I_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
@@ -74,25 +75,22 @@ public:
         for (auto & child : _graph_manager.children()) {
             _event_table.init(child->start(
                                   Coordinator < Time, Scheduler,
-                                  GraphManager >::_tn),
-                              child);
+                                  GraphManager, Parameters,
+                                  GraphParameters >::_tn), child);
         }
-        Coordinator < Time, Scheduler, GraphManager >::_tl = t;
-        Coordinator < Time, Scheduler, GraphManager >::_tn =
-            _event_table.get_current_time();
+        type::_tl = t;
+        type::_tn = _event_table.get_current_time();
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::I_MESSAGE)
-            << ": AFTER => "
-            << "tl = " << Coordinator < Time, Scheduler, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Scheduler, GraphManager >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::I_MESSAGE)
+            << ": AFTER => " << "tl = " << type::_tl
+            << " ; tn = " << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        return Coordinator < Time, Scheduler, GraphManager >::_tn;
+        return type::_tn;
     }
 
 /**************************************************
@@ -109,25 +107,21 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::OUTPUT)
-            << ": BEFORE => "
-            << "tl = " << Coordinator < Time, Scheduler, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Scheduler, GraphManager >::_tn
-            << " ; scheduler = " << _event_table.to_string();
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::OUTPUT)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn << " ; scheduler = " << _event_table.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
-        // assert(t == Coordinator < Time, Scheduler, GraphManager >::_tn);
+        assert(t == type::_tn);
 
         common::Models < Time > IMM = _event_table.get_current_models(t);
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::OUTPUT)
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::OUTPUT)
             << ": IMM = " << IMM.to_string();
         common::Trace < Time >::trace().flush();
 #endif
@@ -138,13 +132,10 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::OUTPUT)
-            << ": AFTER => "
-            << "tl = " << Coordinator < Time, Scheduler, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Scheduler, GraphManager >::_tn
-            << " ; scheduler = " << _event_table.to_string();
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::OUTPUT)
+            << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn << " ; scheduler = " << _event_table.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
@@ -166,17 +157,14 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::S_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Coordinator < Time, Scheduler, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Scheduler, GraphManager >::_tn
-            << " ; scheduler = " << _event_table.to_string();
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::S_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn << " ; scheduler = " << _event_table.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
-        // assert(t >= Coordinator < Time, Scheduler, GraphManager >::_tl and t <= Coordinator < Time, Scheduler, GraphManager >::_tn);
+        assert(t >= type::_tl and t <= type::_tn);
 
         common::Models < Time > receivers = _event_table.get_current_models(t);
 
@@ -184,43 +172,31 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::S_MESSAGE)
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::S_MESSAGE)
             << ": receivers = " << receivers.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
         for (auto & model : receivers) {
-            typename Time::type previous_tn  = model->get_tn();
-            typename Time::type tn = model->transition(t);
-
-            if (previous_tn < tn) {
-                _event_table.put_increase(tn, model);
-            } else if (previous_tn > tn) {
-                _event_table.put_decrease(tn, model);
-            }
+            _event_table.put(model->transition(t), model);
         }
 
         update_event_table(t);
-        Coordinator < Time, Scheduler, GraphManager >::_tl = t;
-        Coordinator < Time, Scheduler, GraphManager >::_tn =
-            _event_table.get_current_time();
-        Coordinator < Time, Scheduler, GraphManager >::clear_bag();
+        type::_tl = t;
+        type::_tn = _event_table.get_current_time();
+        type::clear_bag();
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::S_MESSAGE)
-            << ": AFTER => "
-            << "tl = " << Coordinator < Time, Scheduler, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Scheduler, GraphManager >::_tn
-            << " ; scheduler = " << _event_table.to_string();
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::S_MESSAGE)
+            << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn << " ; scheduler = " << _event_table.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
-        return Coordinator < Time, Scheduler, GraphManager >::_tn;
+        return type::_tn;
     }
 
     void post_event(typename Time::type t,
@@ -229,24 +205,21 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::POST_EVENT)
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::POST_EVENT)
             << ": BEFORE => " << event.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
-        Coordinator < Time, Scheduler, GraphManager >::add_event(event);
+        type::add_event(event);
         _graph_manager.post_event(t, event);
         update_event_table(t);
-        Coordinator < Time, Scheduler, GraphManager >::_tn =
-            _event_table.get_current_time();
+        type::_tn = _event_table.get_current_time();
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::POST_EVENT)
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::POST_EVENT)
             << ": AFTER => " << event.to_string();
         common::Trace < Time >::trace().flush();
 #endif
@@ -262,33 +235,28 @@ public:
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::Y_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Coordinator < Time, Scheduler, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Scheduler, GraphManager >::_tn
-            << " ; bag = " << bag.to_string();
+            << common::TraceElement < Time >( type::get_name(), t,
+                                              common::Y_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn << " ; bag = " << bag.to_string()
+            << " ; " << _event_table.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
         _graph_manager.dispatch_events(bag, t);
         update_event_table(t);
-        Coordinator < Time, Scheduler, GraphManager >::_tn =
-            _event_table.get_current_time();
+        type::_tn = _event_table.get_current_time();
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Coordinator < Time, Scheduler, GraphManager >::get_name(), t,
-                common::Y_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Coordinator < Time, Scheduler, GraphManager >::_tl
-            << " ; tn = " << Coordinator < Time, Scheduler, GraphManager >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::Y_MESSAGE)
+            << ": AFTER => " << "tl = " << type::_tl << " ; tn = " << type::_tn
+            << " ; " << _event_table.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
-        return Coordinator < Time, Scheduler, GraphManager >::_tn;
+        return type::_tn;
     }
 
     void observation(std::ostream& file) const
@@ -314,7 +282,7 @@ public:
     {
         for (auto & model : _graph_manager.children()) {
             if (model->event_number() > 0) {
-                _event_table.put_decrease(t, model);
+                _event_table.put(t, model);
             }
         }
     }

+ 4 - 2
src/pdevs/Dynamics.hpp

@@ -29,17 +29,19 @@
 
 #include <common/Bag.hpp>
 #include <common/ExternalEvent.hpp>
+#include <common/Parameters.hpp>
 
 #include <string>
 #include <vector>
 
 namespace paradevs { namespace pdevs {
 
-template < class Time >
+template < class Time, class Parameters = common::NoParameters >
 class Dynamics
 {
 public:
-    Dynamics(const std::string& name) : _name(name)
+    Dynamics(const std::string& name, const Parameters& /* parameters */) :
+        _name(name)
     { }
 
     virtual ~Dynamics()

+ 5 - 3
src/pdevs/GraphManager.hpp

@@ -1,5 +1,5 @@
 /**
- * @file GraphManager.hpp
+ * @file pdevs/GraphManager.hpp
  * @author The PARADEVS Development Team
  * See the AUTHORS or Authors.txt file
  */
@@ -30,14 +30,16 @@
 #include <common/Coordinator.hpp>
 #include <common/Links.hpp>
 #include <common/Model.hpp>
+#include <common/Parameters.hpp>
 
 namespace paradevs { namespace pdevs {
 
-template < class Time >
+template < class Time, class GraphParameters = common::NoParameters >
 class GraphManager
 {
 public:
-    GraphManager(common::Coordinator < Time >* coordinator) :
+    GraphManager(common::Coordinator < Time >* coordinator,
+                 const GraphParameters& /* parameters */) :
         _coordinator(coordinator)
     { }
 

+ 46 - 61
src/pdevs/Simulator.hpp

@@ -1,5 +1,5 @@
 /**
- * @file Simulator.hpp
+ * @file pdevs/Simulator.hpp
  * @author The PARADEVS Development Team
  * See the AUTHORS or Authors.txt file
  */
@@ -28,6 +28,7 @@
 #define PDEVS_SIMULATOR 1
 
 #include <common/Coordinator.hpp>
+#include <common/Parameters.hpp>
 #include <common/Simulator.hpp>
 #include <common/Trace.hpp>
 
@@ -35,12 +36,14 @@
 
 namespace paradevs { namespace pdevs {
 
-template < class Time, class Dynamics >
+template < class Time, class Dynamics, class Parameters = common::NoParameters >
 class Simulator : public common::Simulator < Time >
 {
+    typedef Simulator < Time, Dynamics, Parameters > type;
+
 public :
-    Simulator(const std::string& name) :
-        common::Simulator < Time >(name), _dynamics(name)
+    Simulator(const std::string& name, const Parameters& parameters) :
+        common::Simulator < Time >(name), _dynamics(name, parameters)
     { }
 
     ~Simulator()
@@ -56,31 +59,27 @@ public :
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::I_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Simulator < Time, Dynamics >::_tl
-            << " ; tn = " << Simulator < Time, Dynamics >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::I_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        Simulator < Time, Dynamics >::_tl = t;
-        Simulator < Time, Dynamics >::_tn =
-            Simulator < Time, Dynamics >::_tl + _dynamics.start(t);
+        type::_tl = t;
+        type::_tn =
+            type::_tl + _dynamics.start(t);
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::I_MESSAGE)
-            << ": AFTER => "
-            << "tl = " << Simulator < Time, Dynamics >::_tl
-            << " ; tn = " << Simulator < Time, Dynamics >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::I_MESSAGE)
+            << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        return Simulator < Time, Dynamics >::_tn;
+        return type::_tn;
     }
 
     void observation(std::ostream &file) const
@@ -99,14 +98,12 @@ public :
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::OUTPUT)
-            << ": BEFORE";
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::OUTPUT) << ": BEFORE";
         common::Trace < Time >::trace().flush();
 #endif
 
-        if(t == Simulator < Time, Dynamics >::_tn) {
+        if(t == type::_tn) {
             common::Bag < Time > bag = _dynamics.lambda(t);
 
             if (not bag.empty()) {
@@ -114,17 +111,14 @@ public :
                     event.set_model(this);
                 }
                 dynamic_cast < common::Coordinator < Time >* >(
-                    Simulator < Time, Dynamics >::get_parent())
-                    ->dispatch_events(bag, t);
+                    type::get_parent())->dispatch_events(bag, t);
             }
         }
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::OUTPUT)
-            << ": AFTER";
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::OUTPUT) << ": AFTER";
         common::Trace < Time >::trace().flush();
 #endif
 
@@ -140,20 +134,18 @@ public :
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::POST_EVENT)
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::POST_EVENT)
             << ": BEFORE => " << event.to_string();
         common::Trace < Time >::trace().flush();
 #endif
 
-        Simulator < Time, Dynamics >::add_event(event);
+        type::add_event(event);
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::POST_EVENT)
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::POST_EVENT)
             << ": AFTER => " << event.to_string();
         common::Trace < Time >::trace().flush();
 #endif
@@ -177,44 +169,37 @@ public :
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::S_MESSAGE)
-            << ": BEFORE => "
-            << "tl = " << Simulator < Time, Dynamics >::_tl
-            << " ; tn = " << Simulator < Time, Dynamics >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::S_MESSAGE)
+            << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
+            << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        // assert(Simulator < Time, Dynamics >::_tl <= t and t <= Simulator < Time, Dynamics >::_tn);
+        assert(type::_tl <= t and t <= type::_tn);
 
-        if(t == Simulator < Time, Dynamics >::_tn) {
-            if (Simulator < Time, Dynamics >::event_number() == 0) {
+        if(t == type::_tn) {
+            if (type::event_number() == 0) {
                 _dynamics.dint(t);
             } else {
-                _dynamics.dconf(t, t - Simulator < Time, Dynamics >::_tl,
-                                Simulator < Time, Dynamics >::get_bag());
+                _dynamics.dconf(t, t - type::_tl, type::get_bag());
             }
         } else {
-            _dynamics.dext(t, t - Simulator < Time, Dynamics >::_tl,
-                           Simulator < Time, Dynamics >::get_bag());
+            _dynamics.dext(t, t - type::_tl, type::get_bag());
         }
-        Simulator < Time, Dynamics >::_tn = t + _dynamics.ta(t);
-        Simulator < Time, Dynamics >::_tl = t;
-        Simulator < Time, Dynamics >::clear_bag();
+        type::_tn = t + _dynamics.ta(t);
+        type::_tl = t;
+        type::clear_bag();
 
 #ifdef WITH_TRACE
         common::Trace < Time >::trace()
-            << common::TraceElement < Time >(
-                Simulator < Time, Dynamics >::get_name(), t,
-                common::S_MESSAGE)
-            << ": AFTER => "
-            << "tl = " << Simulator < Time, Dynamics >::_tl
-            << " ; tn = " << Simulator < Time, Dynamics >::_tn;
+            << common::TraceElement < Time >(type::get_name(), t,
+                                             common::S_MESSAGE)
+            << ": AFTER => " << "tl = " << type::_tl << " ; tn = " << type::_tn;
         common::Trace < Time >::trace().flush();
 #endif
 
-        return Simulator < Time, Dynamics >::_tn;
+        return type::_tn;
     }
 
 private :

+ 4 - 29
src/tests/CMakeLists.txt

@@ -9,32 +9,7 @@ LINK_DIRECTORIES(
   ${GLIBMM_LIBRARY_DIRS}
   ${LIBXML_LIBRARY_DIR})
 
-# pdevs tests
-ADD_EXECUTABLE(pdevs-tests ${COMMON_HPP} ${COMMON_SCHEDULER_HPP} ${PDEVS_HPP}
-  pdevs_tests.hpp pdevs_tests.cpp)
-SET_TARGET_PROPERTIES(pdevs-tests PROPERTIES ${PARADEVS_APP_PROPERTIES})
-
-TARGET_LINK_LIBRARIES(pdevs-tests
-  ${GLIBMM_LIBRARIES}
-  ${LIBXML_LIBRARIES}
-  ${GTHREAD_LIBRARIES})
-
-# dtss tests
-ADD_EXECUTABLE(dtss-tests ${COMMON_HPP} ${DTSS_HPP} dtss_tests.hpp
-  dtss_tests.cpp)
-SET_TARGET_PROPERTIES(dtss-tests PROPERTIES ${PARADEVS_APP_PROPERTIES})
-
-TARGET_LINK_LIBRARIES(dtss-tests
-  ${GLIBMM_LIBRARIES}
-  ${LIBXML_LIBRARIES}
-  ${GTHREAD_LIBRARIES})
-
-# mixed tests
-ADD_EXECUTABLE(mixed-tests ${COMMON_HPP} ${COMMON_SCHEDULER_HPP} ${DTSS_HPP}
-  ${PDEVS_HPP} mixed_tests.hpp mixed_tests.cpp)
-SET_TARGET_PROPERTIES(mixed-tests PROPERTIES ${PARADEVS_APP_PROPERTIES})
-
-TARGET_LINK_LIBRARIES(mixed-tests
-  ${GLIBMM_LIBRARIES}
-  ${LIBXML_LIBRARIES}
-  ${GTHREAD_LIBRARIES})
+ADD_SUBDIRECTORY(boost_graph)
+ADD_SUBDIRECTORY(dtss)
+ADD_SUBDIRECTORY(mixed)
+ADD_SUBDIRECTORY(pdevs)

+ 21 - 0
src/tests/boost_graph/CMakeLists.txt

@@ -0,0 +1,21 @@
+INCLUDE_DIRECTORIES(
+  ${PARADEVS_BINARY_DIR}/src
+  ${PARADEVS_SOURCE_DIR}/src
+  ${Boost_INCLUDE_DIRS}
+  ${GLIBMM_INCLUDE_DIRS}
+  ${LIBXML_INCLUDE_DIRS})
+
+LINK_DIRECTORIES(
+  ${GLIBMM_LIBRARY_DIRS}
+  ${LIBXML_LIBRARY_DIR})
+
+# graph tests
+ADD_EXECUTABLE(graph-tests ${COMMON_HPP} ${COMMON_SCHEDULER_HPP} ${PDEVS_HPP}
+  graph_manager.hpp tests.cpp models.hpp)
+SET_TARGET_PROPERTIES(graph-tests PROPERTIES ${PARADEVS_APP_PROPERTIES})
+
+TARGET_LINK_LIBRARIES(graph-tests
+  ${Boost_LIBRARIES}
+  ${GLIBMM_LIBRARIES}
+  ${LIBXML_LIBRARIES}
+  ${GTHREAD_LIBRARIES})

+ 387 - 0
src/tests/boost_graph/graph_manager.hpp

@@ -0,0 +1,387 @@
+/**
+ * @file tests/boost_graph/graph_manager.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __TESTS_BOOST_GRAPH_GRAPH_MANAGER_HPP
+#define __TESTS_BOOST_GRAPH_GRAPH_MANAGER_HPP 1
+
+#include <boost/graph/adjacency_list.hpp>
+
+#include <common/scheduler/HeapScheduler.hpp>
+#include <common/scheduler/VectorScheduler.hpp>
+
+#include <pdevs/Coordinator.hpp>
+#include <pdevs/GraphManager.hpp>
+#include <pdevs/Simulator.hpp>
+
+#include <tests/boost_graph/models.hpp>
+
+namespace paradevs { namespace tests { namespace boost_graph {
+
+struct VertexProperties
+{
+    double _weight;
+    DynamicsType _type;
+
+    VertexProperties() : _weight(0), _type(NORMAL_PIXEL)
+    { }
+    VertexProperties(double weight, DynamicsType type) :
+        _weight(weight), _type(type)
+    { }
+};
+
+typedef boost::property < boost::edge_weight_t, double > EdgeProperty;
+typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::directedS,
+                                VertexProperties, EdgeProperty> Graph;
+typedef std::vector < Graph > Graphs;
+typedef std::pair < int, int > Edge;
+typedef std::vector < Edge > Edges;
+typedef std::vector < Edges > EdgeList;
+
+struct GraphParameters
+{
+    Graph _graph;
+    Edges _edges;
+
+    GraphParameters(const Graph& graph, const Edges& edges) :
+        _graph(graph), _edges(edges)
+    { }
+};
+
+template < class Parameters >
+class FlatGraphManager :
+    public paradevs::pdevs::GraphManager < MyTime, Parameters >
+{
+public:
+    FlatGraphManager(common::Coordinator < MyTime >* coordinator,
+        const Parameters& parameters) :
+        paradevs::pdevs::GraphManager < MyTime, Parameters >(
+            coordinator, parameters)
+    { }
+
+    virtual ~FlatGraphManager()
+    {
+        // TODO
+    }
+
+    void build_flat_graph(const Graph& g)
+    {
+        Graph::vertex_iterator vertexIt, vertexEnd;
+
+        boost::tie(vertexIt, vertexEnd) = boost::vertices(g);
+	for (; vertexIt != vertexEnd; ++vertexIt)
+	{
+            std::ostringstream ss;
+
+            ss << "a" << *vertexIt;
+
+            switch (g[*vertexIt]._type) {
+            case TOP_PIXEL:
+                _top_simulators[*vertexIt] =
+                    new pdevs::Simulator <
+                        MyTime, TopPixel, TopPixelParameters >(
+                            ss.str(), TopPixelParameters());
+                FlatGraphManager < Parameters >::add_child(
+                    _top_simulators[*vertexIt]);
+                break;
+            case NORMAL_PIXEL:
+                unsigned int n = 0;
+                Graph::adjacency_iterator neighbourIt, neighbourEnd;
+
+                boost::tie(neighbourIt, neighbourEnd) =
+                    boost::adjacent_vertices(*vertexIt, g);
+                for (; neighbourIt != neighbourEnd; ++neighbourIt) {
+                    ++n;
+                }
+                _normal_simulators[*vertexIt] =
+                    new pdevs::Simulator <
+                        MyTime, NormalPixel, NormalPixelParameters >(
+                            ss.str(), NormalPixelParameters(n));
+                FlatGraphManager < Parameters >::add_child(
+                        _normal_simulators[*vertexIt]);
+                break;
+            };
+        }
+
+        boost::tie(vertexIt, vertexEnd) = boost::vertices(g);
+	for (; vertexIt != vertexEnd; ++vertexIt)
+	{
+            Graph::adjacency_iterator neighbourIt, neighbourEnd;
+
+            boost::tie(neighbourIt, neighbourEnd) =
+                boost::adjacent_vertices(*vertexIt, g);
+            for (; neighbourIt != neighbourEnd; ++neighbourIt) {
+                paradevs::common::Model < MyTime >* a = 0;
+                paradevs::common::Model < MyTime >* b = 0;
+
+                if (g[*vertexIt]._type == TOP_PIXEL) {
+                    a = _top_simulators[*vertexIt];
+                } else {
+                    a = _normal_simulators[*vertexIt];
+                }
+                if (g[*neighbourIt]._type == TOP_PIXEL) {
+                    b = _top_simulators[*neighbourIt];
+                } else {
+                    b = _normal_simulators[*neighbourIt];
+                }
+                FlatGraphManager < Parameters >::add_link(b, "out", a, "in");
+            }
+	}
+    }
+
+private:
+    std::map < int, pdevs::Simulator <
+                        MyTime, TopPixel,
+                        TopPixelParameters >* > _top_simulators;
+    std::map < int, pdevs::Simulator <
+                        MyTime, NormalPixel,
+                        NormalPixelParameters>* > _normal_simulators;
+};
+
+class BuiltFlatGraphManager :
+    public FlatGraphManager < GraphParameters >
+{
+public:
+    BuiltFlatGraphManager(common::Coordinator < MyTime >* coordinator,
+                          const GraphParameters& parameters) :
+        FlatGraphManager < GraphParameters >(
+            coordinator, parameters)
+    {
+        build_flat_graph(parameters._graph);
+    }
+
+    virtual ~BuiltFlatGraphManager()
+    { }
+};
+
+template < class GraphBuilder >
+class InBuildFlatGraphManager :
+    public FlatGraphManager < paradevs::common::NoParameters >
+{
+public:
+    InBuildFlatGraphManager(common::Coordinator < MyTime >* coordinator,
+                            const paradevs::common::NoParameters& parameters) :
+        FlatGraphManager < paradevs::common::NoParameters >(
+            coordinator, parameters)
+    {
+        GraphBuilder builder;
+        Graphs graphs;
+        EdgeList edges;
+
+        builder.build(graphs, edges);
+        build_flat_graph(graphs.front());
+    }
+
+    virtual ~InBuildFlatGraphManager()
+    { }
+};
+
+class FlatGraphBuilder
+{
+public:
+    FlatGraphBuilder()
+    { }
+
+    void build(Graphs& graphs, EdgeList& /* edges */)
+    {
+        Graph graph;
+
+        Graph::vertex_descriptor v0 = boost::add_vertex(graph);
+        Graph::vertex_descriptor v1 = boost::add_vertex(graph);
+        Graph::vertex_descriptor v2 = boost::add_vertex(graph);
+        Graph::vertex_descriptor v3 = boost::add_vertex(graph);
+        Graph::vertex_descriptor v4 = boost::add_vertex(graph);
+        Graph::vertex_descriptor v5 = boost::add_vertex(graph);
+        Graph::vertex_descriptor v6 = boost::add_vertex(graph);
+        Graph::vertex_descriptor v7 = boost::add_vertex(graph);
+        Graph::vertex_descriptor v8 = boost::add_vertex(graph);
+        Graph::vertex_descriptor v9 = boost::add_vertex(graph);
+        Graph::vertex_descriptor v10 = boost::add_vertex(graph);
+
+        boost::add_edge(v0, v1, 1, graph);
+	boost::add_edge(v0, v2, 1, graph);
+	boost::add_edge(v0, v3, 1, graph);
+	boost::add_edge(v1, v2, 1, graph);
+	boost::add_edge(v1, v4, 1, graph);
+	boost::add_edge(v1, v5, 1, graph);
+	boost::add_edge(v1, v6, 1, graph);
+	boost::add_edge(v2, v6, 1, graph);
+	boost::add_edge(v2, v3, 1, graph);
+	boost::add_edge(v3, v9, 1, graph);
+	boost::add_edge(v3, v10, 1, graph);
+	boost::add_edge(v4, v5, 1, graph);
+	boost::add_edge(v5, v6, 1, graph);
+	boost::add_edge(v4, v7, 1, graph);
+	boost::add_edge(v4, v8, 1, graph);
+	boost::add_edge(v7, v8, 1, graph);
+	boost::add_edge(v9, v10, 1, graph);
+
+        graph[v6] = VertexProperties(1, TOP_PIXEL);
+        graph[v8] = VertexProperties(1, TOP_PIXEL);
+        graph[v10] = VertexProperties(1, TOP_PIXEL);
+        graph[v0] = VertexProperties(1, NORMAL_PIXEL);
+        graph[v1] = VertexProperties(1, NORMAL_PIXEL);
+        graph[v2] = VertexProperties(1, NORMAL_PIXEL);
+        graph[v3] = VertexProperties(1, NORMAL_PIXEL);
+        graph[v4] = VertexProperties(1, NORMAL_PIXEL);
+        graph[v5] = VertexProperties(1, NORMAL_PIXEL);
+        graph[v7] = VertexProperties(1, NORMAL_PIXEL);
+        graph[v9] = VertexProperties(1, NORMAL_PIXEL);
+
+        graphs.push_back(graph);
+    }
+};
+
+template < class GraphBuilder >
+class HierarchicalGraphManager :
+    public paradevs::pdevs::GraphManager < MyTime,
+                                           paradevs::common::NoParameters >
+{
+public:
+    HierarchicalGraphManager(common::Coordinator < MyTime >* coordinator,
+                             const paradevs::common::NoParameters& parameters) :
+        paradevs::pdevs::GraphManager < MyTime,
+                                        paradevs::common::NoParameters >(
+                                            coordinator, parameters)
+    {
+        GraphBuilder graph_builder;
+        Graphs graphs;
+        EdgeList edges;
+
+        graph_builder.build(graphs, edges);
+
+        // build coordinators (graphs)
+        for (unsigned int i = 0; i < graphs.size(); ++i) {
+            Coordinator* coordinator = 0;
+            std::ostringstream ss;
+
+            ss << "S" << i;
+            coordinator =
+                new Coordinator(ss.str(), paradevs::common::NoParameters(),
+                                GraphParameters(graphs[i], edges[i]));
+            _coordinators.push_back(coordinator);
+            HierarchicalGraphManager < GraphBuilder >::add_child(
+                coordinator);
+
+        }
+
+        // builds internal connections (edges)
+        for (unsigned int i = 0; i < edges.size(); ++i) {
+            // TODO
+        }
+    }
+
+    virtual ~HierarchicalGraphManager()
+    {
+        // TODO
+    }
+
+private:
+    typedef paradevs::pdevs::Coordinator <
+    MyTime,
+    paradevs::common::scheduler::VectorScheduler < MyTime >,
+    BuiltFlatGraphManager, paradevs::common::NoParameters,
+    GraphParameters > Coordinator;
+
+    std::vector < Coordinator* > _coordinators;
+};
+
+class HierarchicalGraphBuilder
+{
+public:
+    HierarchicalGraphBuilder()
+    { }
+
+    void build(Graphs& graphs, EdgeList& edges)
+    {
+        // S1
+        {
+            Graph graph;
+
+            Graph::vertex_descriptor v1 = boost::add_vertex(graph);
+            Graph::vertex_descriptor v2 = boost::add_vertex(graph);
+            Graph::vertex_descriptor v4 = boost::add_vertex(graph);
+            Graph::vertex_descriptor v5 = boost::add_vertex(graph);
+            Graph::vertex_descriptor v6 = boost::add_vertex(graph);
+            Graph::vertex_descriptor v7 = boost::add_vertex(graph);
+            Graph::vertex_descriptor v8 = boost::add_vertex(graph);
+
+            boost::add_edge(v1, v2, 1, graph);
+            boost::add_edge(v1, v4, 1, graph);
+            boost::add_edge(v1, v5, 1, graph);
+            boost::add_edge(v1, v6, 1, graph);
+            boost::add_edge(v2, v6, 1, graph);
+            boost::add_edge(v4, v5, 1, graph);
+            boost::add_edge(v5, v6, 1, graph);
+            boost::add_edge(v4, v7, 1, graph);
+            boost::add_edge(v4, v8, 1, graph);
+            boost::add_edge(v7, v8, 1, graph);
+
+            graph[v6] = VertexProperties(1, TOP_PIXEL);
+            graph[v8] = VertexProperties(1, TOP_PIXEL);
+            graph[v1] = VertexProperties(1, NORMAL_PIXEL);
+            graph[v2] = VertexProperties(1, NORMAL_PIXEL);
+            graph[v4] = VertexProperties(1, NORMAL_PIXEL);
+            graph[v5] = VertexProperties(1, NORMAL_PIXEL);
+            graph[v7] = VertexProperties(1, NORMAL_PIXEL);
+
+            graphs.push_back(graph);
+        }
+        // S2
+        {
+            Graph graph;
+
+            Graph::vertex_descriptor v0 = boost::add_vertex(graph);
+            Graph::vertex_descriptor v3 = boost::add_vertex(graph);
+            Graph::vertex_descriptor v9 = boost::add_vertex(graph);
+            Graph::vertex_descriptor v10 = boost::add_vertex(graph);
+
+            boost::add_edge(v0, v3, 1, graph);
+            boost::add_edge(v3, v10, 1, graph);
+            boost::add_edge(v9, v10, 1, graph);
+            boost::add_edge(v3, v9, 1, graph);
+
+            graph[v10] = VertexProperties(1, TOP_PIXEL);
+            graph[v0] = VertexProperties(1, NORMAL_PIXEL);
+            graph[v3] = VertexProperties(1, NORMAL_PIXEL);
+            graph[v9] = VertexProperties(1, NORMAL_PIXEL);
+
+            graphs.push_back(graph);
+        }
+        {
+            // S1 -> S2
+            edges.push_back(std::vector < std::pair < int, int >>());
+            edges[0].push_back(std::pair < int, int >(1, 0));
+            edges[0].push_back(std::pair < int, int >(2, 0));
+            // S2 -> S1
+            edges.push_back(std::vector < std::pair < int, int >>());
+            edges[1].push_back(std::pair < int, int >(3, 2));
+        }
+    }
+};
+
+} } } // namespace paradevs tests boost_graph
+
+#endif

+ 188 - 0
src/tests/boost_graph/models.hpp

@@ -0,0 +1,188 @@
+/**
+ * @file tests/boost_graph/models.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __TESTS_BOOST_GRAPH_MODELS_HPP
+#define __TESTS_BOOST_GRAPH_MODELS_HPP 1
+
+#include <common/Time.hpp>
+
+#include <pdevs/Dynamics.hpp>
+
+#include <limits>
+
+namespace paradevs { namespace tests { namespace boost_graph {
+
+template < typename T >
+struct Limits
+{
+    static constexpr T negative_infinity =
+        -std::numeric_limits < T >::infinity();
+    static constexpr T positive_infinity =
+        std::numeric_limits < T >::infinity();
+    static constexpr T null = 0;
+};
+
+typedef paradevs::common::Time < double, Limits < double > > MyTime;
+
+struct TopPixelParameters
+{ };
+
+class TopPixel : public paradevs::pdevs::Dynamics < MyTime, TopPixelParameters >
+{
+public:
+    TopPixel(const std::string& name,
+             const TopPixelParameters& parameters) :
+        paradevs::pdevs::Dynamics < MyTime,
+                                    TopPixelParameters >(name, parameters)
+    { }
+
+    virtual ~TopPixel()
+    { }
+
+    virtual void dint(typename MyTime::type t)
+    {
+
+        std::cout << get_name() << " at " << t << ": dint" << std::endl;
+
+    }
+
+    virtual typename MyTime::type start(typename MyTime::type /* t */)
+    { return 0; }
+
+    virtual typename MyTime::type ta(typename MyTime::type /* t */) const
+    { return 1; }
+
+    virtual common::Bag < MyTime > lambda(typename MyTime::type t) const
+    {
+
+        std::cout << get_name() << " at " << t << ": lambda" << std::endl;
+
+        common::Bag < MyTime > bag;
+
+        bag.push_back(common::ExternalEvent < MyTime >("out", 0.));
+        return bag;
+    }
+};
+
+struct NormalPixelParameters
+{
+    NormalPixelParameters(unsigned int n) : _neighbour_number(n)
+    { }
+
+    unsigned int _neighbour_number;
+};
+
+class NormalPixel : public paradevs::pdevs::Dynamics < MyTime,
+                                                       NormalPixelParameters >
+{
+public:
+    NormalPixel(const std::string& name,
+             const NormalPixelParameters& parameters) :
+        paradevs::pdevs::Dynamics < MyTime,
+                                    NormalPixelParameters >(name, parameters),
+        _neighbour_number(parameters._neighbour_number)
+    { }
+
+    virtual ~NormalPixel()
+    { }
+
+    virtual void dint(typename MyTime::type t)
+    {
+
+        std::cout << get_name() << " at " << t << ": dint" << std::endl;
+
+        if (_phase == SEND) {
+            _phase = WAIT;
+            _received = 0;
+        }
+    }
+
+    virtual void dext(typename MyTime::type t,
+                      typename MyTime::type /* e */,
+                      const common::Bag < MyTime >& bag)
+    {
+
+        std::cout << get_name() << " at " << t << ": dext" << std::endl;
+
+        for (common::Bag < MyTime >::const_iterator it = bag.begin();
+             it != bag.end(); ++it) {
+            if (it->on_port("in")) {
+                ++_received;
+                if (_received == _neighbour_number) {
+                    _phase = SEND;
+                }
+            }
+        }
+    }
+
+    virtual typename MyTime::type start(typename MyTime::type /* t */)
+    {
+        _phase = WAIT;
+        _received = 0;
+        return MyTime::infinity;
+    }
+
+    virtual typename MyTime::type ta(typename MyTime::type t) const
+    {
+
+        std::cout << get_name() << " at " << t << ": ta" << std::endl;
+
+        if (_phase == WAIT) {
+            return MyTime::infinity;
+        } else {
+            return 0;
+        }
+    }
+
+    virtual common::Bag < MyTime > lambda(typename MyTime::type t) const
+    {
+
+        std::cout << get_name() << " at " << t << ": lambda" << std::endl;
+
+        common::Bag < MyTime > bag;
+
+        if (_phase == SEND) {
+            bag.push_back(common::ExternalEvent < MyTime >("out", 0.));
+        }
+        return bag;
+    }
+
+private:
+    enum Phase { WAIT, SEND };
+
+    unsigned int _neighbour_number;
+
+    Phase _phase;
+    unsigned int _received;
+};
+
+enum DynamicsType {
+    TOP_PIXEL = 0, NORMAL_PIXEL
+};
+
+} } } // namespace paradevs tests boost_graph
+
+#endif

+ 64 - 0
src/tests/boost_graph/tests.cpp

@@ -0,0 +1,64 @@
+/**
+ * @file tests/boost_graph/tests.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <common/RootCoordinator.hpp>
+
+#include <tests/boost_graph/models.hpp>
+#include <tests/boost_graph/graph_manager.hpp>
+
+using namespace paradevs::common;
+using namespace paradevs::common::scheduler;
+using namespace paradevs::pdevs;
+using namespace paradevs::tests::boost_graph;
+
+void flat_test()
+{
+    RootCoordinator < MyTime, paradevs::pdevs::Coordinator <
+        MyTime, VectorScheduler < MyTime >, InBuildFlatGraphManager <
+            FlatGraphBuilder >, paradevs::common::NoParameters,
+        paradevs::common::NoParameters >
+    > rc(0, 100, "root", NoParameters(), NoParameters());
+
+    rc.run();
+}
+
+void hierarchical_test()
+{
+    RootCoordinator < MyTime, paradevs::pdevs::Coordinator <
+        MyTime, VectorScheduler < MyTime >, HierarchicalGraphManager <
+            HierarchicalGraphBuilder >, paradevs::common::NoParameters,
+        paradevs::common::NoParameters > > rc(0, 100, "root",
+                                              NoParameters(), NoParameters());
+
+    rc.run();
+}
+
+int main()
+{
+    flat_test();
+    hierarchical_test();
+    return 0;
+}

+ 19 - 0
src/tests/dtss/CMakeLists.txt

@@ -0,0 +1,19 @@
+INCLUDE_DIRECTORIES(
+  ${PARADEVS_BINARY_DIR}/src
+  ${PARADEVS_SOURCE_DIR}/src
+  ${Boost_INCLUDE_DIRS}
+  ${GLIBMM_INCLUDE_DIRS}
+  ${LIBXML_INCLUDE_DIRS})
+
+LINK_DIRECTORIES(
+  ${GLIBMM_LIBRARY_DIRS}
+  ${LIBXML_LIBRARY_DIR})
+
+ADD_EXECUTABLE(dtss-tests ${COMMON_HPP} ${DTSS_HPP} graph_manager.hpp
+  models.hpp tests.cpp)
+SET_TARGET_PROPERTIES(dtss-tests PROPERTIES ${PARADEVS_APP_PROPERTIES})
+
+TARGET_LINK_LIBRARIES(dtss-tests
+  ${GLIBMM_LIBRARIES}
+  ${LIBXML_LIBRARIES}
+  ${GTHREAD_LIBRARIES})

+ 105 - 0
src/tests/dtss/graph_manager.hpp

@@ -0,0 +1,105 @@
+/**
+ * @file tests/dtss/graph_manager.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTS_DTSS_GRAPH_MANAGER_HPP
+#define TESTS_DTSS_GRAPH_MANAGER_HPP 1
+
+#include <dtss/Coordinator.hpp>
+#include <dtss/GraphManager.hpp>
+#include <dtss/Simulator.hpp>
+
+#include <tests/dtss/models.hpp>
+
+namespace paradevs { namespace tests { namespace dtss {
+
+struct Policy
+{
+    const common::Bag < MyTime >& bag() const
+    { return _bag; }
+
+    virtual void operator()(MyTime::type /* t */,
+                            const common::ExternalEvent < MyTime >& event,
+                            MyTime::type /* tl */,
+                            MyTime::type /* tn */)
+    {
+        _bag.clear();
+        _bag.push_back(event);
+    }
+
+private:
+    common::Bag < MyTime > _bag;
+};
+
+class OnlyOneGraphManager :
+        public paradevs::dtss::GraphManager < MyTime,
+                                              paradevs::common::NoParameters >
+{
+public:
+    OnlyOneGraphManager(common::Coordinator < MyTime >* coordinator,
+                        const paradevs::common::NoParameters& parameters) :
+        paradevs::dtss::GraphManager < MyTime,
+                                       paradevs::common::NoParameters >(
+                                           coordinator, parameters),
+        a("a", 1, NoParameters())
+    {
+        add_child(&a);
+    }
+
+    virtual ~OnlyOneGraphManager()
+    { }
+
+private:
+    paradevs::dtss::Simulator < MyTime, A, NoParameters > a;
+};
+
+class TwoGraphManager :
+        public paradevs::dtss::GraphManager < MyTime,
+                                              paradevs::common::NoParameters >
+{
+public:
+    TwoGraphManager(common::Coordinator < MyTime >* coordinator,
+                    const paradevs::common::NoParameters& parameters) :
+        paradevs::dtss::GraphManager < MyTime,
+                                       paradevs::common::NoParameters >(
+                                           coordinator, parameters),
+        a("a", 1, NoParameters()), b("b", 1, NoParameters())
+    {
+        add_child(&a);
+        add_child(&b);
+        add_link(&a, "out", &b, "in");
+    }
+
+    virtual ~TwoGraphManager()
+    { }
+
+private:
+    paradevs::dtss::Simulator < MyTime, A, NoParameters > a;
+    paradevs::dtss::Simulator < MyTime, B, NoParameters > b;
+};
+
+} } } // namespace paradevs tests dtss
+
+#endif

+ 143 - 0
src/tests/dtss/models.hpp

@@ -0,0 +1,143 @@
+/**
+ * @file tests/dtss/models.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTS_DTSS_MODELS_HPP
+#define TESTS_DTSS_MODELS_HPP 1
+
+#include <dtss/Dynamics.hpp>
+#include <common/Time.hpp>
+
+namespace paradevs { namespace tests { namespace dtss {
+
+template < typename T >
+struct Limits
+{
+    static constexpr T negative_infinity =
+        -std::numeric_limits < T >::infinity();
+    static constexpr T positive_infinity =
+        std::numeric_limits < T >::infinity();
+    static constexpr T null = 0;
+};
+
+typedef paradevs::common::Time < double, Limits < double > > MyTime;
+
+struct NoParameters
+{
+    NoParameters()
+    { }
+};
+
+class A : public paradevs::dtss::Dynamics < MyTime, NoParameters >
+{
+public:
+    A(const std::string& name, const NoParameters& parameters) :
+        paradevs::dtss::Dynamics < MyTime, NoParameters >(name, parameters)
+    { }
+    virtual ~A()
+    { }
+
+    void transition(const common::Bag < MyTime >& /* x */, MyTime::type t)
+    {
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::DELTA_INT);
+        common::Trace < MyTime >::trace().flush();
+    }
+
+    MyTime::type start(MyTime::type t)
+    {
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::START);
+        common::Trace < MyTime >::trace().flush();
+
+        return 0;
+    }
+
+    common::Bag < MyTime > lambda(MyTime::type t) const
+    {
+        common::Bag < MyTime > msgs;
+
+        msgs.push_back(common::ExternalEvent < MyTime >("out", 0.));
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::LAMBDA)
+            << "messages = " << msgs.to_string();
+        common::Trace < MyTime >::trace().flush();
+
+        return msgs;
+    }
+};
+
+class B : public paradevs::dtss::Dynamics < MyTime, NoParameters >
+{
+public:
+    B(const std::string& name, const NoParameters& parameters) :
+        paradevs::dtss::Dynamics < MyTime, NoParameters >(name, parameters)
+    { }
+    virtual ~B()
+    { }
+
+    void transition(const common::Bag < MyTime >& x, MyTime::type t)
+    {
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::DELTA_INT)
+            << "x = " << x.to_string();
+        common::Trace < MyTime >::trace().flush();
+    }
+
+    MyTime::type start(MyTime::type t)
+    {
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::START);
+        common::Trace < MyTime >::trace().flush();
+
+        return 0;
+    }
+
+    common::Bag < MyTime > lambda(MyTime::type t) const
+    {
+        common::Bag < MyTime > msgs;
+
+        msgs.push_back(common::ExternalEvent < MyTime >("out", 0.));
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::LAMBDA)
+            << "messages = " << msgs.to_string();
+        common::Trace < MyTime >::trace().flush();
+
+        return msgs;
+    }
+};
+
+} } } // namespace paradevs tests dtss
+
+#endif

+ 111 - 0
src/tests/dtss/tests.cpp

@@ -0,0 +1,111 @@
+/**
+ * @file tests/dtss/tests.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <tests/dtss/graph_manager.hpp>
+#include <tests/dtss/models.hpp>
+
+#include <common/RootCoordinator.hpp>
+
+#define CATCH_CONFIG_MAIN
+#include <tests/catch.hpp>
+
+using namespace paradevs::tests::dtss;
+
+TEST_CASE("dtss/only_one", "run")
+{
+
+    paradevs::common::RootCoordinator <
+        MyTime, paradevs::dtss::Coordinator <
+            MyTime, Policy, OnlyOneGraphManager,
+            paradevs::dtss::Parameters < MyTime >,
+            paradevs::common::NoParameters >
+        > rc(0, 10, "root",
+             paradevs::dtss::Parameters < MyTime >(1),
+             paradevs::common::NoParameters());
+
+    paradevs::common::Trace < MyTime >::trace().clear();
+    rc.run();
+
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a").
+            filter_type(paradevs::common::START).size() == 1);
+    for (double t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 1);
+    }
+}
+
+TEST_CASE("dtss/two", "run")
+{
+    paradevs::common::RootCoordinator <
+        MyTime, paradevs::dtss::Coordinator <
+            MyTime, Policy, TwoGraphManager,
+            paradevs::dtss::Parameters < MyTime >,
+            paradevs::common::NoParameters >
+        > rc(0, 10, "root",
+             paradevs::dtss::Parameters < MyTime >(1),
+             paradevs::common::NoParameters());
+
+    paradevs::common::Trace < MyTime >::trace().clear();
+    rc.run();
+
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a").
+            filter_type(paradevs::common::START).size() == 1);
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 1);
+    }
+
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("b").
+            filter_type(paradevs::common::START).size() == 1);
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 1);
+    }
+}

+ 0 - 234
src/tests/dtss_tests.cpp

@@ -1,234 +0,0 @@
-/**
- * @file examples.cpp
- * @author The PARADEVS Development Team
- * See the AUTHORS or Authors.txt file
- */
-
-/*
- * PARADEVS - the multimodeling and simulation environment
- * This file is a part of the PARADEVS environment
- *
- * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <tests/dtss_tests.hpp>
-
-#include <common/RootCoordinator.hpp>
-#include <common/Trace.hpp>
-
-#include <dtss/Coordinator.hpp>
-#include <dtss/GraphManager.hpp>
-#include <dtss/Simulator.hpp>
-
-#define CATCH_CONFIG_MAIN
-#include "catch.hpp"
-
-namespace paradevs { namespace dtss {
-
-void A::transition(const common::Bag < MyTime >& /* x */, MyTime::type t)
-{
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::DELTA_INT);
-    common::Trace < MyTime >::trace().flush();
-}
-
-MyTime::type A::start(MyTime::type t)
-{
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::START);
-    common::Trace < MyTime >::trace().flush();
-
-    return 0;
-}
-
-common::Bag < MyTime > A::lambda(MyTime::type t) const
-{
-    common::Bag < MyTime > msgs;
-
-    msgs.push_back(common::ExternalEvent < MyTime >("out", 0.));
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::LAMBDA)
-        << "messages = " << msgs.to_string();
-    common::Trace < MyTime >::trace().flush();
-
-    return msgs;
-}
-
-void B::transition(const common::Bag < MyTime >& x, MyTime::type t)
-{
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::DELTA_INT)
-        << "x = " << x.to_string();
-    common::Trace < MyTime >::trace().flush();
-}
-
-MyTime::type B::start(MyTime::type t)
-{
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::START);
-    common::Trace < MyTime >::trace().flush();
-
-    return 0;
-}
-
-common::Bag < MyTime > B::lambda(MyTime::type t) const
-{
-    common::Bag < MyTime > msgs;
-
-    msgs.push_back(common::ExternalEvent < MyTime >("out", 0.));
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::LAMBDA)
-        << "messages = " << msgs.to_string();
-    common::Trace < MyTime >::trace().flush();
-
-    return msgs;
-}
-
-struct Policy
-{
-    const common::Bag < MyTime >& bag() const
-    { return _bag; }
-
-    virtual void operator()(MyTime::type /* t */,
-                            const common::ExternalEvent < MyTime >& event,
-                            MyTime::type /* tl */,
-                            MyTime::type /* tn */)
-    {
-        _bag.clear();
-        _bag.push_back(event);
-    }
-
-private:
-    common::Bag < MyTime > _bag;
-};
-
-class OnlyOneGraphManager : public dtss::GraphManager < MyTime >
-{
-public:
-    OnlyOneGraphManager(common::Coordinator < MyTime >* coordinator) :
-        dtss::GraphManager < MyTime >(coordinator), a("a", 1)
-    {
-        add_child(&a);
-    }
-
-    virtual ~OnlyOneGraphManager()
-    { }
-
-private:
-    dtss::Simulator < MyTime, A > a;
-};
-
-class TwoGraphManager : public dtss::GraphManager < MyTime >
-{
-public:
-    TwoGraphManager(common::Coordinator < MyTime >* coordinator) :
-        dtss::GraphManager < MyTime >(coordinator), a("a", 1), b("b", 1)
-    {
-        add_child(&a);
-        add_child(&b);
-        add_link(&a, "out", &b, "in");
-    }
-
-    virtual ~TwoGraphManager()
-    { }
-
-private:
-    dtss::Simulator < MyTime, A > a;
-    dtss::Simulator < MyTime, B > b;
-};
-
-} } // namespace paradevs dtss
-
-TEST_CASE("dtss/only_one", "run")
-{
-
-    paradevs::common::RootCoordinator <
-        paradevs::dtss::MyTime, paradevs::dtss::Coordinator <
-            paradevs::dtss::MyTime, paradevs::dtss::Policy,
-            paradevs::dtss::OnlyOneGraphManager >
-        > rc(0, 10, "root",
-             paradevs::dtss::Parameters < paradevs::dtss::MyTime >(1));
-
-    paradevs::common::Trace < paradevs::dtss::MyTime >::trace().clear();
-    rc.run();
-
-    REQUIRE(paradevs::common::Trace <
-                paradevs::dtss::MyTime >::trace().elements().
-            filter_model_name("a").
-            filter_type(paradevs::common::START).size() == 1);
-    for (double t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::dtss::MyTime >::trace().elements().
-                filter_model_name("a").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::dtss::MyTime >::trace().elements().
-                filter_model_name("a").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 1);
-    }
-}
-
-TEST_CASE("dtss/two", "run")
-{
-    paradevs::common::RootCoordinator <
-        paradevs::dtss::MyTime, paradevs::dtss::Coordinator <
-            paradevs::dtss::MyTime, paradevs::dtss::Policy,
-            paradevs::dtss::TwoGraphManager >
-        > rc(0, 10, "root",
-             paradevs::dtss::Parameters < paradevs::dtss::MyTime >(1));
-
-    paradevs::common::Trace < paradevs::dtss::MyTime >::trace().clear();
-    rc.run();
-
-    REQUIRE(paradevs::common::Trace <
-                paradevs::dtss::MyTime >::trace().elements().
-            filter_model_name("a").
-            filter_type(paradevs::common::START).size() == 1);
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::dtss::MyTime >::trace().elements().
-                filter_model_name("a").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::dtss::MyTime >::trace().elements().
-                filter_model_name("a").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 1);
-    }
-
-    REQUIRE(paradevs::common::Trace <
-                paradevs::dtss::MyTime >::trace().elements().
-            filter_model_name("b").
-            filter_type(paradevs::common::START).size() == 1);
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::dtss::MyTime >::trace().elements().
-                filter_model_name("b").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::dtss::MyTime >::trace().elements().
-                filter_model_name("b").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 1);
-    }
-}

+ 0 - 72
src/tests/dtss_tests.hpp

@@ -1,72 +0,0 @@
-/**
- * @file pdevs_examples.hpp
- * @author The PARADEVS Development Team
- * See the AUTHORS or Authors.txt file
- */
-
-/*
- * PARADEVS - the multimodeling and simulation environment
- * This file is a part of the PARADEVS environment
- *
- * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <dtss/Dynamics.hpp>
-#include <common/Time.hpp>
-
-namespace paradevs { namespace dtss {
-
-template < typename T >
-struct Limits
-{
-    static constexpr T negative_infinity =
-        -std::numeric_limits < T >::infinity();
-    static constexpr T positive_infinity =
-        std::numeric_limits < T >::infinity();
-    static constexpr T null = 0;
-};
-
-typedef paradevs::common::Time < double, Limits < double > > MyTime;
-
-class A : public Dynamics < MyTime >
-{
-public:
-    A(const std::string& name) : Dynamics(name)
-    { }
-    virtual ~A()
-    { }
-
-    virtual void transition(const common::Bag < MyTime >& /* x */,
-                            MyTime::type /* t */);
-    virtual MyTime::type start(MyTime::type /* t */);
-    virtual common::Bag < MyTime > lambda(MyTime::type /* t */) const;
-};
-
-class B : public Dynamics < MyTime >
-{
-public:
-    B(const std::string& name) : Dynamics(name)
-    { }
-    virtual ~B()
-    { }
-
-    virtual void transition(const common::Bag < MyTime >& /* x */,
-                            MyTime::type /* t */);
-    virtual MyTime::type start(MyTime::type /* t */);
-    virtual common::Bag < MyTime > lambda(MyTime::type /* t */) const;
-};
-
-} } // namespace paradevs dtss

+ 21 - 0
src/tests/mixed/CMakeLists.txt

@@ -0,0 +1,21 @@
+INCLUDE_DIRECTORIES(
+  ${PARADEVS_BINARY_DIR}/src
+  ${PARADEVS_SOURCE_DIR}/src
+  ${Boost_INCLUDE_DIRS}
+  ${GLIBMM_INCLUDE_DIRS}
+  ${LIBXML_INCLUDE_DIRS})
+
+LINK_DIRECTORIES(
+  ${GLIBMM_LIBRARY_DIRS}
+  ${LIBXML_LIBRARY_DIR})
+
+SET(MIXED_TESTS_HPP graph_manager.hpp models.hpp)
+
+ADD_EXECUTABLE(mixed-tests ${COMMON_HPP} ${COMMON_SCHEDULER_HPP} ${DTSS_HPP}
+  ${PDEVS_HPP} ${MIXED_TESTS_HPP} tests.cpp)
+SET_TARGET_PROPERTIES(mixed-tests PROPERTIES ${PARADEVS_APP_PROPERTIES})
+
+TARGET_LINK_LIBRARIES(mixed-tests
+  ${GLIBMM_LIBRARIES}
+  ${LIBXML_LIBRARIES}
+  ${GTHREAD_LIBRARIES})

+ 318 - 0
src/tests/mixed/graph_manager.hpp

@@ -0,0 +1,318 @@
+/**
+ * @file tests/mixed/graph_manager.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTS_MIXED_GRAPH_MANAGER_HPP
+#define TESTS_MIXED_GRAPH_MANAGER_HPP 1
+
+#include <common/scheduler/VectorScheduler.hpp>
+#include <common/scheduler/HeapScheduler.hpp>
+#include <common/Trace.hpp>
+
+#include <dtss/Coordinator.hpp>
+#include <dtss/GraphManager.hpp>
+#include <dtss/Simulator.hpp>
+
+#include <pdevs/Coordinator.hpp>
+#include <pdevs/GraphManager.hpp>
+#include <pdevs/Simulator.hpp>
+
+#include <tests/mixed/models.hpp>
+
+namespace paradevs { namespace tests { namespace mixed {
+
+struct LastBagPolicy
+{
+    const common::Bag < MyTime >& bag() const
+    { return _bag; }
+
+    virtual void operator()(typename MyTime::type /* t */,
+                            const common::ExternalEvent < MyTime >& event,
+                            typename MyTime::type /* tl */,
+                            typename MyTime::type /* tn */)
+    {
+        _bag.clear();
+        _bag.push_back(event);
+    }
+
+private:
+    common::Bag < MyTime > _bag;
+};
+
+struct IgnorePolicy
+{
+    const common::Bag < MyTime >& bag() const
+    { return _bag; }
+
+    virtual void operator()(typename MyTime::type /* t */,
+                            const common::ExternalEvent < MyTime >& /* event */,
+                            typename MyTime::type /* tl */,
+                            typename MyTime::type /* tn */)
+    { }
+
+private:
+    common::Bag < MyTime > _bag;
+};
+
+class S1GraphManager :
+        public pdevs::GraphManager < MyTime, paradevs::common::NoParameters >
+{
+public:
+    S1GraphManager(common::Coordinator < MyTime >* coordinator,
+                   const paradevs::common::NoParameters& parameters) :
+        pdevs::GraphManager < MyTime,
+                              paradevs::common::NoParameters >(
+                                  coordinator, parameters),
+        a("a1", NoParameters()), b("b1", NoParameters())
+    {
+        add_child(&a);
+        add_child(&b);
+        add_link(&a, "out", &b, "in");
+        add_link(&b, "out", coordinator, "out");
+    }
+
+    virtual ~S1GraphManager()
+    { }
+
+private:
+    pdevs::Simulator < MyTime, A1, NoParameters > a;
+    pdevs::Simulator < MyTime, B1, NoParameters > b;
+};
+
+class S2GraphManager :
+        public dtss::GraphManager < MyTime, paradevs::common::NoParameters >
+{
+public:
+    S2GraphManager(common::Coordinator < MyTime >* coordinator,
+                   const paradevs::common::NoParameters& parameters) :
+        dtss::GraphManager < MyTime,
+                             paradevs::common::NoParameters >(
+                                 coordinator, parameters),
+        a("a2", 20, NoParameters()), b("b2", 20, NoParameters())
+    {
+        add_child(&a);
+        add_child(&b);
+        add_link(&a, "out", &b, "in");
+        add_link(coordinator, "in", &a, "in");
+    }
+
+    virtual ~S2GraphManager()
+    { }
+
+private:
+    dtss::Simulator < MyTime, A2, NoParameters > a;
+    dtss::Simulator < MyTime, B2, NoParameters > b;
+};
+
+class RootGraphManager :
+    public pdevs::GraphManager < MyTime, paradevs::common::NoParameters >
+{
+public:
+    RootGraphManager(common::Coordinator < MyTime >* coordinator,
+                     const paradevs::common::NoParameters& parameters) :
+        pdevs::GraphManager < MyTime,
+                              paradevs::common::NoParameters >(
+                                  coordinator, parameters),
+        S1("S1", paradevs::common::NoParameters(),
+           paradevs::common::NoParameters()),
+        S2("S2", paradevs::dtss::Parameters < MyTime >(20),
+           paradevs::common::NoParameters())
+    {
+        add_child(&S1);
+        add_child(&S2);
+        add_link(&S1, "out", &S2, "in");
+    }
+
+    virtual ~RootGraphManager()
+    { }
+
+private:
+    pdevs::Coordinator < MyTime,
+                         paradevs::common::scheduler::VectorScheduler <
+                             MyTime >,
+                         S1GraphManager,
+                         paradevs::common::NoParameters,
+                         paradevs::common::NoParameters > S1;
+    dtss::Coordinator < MyTime,
+                        LastBagPolicy,
+                        S2GraphManager,
+                        paradevs::dtss::Parameters < MyTime >,
+                        paradevs::common::NoParameters > S2;
+};
+
+template < int size >
+class LinearGraphManager :
+    public pdevs::GraphManager < MyTime, paradevs::common::NoParameters >
+{
+public:
+    LinearGraphManager(common::Coordinator < MyTime >* coordinator,
+                       const paradevs::common::NoParameters& parameters) :
+        pdevs::GraphManager < MyTime,
+                              paradevs::common::NoParameters >(
+                                  coordinator, parameters)
+    {
+        for (unsigned int i = 1; i <= size; ++i) {
+            std::ostringstream ss;
+
+            ss << "a" << i;
+            _models.push_back(
+                new pdevs::Simulator < MyTime, Beep, NoParameters >(
+                    ss.str(), NoParameters()));
+        }
+        for (unsigned int i = 0; i < size; ++i) {
+            add_child(_models[i]);
+        }
+        for (unsigned int i = 0; i < size - 1; ++i) {
+            add_link(_models[i], "out", _models[i + 1], "in");
+        }
+    }
+
+    virtual ~LinearGraphManager()
+    {
+        for (unsigned int i = 0; i < size; ++i) {
+            delete _models[i];
+        }
+    }
+
+private:
+    std::vector < pdevs::Simulator < MyTime, Beep, NoParameters >* > _models;
+};
+
+class Linear2GraphManager :
+    public pdevs::GraphManager < MyTime, paradevs::common::NoParameters >
+{
+public:
+    Linear2GraphManager(common::Coordinator < MyTime >* coordinator,
+                        const paradevs::common::NoParameters& parameters) :
+        pdevs::GraphManager < MyTime,
+                              paradevs::common::NoParameters >(
+                                  coordinator, parameters)
+    {
+        for (unsigned int i = 1; i <= 100; ++i) {
+            std::ostringstream ss;
+
+            ss << "a" << i;
+            _models.push_back(
+                new pdevs::Simulator < MyTime, Beep, NoParameters >(
+                    ss.str(), NoParameters()));
+        }
+        for (unsigned int i = 0; i < 100; ++i) {
+            add_child(_models[i]);
+        }
+        for (unsigned int i = 0; i < 99; ++i) {
+            add_link(_models[i], "out", _models[i + 1], "in");
+        }
+        add_link(coordinator, "in", _models[0], "in");
+        add_link(_models[49], "out", coordinator, "out");
+    }
+
+    virtual ~Linear2GraphManager()
+    {
+        for (unsigned int i = 0; i < 100; ++i) {
+            delete _models[i];
+        }
+    }
+
+private:
+    std::vector < pdevs::Simulator < MyTime, Beep, NoParameters >* > _models;
+};
+
+class Root2GraphManager :
+    public pdevs::GraphManager < MyTime, paradevs::common::NoParameters >
+{
+public:
+    Root2GraphManager(common::Coordinator < MyTime >* coordinator,
+                      const paradevs::common::NoParameters& parameters) :
+        pdevs::GraphManager < MyTime,
+                              paradevs::common::NoParameters >(
+                                  coordinator, parameters),
+        S1("S1", paradevs::common::NoParameters(),
+           paradevs::common::NoParameters()),
+        S2("S2", paradevs::common::NoParameters(),
+           paradevs::common::NoParameters())
+    {
+        add_child(&S1);
+        add_child(&S2);
+        add_link(&S1, "out", &S2, "in");
+    }
+
+    virtual ~Root2GraphManager()
+    { }
+
+private:
+    pdevs::Coordinator < MyTime,
+                         paradevs::common::scheduler::HeapScheduler <
+                             MyTime >,
+                         Linear2GraphManager,
+                         paradevs::common::NoParameters,
+                         paradevs::common::NoParameters > S1;
+    pdevs::Coordinator < MyTime,
+                         paradevs::common::scheduler::HeapScheduler <
+                             MyTime >,
+                         Linear2GraphManager,
+                         paradevs::common::NoParameters,
+                         paradevs::common::NoParameters > S2;
+};
+
+class Root3GraphManager :
+    public pdevs::GraphManager < MyTime, paradevs::common::NoParameters >
+{
+public:
+    Root3GraphManager(common::Coordinator < MyTime >* coordinator,
+                      const paradevs::common::NoParameters& parameters) :
+        pdevs::GraphManager < MyTime,
+                              paradevs::common::NoParameters >(
+                                  coordinator, parameters),
+        S1("S1", paradevs::common::NoParameters(),
+           paradevs::common::NoParameters()),
+        S2("S2", paradevs::common::NoParameters(),
+           paradevs::common::NoParameters())
+    {
+        add_child(&S1);
+        add_child(&S2);
+        add_link(&S1, "out", &S2, "in");
+    }
+
+    virtual ~Root3GraphManager()
+    { }
+
+private:
+    pdevs::Coordinator < MyTime,
+                         paradevs::common::scheduler::VectorScheduler <
+                             MyTime >,
+                         Linear2GraphManager,
+                         paradevs::common::NoParameters,
+                         paradevs::common::NoParameters > S1;
+    pdevs::Coordinator < MyTime,
+                         paradevs::common::scheduler::VectorScheduler <
+                             MyTime >,
+                         Linear2GraphManager,
+                         paradevs::common::NoParameters,
+                         paradevs::common::NoParameters > S2;
+};
+
+} } } // namespace paradevs tests mixed
+
+#endif

+ 28 - 237
src/tests/mixed_tests.hpp

@@ -1,5 +1,5 @@
 /**
- * @file mixed_examples.hpp
+ * @file tests/mixed/models.hpp
  * @author The PARADEVS Development Team
  * See the AUTHORS or Authors.txt file
  */
@@ -24,23 +24,17 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <common/RootCoordinator.hpp>
-#include <common/scheduler/VectorScheduler.hpp>
-#include <common/scheduler/HeapScheduler.hpp>
+#ifndef TESTS_MIXED_MODELS_HPP
+#define TESTS_MIXED_MODELS_HPP 1
+
 #include <common/Time.hpp>
 #include <common/Trace.hpp>
 
-#include <dtss/Coordinator.hpp>
 #include <dtss/Dynamics.hpp>
-#include <dtss/GraphManager.hpp>
-#include <dtss/Simulator.hpp>
 
-#include <pdevs/Coordinator.hpp>
 #include <pdevs/Dynamics.hpp>
-#include <pdevs/GraphManager.hpp>
-#include <pdevs/Simulator.hpp>
 
-namespace paradevs {
+namespace paradevs { namespace tests { namespace mixed {
 
 template < typename T >
 struct Limits
@@ -54,10 +48,17 @@ struct Limits
 
 typedef paradevs::common::Time < double, Limits < double > > MyTime;
 
-class A1 : public paradevs::pdevs::Dynamics < MyTime >
+struct NoParameters
+{
+    NoParameters()
+    { }
+};
+
+class A1 : public paradevs::pdevs::Dynamics < MyTime, NoParameters >
 {
 public:
-    A1(const std::string& name) : paradevs::pdevs::Dynamics < MyTime >(name)
+    A1(const std::string& name, const NoParameters& parameters) :
+        paradevs::pdevs::Dynamics < MyTime, NoParameters >(name, parameters)
     { }
     virtual ~A1()
     { }
@@ -183,10 +184,11 @@ private:
     Phase _phase;
 };
 
-class B1 : public paradevs::pdevs::Dynamics < MyTime >
+class B1 : public paradevs::pdevs::Dynamics < MyTime, NoParameters >
 {
 public:
-    B1(const std::string& name) : paradevs::pdevs::Dynamics < MyTime >(name)
+    B1(const std::string& name, const NoParameters& parameters) :
+        paradevs::pdevs::Dynamics < MyTime, NoParameters >(name, parameters)
     { }
     virtual ~B1()
     { }
@@ -315,10 +317,11 @@ private:
     Phase _phase;
 };
 
-class A2 : public paradevs::dtss::Dynamics < MyTime >
+class A2 : public paradevs::dtss::Dynamics < MyTime, NoParameters >
 {
 public:
-    A2(const std::string& name) : paradevs::dtss::Dynamics < MyTime >(name)
+    A2(const std::string& name, const NoParameters& parameters) :
+        paradevs::dtss::Dynamics < MyTime, NoParameters >(name, parameters)
     { }
     virtual ~A2()
     { }
@@ -380,10 +383,11 @@ public:
     }
 };
 
-class B2 : public paradevs::dtss::Dynamics < MyTime >
+class B2 : public paradevs::dtss::Dynamics < MyTime, NoParameters >
 {
 public:
-    B2(const std::string& name) : paradevs::dtss::Dynamics < MyTime >(name)
+    B2(const std::string& name, const NoParameters& parameters) :
+        paradevs::dtss::Dynamics < MyTime, NoParameters >(name, parameters)
     { }
     virtual ~B2()
     { }
@@ -445,10 +449,11 @@ public:
     }
 };
 
-class Beep : public paradevs::pdevs::Dynamics < MyTime >
+class Beep : public paradevs::pdevs::Dynamics < MyTime, NoParameters >
 {
 public:
-    Beep(const std::string& name) : paradevs::pdevs::Dynamics < MyTime >(name)
+    Beep(const std::string& name, const NoParameters& parameters) :
+        paradevs::pdevs::Dynamics < MyTime, NoParameters >(name, parameters)
     { }
     virtual ~Beep()
     { }
@@ -577,220 +582,6 @@ private:
     Phase _phase;
 };
 
-struct LastBagPolicy
-{
-    const common::Bag < MyTime >& bag() const
-    { return _bag; }
-
-    virtual void operator()(typename MyTime::type /* t */,
-                            const common::ExternalEvent < MyTime >& event,
-                            typename MyTime::type /* tl */,
-                            typename MyTime::type /* tn */)
-    {
-        _bag.clear();
-        _bag.push_back(event);
-    }
-
-private:
-    common::Bag < MyTime > _bag;
-};
-
-struct IgnorePolicy
-{
-    const common::Bag < MyTime >& bag() const
-    { return _bag; }
-
-    virtual void operator()(typename MyTime::type /* t */,
-                            const common::ExternalEvent < MyTime >& /* event */,
-                            typename MyTime::type /* tl */,
-                            typename MyTime::type /* tn */)
-    { }
-
-private:
-    common::Bag < MyTime > _bag;
-};
-
-class S1GraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    S1GraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator), a("a1"), b("b1")
-    {
-        add_child(&a);
-        add_child(&b);
-        add_link(&a, "out", &b, "in");
-        add_link(&b, "out", coordinator, "out");
-    }
-
-    virtual ~S1GraphManager()
-    { }
-
-private:
-    pdevs::Simulator < MyTime, A1 > a;
-    pdevs::Simulator < MyTime, B1 > b;
-};
-
-class S2GraphManager : public dtss::GraphManager < MyTime >
-{
-public:
-    S2GraphManager(common::Coordinator < MyTime >* coordinator) :
-        dtss::GraphManager < MyTime >(coordinator), a("a2", 20), b("b2", 20)
-    {
-        add_child(&a);
-        add_child(&b);
-        add_link(&a, "out", &b, "in");
-        add_link(coordinator, "in", &a, "in");
-    }
-
-    virtual ~S2GraphManager()
-    { }
-
-private:
-    dtss::Simulator < MyTime, A2 > a;
-    dtss::Simulator < MyTime, B2 > b;
-};
-
-class RootGraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    RootGraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator),
-        S1("S1", paradevs::pdevs::Parameters()),
-        S2("S2", paradevs::dtss::Parameters < MyTime >(20))
-    {
-        add_child(&S1);
-        add_child(&S2);
-        add_link(&S1, "out", &S2, "in");
-    }
-
-    virtual ~RootGraphManager()
-    { }
-
-private:
-    pdevs::Coordinator < MyTime,
-                         paradevs::common::scheduler::HeapScheduler <
-                             MyTime >,
-                         S1GraphManager > S1;
-    dtss::Coordinator < MyTime, LastBagPolicy, S2GraphManager > S2;
-};
-
-template < int size >
-class LinearGraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    LinearGraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator)
-    {
-        for (unsigned int i = 1; i <= size; ++i) {
-            std::ostringstream ss;
-
-            ss << "a" << i;
-            _models.push_back(new pdevs::Simulator < MyTime, Beep >(ss.str()));
-        }
-        for (unsigned int i = 0; i < size; ++i) {
-            add_child(_models[i]);
-        }
-        for (unsigned int i = 0; i < size - 1; ++i) {
-            add_link(_models[i], "out", _models[i + 1], "in");
-        }
-    }
-
-    virtual ~LinearGraphManager()
-    {
-        for (unsigned int i = 0; i < size; ++i) {
-            delete _models[i];
-        }
-    }
-
-private:
-    std::vector < pdevs::Simulator < MyTime, Beep >* > _models;
-};
-
-class Linear2GraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    Linear2GraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator)
-    {
-        for (unsigned int i = 1; i <= 100; ++i) {
-            std::ostringstream ss;
+} } } // namespace paradevs tests mixed
 
-            ss << "a" << i;
-            _models.push_back(new pdevs::Simulator < MyTime, Beep >(ss.str()));
-        }
-        for (unsigned int i = 0; i < 100; ++i) {
-            add_child(_models[i]);
-        }
-        for (unsigned int i = 0; i < 99; ++i) {
-            add_link(_models[i], "out", _models[i + 1], "in");
-        }
-        add_link(coordinator, "in", _models[0], "in");
-        add_link(_models[49], "out", coordinator, "out");
-    }
-
-    virtual ~Linear2GraphManager()
-    {
-        for (unsigned int i = 0; i < 100; ++i) {
-            delete _models[i];
-        }
-    }
-
-private:
-    std::vector < pdevs::Simulator < MyTime, Beep >* > _models;
-};
-
-class Root2GraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    Root2GraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator),
-        S1("S1", paradevs::pdevs::Parameters()),
-        S2("S2", paradevs::pdevs::Parameters())
-    {
-        add_child(&S1);
-        add_child(&S2);
-        add_link(&S1, "out", &S2, "in");
-    }
-
-    virtual ~Root2GraphManager()
-    { }
-
-private:
-    pdevs::Coordinator < MyTime,
-                         paradevs::common::scheduler::HeapScheduler <
-                             MyTime >,
-                         Linear2GraphManager > S1;
-    pdevs::Coordinator < MyTime,
-                         paradevs::common::scheduler::HeapScheduler <
-                             MyTime >,
-                         Linear2GraphManager > S2;
-};
-
-class Root3GraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    Root3GraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator),
-        S1("S1", paradevs::pdevs::Parameters()),
-        S2("S2", paradevs::pdevs::Parameters())
-    {
-        add_child(&S1);
-        add_child(&S2);
-        // add_link(&S1, "out", &S2, "in");
-    }
-
-    virtual ~Root3GraphManager()
-    { }
-
-private:
-    pdevs::Coordinator < MyTime,
-                         paradevs::common::scheduler::VectorScheduler <
-                             MyTime >,
-                         Linear2GraphManager > S1;
-    pdevs::Coordinator < MyTime,
-                         paradevs::common::scheduler::VectorScheduler <
-                             MyTime >,
-                         Linear2GraphManager > S2;
-};
-
-} // namespace paradevs
+#endif

+ 28 - 25
src/tests/mixed_tests.cpp

@@ -1,5 +1,5 @@
 /**
- * @file examples.cpp
+ * @file tests/mixed/tests.cpp
  * @author The PARADEVS Development Team
  * See the AUTHORS or Authors.txt file
  */
@@ -24,91 +24,94 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <tests/mixed_tests.hpp>
+#include <common/RootCoordinator.hpp>
+
+#include <tests/mixed/graph_manager.hpp>
+#include <tests/mixed/models.hpp>
 
 #define CATCH_CONFIG_MAIN
-#include "catch.hpp"
+#include <tests/catch.hpp>
+
+using namespace paradevs::tests::mixed;
 
 TEST_CASE("mixed/hierachical", "run")
 {
     paradevs::common::RootCoordinator <
-        paradevs::MyTime, paradevs::pdevs::Coordinator <
-            paradevs::MyTime,
-            paradevs::common::scheduler::HeapScheduler < paradevs::MyTime >,
-            paradevs::RootGraphManager >
-        > rc(0, 100, "root", paradevs::pdevs::Parameters());
+        MyTime, paradevs::pdevs::Coordinator <
+            MyTime, paradevs::common::scheduler::VectorScheduler <
+                MyTime >, RootGraphManager > > rc(0, 100, "root");
 
-    paradevs::common::Trace < paradevs::MyTime >::trace().clear();
+    paradevs::common::Trace < MyTime >::trace().clear();
     rc.run();
 
-    REQUIRE(paradevs::common::Trace < paradevs::MyTime >::trace().elements().
+    REQUIRE(paradevs::common::Trace < MyTime >::trace().elements().
             filter_model_name("a1").
             filter_type(paradevs::common::START).size() == 1);
-    REQUIRE(paradevs::common::Trace < paradevs::MyTime >::trace().elements().
+    REQUIRE(paradevs::common::Trace < MyTime >::trace().elements().
             filter_model_name("b1").
             filter_type(paradevs::common::START).size() == 1);
-    REQUIRE(paradevs::common::Trace < paradevs::MyTime >::trace().elements().
+    REQUIRE(paradevs::common::Trace < MyTime >::trace().elements().
             filter_model_name("a2").
             filter_type(paradevs::common::START).size() == 1);
-    REQUIRE(paradevs::common::Trace < paradevs::MyTime >::trace().elements().
+    REQUIRE(paradevs::common::Trace < MyTime >::trace().elements().
             filter_model_name("b2").
             filter_type(paradevs::common::START).size() == 1);
 
-    REQUIRE(paradevs::common::Trace < paradevs::MyTime >::trace().elements().
+    REQUIRE(paradevs::common::Trace < MyTime >::trace().elements().
             filter_model_name("a1").
             filter_type(paradevs::common::DELTA_EXT).size() == 0);
     for (double t = 0; t <= 100; ++t) {
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("a1").filter_time(t).
                 filter_type(paradevs::common::LAMBDA).size() == 1);
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("a1").filter_time(t).
                 filter_type(paradevs::common::DELTA_INT).size() == 1);
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("a1").filter_time(t).
                 filter_type(paradevs::common::TA).size() == 1);
     }
 
     for (double t = 0; t <= 100; ++t) {
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("b1").filter_time(t).
                 filter_type(paradevs::common::LAMBDA).size() == 1);
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("b1").filter_time(t).
                 filter_type(paradevs::common::DELTA_INT).size() == 1);
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("b1").filter_time(t).
                 filter_type(paradevs::common::TA).size() == 2);
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("b1").filter_time(t).
                 filter_type(paradevs::common::DELTA_EXT).size() == 1);
     }
 
     for (unsigned int t = 0; t <= 100; t += 20) {
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("a2").filter_time(t).
                 filter_type(paradevs::common::LAMBDA).size() == 1);
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("a2").filter_time(t).
                 filter_type(paradevs::common::DELTA_INT).size() == 1);
     }
 
     for (unsigned int t = 0; t <= 100; t += 20) {
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("b2").filter_time(t).
                 filter_type(paradevs::common::LAMBDA).size() == 1);
         REQUIRE(paradevs::common::Trace <
-                    paradevs::MyTime >::trace().elements().
+                    MyTime >::trace().elements().
                 filter_model_name("b2").filter_time(t).
                 filter_type(paradevs::common::DELTA_INT).size() == 1);
     }

+ 19 - 0
src/tests/pdevs/CMakeLists.txt

@@ -0,0 +1,19 @@
+INCLUDE_DIRECTORIES(
+  ${PARADEVS_BINARY_DIR}/src
+  ${PARADEVS_SOURCE_DIR}/src
+  ${Boost_INCLUDE_DIRS}
+  ${GLIBMM_INCLUDE_DIRS}
+  ${LIBXML_INCLUDE_DIRS})
+
+LINK_DIRECTORIES(
+  ${GLIBMM_LIBRARY_DIRS}
+  ${LIBXML_LIBRARY_DIR})
+
+ADD_EXECUTABLE(pdevs-tests ${COMMON_HPP} ${COMMON_SCHEDULER_HPP} ${PDEVS_HPP}
+  graph_manager.hpp models.hpp tests.cpp)
+SET_TARGET_PROPERTIES(pdevs-tests PROPERTIES ${PARADEVS_APP_PROPERTIES})
+
+TARGET_LINK_LIBRARIES(pdevs-tests
+  ${GLIBMM_LIBRARIES}
+  ${LIBXML_LIBRARIES}
+  ${GTHREAD_LIBRARIES})

+ 166 - 0
src/tests/pdevs/graph_manager.hpp

@@ -0,0 +1,166 @@
+/**
+ * @file tests/pdevs/graph_manager.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTS_PDEVS_GRAPH_MANAGER_HPP
+#define TESTS_PDEVS_GRAPH_MANAGER_HPP 1
+
+#include <tests/pdevs/models.hpp>
+
+#include <common/scheduler/VectorScheduler.hpp>
+#include <common/Trace.hpp>
+
+#include <pdevs/Coordinator.hpp>
+#include <pdevs/GraphManager.hpp>
+#include <pdevs/Simulator.hpp>
+
+namespace paradevs { namespace tests { namespace pdevs {
+
+class S1GraphManager :
+        public paradevs::pdevs::GraphManager < MyTime >
+{
+public:
+    S1GraphManager(common::Coordinator < MyTime >* coordinator,
+                   const paradevs::common::NoParameters& parameters) :
+        paradevs::pdevs::GraphManager < MyTime >(coordinator, parameters),
+        a("a1", common::NoParameters()), b("b1", common::NoParameters())
+    {
+        add_child(&a);
+        add_child(&b);
+        add_link(&a, "out", &b, "in");
+        add_link(&b, "out", coordinator, "out");
+    }
+
+    virtual ~S1GraphManager()
+    { }
+
+private:
+    paradevs::pdevs::Simulator < MyTime, A > a;
+    paradevs::pdevs::Simulator < MyTime, B > b;
+};
+
+class S2GraphManager :
+        public paradevs::pdevs::GraphManager < MyTime >
+{
+public:
+    S2GraphManager(common::Coordinator < MyTime >* coordinator,
+                   const paradevs::common::NoParameters& parameters) :
+        paradevs::pdevs::GraphManager < MyTime >(coordinator, parameters),
+        a("a2", common::NoParameters()), b("b2", common::NoParameters())
+    {
+        add_child(&a);
+        add_child(&b);
+        add_link(&a, "out", &b, "in");
+        add_link(coordinator, "in", &a, "in");
+    }
+
+    virtual ~S2GraphManager()
+    { }
+
+private:
+    paradevs::pdevs::Simulator < MyTime, A > a;
+    paradevs::pdevs::Simulator < MyTime, B > b;
+};
+
+class RootGraphManager :
+        public paradevs::pdevs::GraphManager < MyTime >
+{
+public:
+    RootGraphManager(common::Coordinator < MyTime >* coordinator,
+                     const paradevs::common::NoParameters& parameters) :
+        paradevs::pdevs::GraphManager < MyTime >(coordinator, parameters),
+        S1("S1", paradevs::common::NoParameters(),
+           paradevs::common::NoParameters()),
+        S2("S2", paradevs::common::NoParameters(),
+           paradevs::common::NoParameters())
+    {
+        add_child(&S1);
+        add_child(&S2);
+        add_link(&S1, "out", &S2, "in");
+    }
+
+    virtual ~RootGraphManager()
+    { }
+
+private:
+    paradevs::pdevs::Coordinator <
+    MyTime, paradevs::common::scheduler::VectorScheduler < MyTime >,
+    S1GraphManager > S1;
+    paradevs::pdevs::Coordinator <
+        MyTime, paradevs::common::scheduler::VectorScheduler < MyTime >,
+        S2GraphManager > S2;
+};
+
+class OnlyOneGraphManager :
+        public paradevs::pdevs::GraphManager < MyTime >
+{
+public:
+    OnlyOneGraphManager(common::Coordinator < MyTime >* coordinator,
+                        const paradevs::common::NoParameters& parameters) :
+        paradevs::pdevs::GraphManager < MyTime >(coordinator, parameters),
+        a("a", common::NoParameters())
+    {
+        add_child(&a);
+    }
+
+    virtual ~OnlyOneGraphManager()
+    { }
+
+private:
+    paradevs::pdevs::Simulator < MyTime, A > a;
+};
+
+class FlatGraphManager :
+        public paradevs::pdevs::GraphManager < MyTime >
+{
+public:
+    FlatGraphManager(common::Coordinator < MyTime >* coordinator,
+                     const paradevs::common::NoParameters& parameters) :
+        paradevs::pdevs::GraphManager < MyTime >(coordinator, parameters),
+        a1("a1", common::NoParameters()), b1("b1", common::NoParameters()),
+        a2("a2", common::NoParameters()), b2("b2", common::NoParameters())
+    {
+        add_child(&a1);
+        add_child(&b1);
+        add_child(&a2);
+        add_child(&b2);
+        add_link(&a1, "out", &b1, "in");
+        add_link(&b1, "out", &a2, "in");
+        add_link(&a2, "out", &b2, "in");
+    }
+
+    virtual ~FlatGraphManager()
+    { }
+
+private:
+    paradevs::pdevs::Simulator < MyTime, A > a1;
+    paradevs::pdevs::Simulator < MyTime, B > b1;
+    paradevs::pdevs::Simulator < MyTime, A > a2;
+    paradevs::pdevs::Simulator < MyTime, B > b2;
+};
+
+} } } // namespace paradevs tests pdevs
+
+#endif

+ 246 - 0
src/tests/pdevs/models.hpp

@@ -0,0 +1,246 @@
+/**
+ * @file tests/pdevs/models.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTS_PDEVS_MODELS_HPP
+#define TESTS_PDEVS_MODELS_HPP 1
+
+#include <common/Time.hpp>
+#include <common/Trace.hpp>
+
+#include <pdevs/Dynamics.hpp>
+
+#include <limits>
+
+namespace paradevs { namespace tests { namespace pdevs {
+
+template < typename T >
+struct Limits
+{
+    static constexpr T negative_infinity =
+        -std::numeric_limits < T >::infinity();
+    static constexpr T positive_infinity =
+        std::numeric_limits < T >::infinity();
+    static constexpr T null = 0;
+};
+
+typedef paradevs::common::Time < double, Limits < double > > MyTime;
+
+class A : public paradevs::pdevs::Dynamics < MyTime >
+{
+public:
+    A(const std::string& name, const common::NoParameters& parameters) :
+        paradevs::pdevs::Dynamics < MyTime >(name, parameters)
+    { }
+    virtual ~A()
+    { }
+
+    void dint(typename MyTime::type t)
+    {
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::DELTA_INT);
+        common::Trace < MyTime >::trace().flush();
+
+        if (_phase == SEND) {
+            _phase = WAIT;
+        }
+    }
+
+    void dext(typename MyTime::type t, typename MyTime::type /* e */,
+              const common::Bag < MyTime >& msgs)
+    {
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::DELTA_EXT)
+            << "messages = " << msgs.to_string();
+        common::Trace < MyTime >::trace().flush();
+
+        _phase = SEND;
+    }
+
+    void dconf(typename MyTime::type t, typename MyTime::type /* e */,
+               const common::Bag < MyTime >& msgs)
+    {
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::DELTA_CONF)
+            << "messages = " << msgs.to_string();
+        common::Trace < MyTime >::trace().flush();
+
+    }
+
+    typename MyTime::type start(typename MyTime::type t)
+    {
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::START);
+        common::Trace < MyTime >::trace().flush();
+
+        _phase = WAIT;
+        return 0;
+    }
+
+    typename MyTime::type ta(typename MyTime::type t) const
+    {
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::TA);
+        common::Trace < MyTime >::trace().flush();
+
+        if (_phase == WAIT) {
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+
+    common::Bag < MyTime > lambda(typename MyTime::type t) const
+    {
+        common::Bag < MyTime > msgs;
+
+        msgs.push_back(common::ExternalEvent < MyTime >("out", 0.));
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::LAMBDA)
+            << "messages = " << msgs.to_string();
+        common::Trace < MyTime >::trace().flush();
+
+        return msgs;
+    }
+
+    void observation(std::ostream& /* file */) const
+    { }
+
+private:
+    enum Phase { WAIT, SEND };
+
+    Phase _phase;
+};
+
+class B : public paradevs::pdevs::Dynamics < MyTime >
+{
+public:
+    B(const std::string& name, const common::NoParameters& parameters) :
+        paradevs::pdevs::Dynamics < MyTime >(name, parameters)
+    { }
+    virtual ~B()
+    { }
+
+    void dint(typename MyTime::type t)
+    {
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::DELTA_INT);
+        common::Trace < MyTime >::trace().flush();
+
+        if (_phase == SEND) {
+            _phase = WAIT;
+        }
+    }
+
+    void dext(typename MyTime::type t, typename MyTime::type /* e */,
+              const common::Bag < MyTime >& msgs)
+    {
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::DELTA_EXT)
+            << "messages = " << msgs.to_string();
+        common::Trace < MyTime >::trace().flush();
+
+        _phase = SEND;
+    }
+
+    void dconf(typename MyTime::type t, typename MyTime::type /* e */,
+               const common::Bag < MyTime >& msgs)
+    {
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::DELTA_CONF)
+            << "messages = " << msgs.to_string();
+        common::Trace < MyTime >::trace().flush();
+
+    }
+
+    typename MyTime::type start(typename MyTime::type t)
+    {
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::START);
+        common::Trace < MyTime >::trace().flush();
+
+        _phase = WAIT;
+        return std::numeric_limits < double >::max();
+    }
+
+    typename MyTime::type ta(typename MyTime::type t) const
+    {
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::TA);
+        common::Trace < MyTime >::trace().flush();
+
+        if (_phase == WAIT) {
+            return std::numeric_limits < double >::max();
+        } else {
+            return 0;
+        }
+    }
+
+    common::Bag < MyTime > lambda(typename MyTime::type t) const
+    {
+        common::Bag < MyTime > msgs;
+
+        msgs.push_back(common::ExternalEvent < MyTime >("out", 0.));
+
+        common::Trace < MyTime >::trace()
+            << common::TraceElement < MyTime >(get_name(), t,
+                                               common::LAMBDA)
+            << "messages = " << msgs.to_string();
+        common::Trace < MyTime >::trace().flush();
+
+        return msgs;
+    }
+
+    void observation(std::ostream& /* file */) const
+    { }
+
+private:
+    enum Phase { WAIT, SEND };
+
+    Phase _phase;
+};
+
+} } } // namespace paradevs tests pdevs
+
+#endif

+ 295 - 0
src/tests/pdevs/tests.cpp

@@ -0,0 +1,295 @@
+/**
+ * @file tests/pdevs/tests.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <tests/pdevs/graph_manager.hpp>
+#include <tests/pdevs/models.hpp>
+
+#include <common/RootCoordinator.hpp>
+
+#define CATCH_CONFIG_MAIN
+#include <tests/catch.hpp>
+
+using namespace paradevs::tests::pdevs;
+
+TEST_CASE("pdevs/only_one", "run")
+{
+    paradevs::common::RootCoordinator <
+        MyTime, paradevs::pdevs::Coordinator <
+            MyTime, paradevs::common::scheduler::VectorScheduler <
+                MyTime >, OnlyOneGraphManager >
+        > rc(0, 10, "root", paradevs::common::NoParameters(),
+             paradevs::common::NoParameters());
+
+    paradevs::common::Trace < MyTime >::trace().clear();
+    rc.run();
+
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a").
+            filter_type(paradevs::common::START).size() == 1);
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a").
+            filter_type(paradevs::common::DELTA_EXT).size() == 0);
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a").
+            filter_type(paradevs::common::DELTA_CONF).size() == 0);
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a").filter_time(t).
+                filter_type(paradevs::common::TA).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 1);
+    }
+}
+
+TEST_CASE("pdevs/flat", "run")
+{
+    paradevs::common::RootCoordinator <
+        MyTime, paradevs::pdevs::Coordinator <
+            MyTime, paradevs::common::scheduler::VectorScheduler <
+                MyTime >, FlatGraphManager >
+        > rc(0, 10, "root", paradevs::common::NoParameters(),
+             paradevs::common::NoParameters());
+
+    paradevs::common::Trace < MyTime >::trace().clear();
+    rc.run();
+
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a1").
+            filter_type(paradevs::common::START).size() == 1);
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("b1").
+            filter_type(paradevs::common::START).size() == 1);
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a2").
+            filter_type(paradevs::common::START).size() == 1);
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("b2").
+            filter_type(paradevs::common::START).size() == 1);
+
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a1").
+            filter_type(paradevs::common::DELTA_EXT).size() == 0);
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a1").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a1").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a1").filter_time(t).
+                filter_type(paradevs::common::TA).size() == 1);
+    }
+
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b1").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b1").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b1").filter_time(t).
+                filter_type(paradevs::common::TA).size() == 2);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b1").filter_time(t).
+                filter_type(paradevs::common::DELTA_EXT).size() == 1);
+    }
+
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a2").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 2);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a2").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 2);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a2").filter_time(t).
+                filter_type(paradevs::common::TA).size() == 3);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a2").filter_time(t).
+                filter_type(paradevs::common::DELTA_EXT).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a2").filter_time(t).
+                filter_type(paradevs::common::DELTA_CONF).size() == 0);
+    }
+
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b2").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 2);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b2").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 2);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b2").filter_time(t).
+                filter_type(paradevs::common::TA).size() == 4);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b2").filter_time(t).
+                filter_type(paradevs::common::DELTA_EXT).size() == 2);
+    }
+}
+
+TEST_CASE("pdevs/hierachical", "run")
+{
+    paradevs::common::RootCoordinator <
+        MyTime, paradevs::pdevs::Coordinator <
+            MyTime, paradevs::common::scheduler::VectorScheduler <
+                MyTime >, RootGraphManager >
+        > rc(0, 10, "root", paradevs::common::NoParameters(),
+             paradevs::common::NoParameters());
+
+    paradevs::common::Trace < MyTime >::trace().clear();
+    rc.run();
+
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a1").
+            filter_type(paradevs::common::START).size() == 1);
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("b1").
+            filter_type(paradevs::common::START).size() == 1);
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a2").
+            filter_type(paradevs::common::START).size() == 1);
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("b2").
+            filter_type(paradevs::common::START).size() == 1);
+
+    REQUIRE(paradevs::common::Trace <
+                MyTime >::trace().elements().
+            filter_model_name("a1").
+            filter_type(paradevs::common::DELTA_EXT).size() == 0);
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a1").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a1").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a1").filter_time(t).
+                filter_type(paradevs::common::TA).size() == 1);
+    }
+
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b1").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b1").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b1").filter_time(t).
+                filter_type(paradevs::common::TA).size() == 2);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b1").filter_time(t).
+                filter_type(paradevs::common::DELTA_EXT).size() == 1);
+    }
+
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a2").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 2);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a2").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 2);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a2").filter_time(t).
+                filter_type(paradevs::common::TA).size() == 3);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a2").filter_time(t).
+                filter_type(paradevs::common::DELTA_EXT).size() == 1);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("a2").filter_time(t).
+                filter_type(paradevs::common::DELTA_CONF).size() == 0);
+    }
+
+    for (unsigned int t = 0; t <= 10; ++t) {
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b2").filter_time(t).
+                filter_type(paradevs::common::LAMBDA).size() == 2);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b2").filter_time(t).
+                filter_type(paradevs::common::DELTA_INT).size() == 2);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b2").filter_time(t).
+                filter_type(paradevs::common::TA).size() == 4);
+        REQUIRE(paradevs::common::Trace <
+                    MyTime >::trace().elements().
+                filter_model_name("b2").filter_time(t).
+                filter_type(paradevs::common::DELTA_EXT).size() == 2);
+    }
+}

+ 0 - 573
src/tests/pdevs_tests.cpp

@@ -1,573 +0,0 @@
-/**
- * @file examples.cpp
- * @author The PARADEVS Development Team
- * See the AUTHORS or Authors.txt file
- */
-
-/*
- * PARADEVS - the multimodeling and simulation environment
- * This file is a part of the PARADEVS environment
- *
- * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <tests/pdevs_tests.hpp>
-
-#include <common/RootCoordinator.hpp>
-#include <common/scheduler/VectorScheduler.hpp>
-#include <common/Trace.hpp>
-
-#include <pdevs/Coordinator.hpp>
-#include <pdevs/GraphManager.hpp>
-#include <pdevs/Simulator.hpp>
-
-#define CATCH_CONFIG_MAIN
-#include "catch.hpp"
-
-namespace paradevs { namespace pdevs {
-
-void A::dint(typename MyTime::type t)
-{
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::DELTA_INT);
-    common::Trace < MyTime >::trace().flush();
-
-    if (_phase == SEND) {
-        _phase = WAIT;
-    }
-}
-
-void A::dext(typename MyTime::type t, typename MyTime::type /* e */,
-             const common::Bag < MyTime >& msgs)
-{
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::DELTA_EXT)
-        << "messages = " << msgs.to_string();
-    common::Trace < MyTime >::trace().flush();
-
-    _phase = SEND;
-}
-
-void A::dconf(typename MyTime::type t, typename MyTime::type /* e */,
-              const common::Bag < MyTime >& msgs)
-{
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::DELTA_CONF)
-        << "messages = " << msgs.to_string();
-    common::Trace < MyTime >::trace().flush();
-
-}
-
-typename MyTime::type A::start(typename MyTime::type t)
-{
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::START);
-    common::Trace < MyTime >::trace().flush();
-
-    _phase = WAIT;
-    return 0;
-}
-
-typename MyTime::type A::ta(typename MyTime::type t) const
-{
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::TA);
-    common::Trace < MyTime >::trace().flush();
-
-    if (_phase == WAIT) {
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
-common::Bag < MyTime > A::lambda(typename MyTime::type t) const
-{
-    common::Bag < MyTime > msgs;
-
-    msgs.push_back(common::ExternalEvent < MyTime >("out", 0.));
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::LAMBDA)
-        << "messages = " << msgs.to_string();
-    common::Trace < MyTime >::trace().flush();
-
-    return msgs;
-}
-
-void A::observation(std::ostream& /* file */) const
-{ }
-
-void B::dint(typename MyTime::type t)
-{
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::DELTA_INT);
-    common::Trace < MyTime >::trace().flush();
-
-    if (_phase == SEND) {
-        _phase = WAIT;
-    }
-}
-
-void B::dext(typename MyTime::type t, typename MyTime::type /* e */,
-             const common::Bag < MyTime >& msgs)
-{
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::DELTA_EXT)
-        << "messages = " << msgs.to_string();
-    common::Trace < MyTime >::trace().flush();
-
-    _phase = SEND;
-}
-
-void B::dconf(typename MyTime::type t, typename MyTime::type /* e */,
-              const common::Bag < MyTime >& msgs)
-{
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::DELTA_CONF)
-        << "messages = " << msgs.to_string();
-    common::Trace < MyTime >::trace().flush();
-
-}
-
-typename MyTime::type B::start(typename MyTime::type t)
-{
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::START);
-    common::Trace < MyTime >::trace().flush();
-
-    _phase = WAIT;
-    return std::numeric_limits < double >::max();
-}
-
-typename MyTime::type B::ta(typename MyTime::type t) const
-{
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::TA);
-    common::Trace < MyTime >::trace().flush();
-
-    if (_phase == WAIT) {
-        return std::numeric_limits < double >::max();
-    } else {
-        return 0;
-    }
-}
-
-common::Bag < MyTime > B::lambda(typename MyTime::type t) const
-{
-    common::Bag < MyTime > msgs;
-
-    msgs.push_back(common::ExternalEvent < MyTime >("out", 0.));
-
-    common::Trace < MyTime >::trace()
-        << common::TraceElement < MyTime >(get_name(), t,
-                                           common::LAMBDA)
-        << "messages = " << msgs.to_string();
-    common::Trace < MyTime >::trace().flush();
-
-    return msgs;
-}
-
-void B::observation(std::ostream& /* file */) const
-{ }
-
-class S1GraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    S1GraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator), a("a1"), b("b1")
-    {
-        add_child(&a);
-        add_child(&b);
-        add_link(&a, "out", &b, "in");
-        add_link(&b, "out", coordinator, "out");
-    }
-
-    virtual ~S1GraphManager()
-    { }
-
-private:
-    pdevs::Simulator < MyTime, A > a;
-    pdevs::Simulator < MyTime, B > b;
-};
-
-class S2GraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    S2GraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator), a("a2"), b("b2")
-    {
-        add_child(&a);
-        add_child(&b);
-        add_link(&a, "out", &b, "in");
-        add_link(coordinator, "in", &a, "in");
-    }
-
-    virtual ~S2GraphManager()
-    { }
-
-private:
-    pdevs::Simulator < MyTime, A > a;
-    pdevs::Simulator < MyTime, B > b;
-};
-
-class RootGraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    RootGraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator),
-        S1("S1", Parameters()),
-        S2("S2", Parameters())
-    {
-        add_child(&S1);
-        add_child(&S2);
-        add_link(&S1, "out", &S2, "in");
-    }
-
-    virtual ~RootGraphManager()
-    { }
-
-private:
-    Coordinator < MyTime, paradevs::common::scheduler::VectorScheduler <
-                              MyTime >, S1GraphManager > S1;
-    Coordinator < MyTime, paradevs::common::scheduler::VectorScheduler <
-                              MyTime >, S2GraphManager > S2;
-};
-
-class OnlyOneGraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    OnlyOneGraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator), a("a")
-    {
-        add_child(&a);
-    }
-
-    virtual ~OnlyOneGraphManager()
-    { }
-
-private:
-    pdevs::Simulator < MyTime, A > a;
-};
-
-class FlatGraphManager : public pdevs::GraphManager < MyTime >
-{
-public:
-    FlatGraphManager(common::Coordinator < MyTime >* coordinator) :
-        pdevs::GraphManager < MyTime >(coordinator),
-        a1("a1"), b1("b1"), a2("a2"), b2("b2")
-    {
-        add_child(&a1);
-        add_child(&b1);
-        add_child(&a2);
-        add_child(&b2);
-        add_link(&a1, "out", &b1, "in");
-        add_link(&b1, "out", &a2, "in");
-        add_link(&a2, "out", &b2, "in");
-    }
-
-    virtual ~FlatGraphManager()
-    { }
-
-private:
-    pdevs::Simulator < MyTime, A > a1;
-    pdevs::Simulator < MyTime, B > b1;
-    pdevs::Simulator < MyTime, A > a2;
-    pdevs::Simulator < MyTime, B > b2;
-};
-
-} } // namespace paradevs pdevs
-
-TEST_CASE("pdevs/only_one", "run")
-{
-    paradevs::common::RootCoordinator <
-        paradevs::pdevs::MyTime, paradevs::pdevs::Coordinator <
-            paradevs::pdevs::MyTime,
-            paradevs::common::scheduler::VectorScheduler <
-                paradevs::pdevs::MyTime >,
-            paradevs::pdevs::OnlyOneGraphManager >
-        > rc(0, 10, "root", paradevs::pdevs::Parameters());
-
-    paradevs::common::Trace < paradevs::pdevs::MyTime >::trace().clear();
-    rc.run();
-
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("a").
-            filter_type(paradevs::common::START).size() == 1);
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("a").
-            filter_type(paradevs::common::DELTA_EXT).size() == 0);
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("a").
-            filter_type(paradevs::common::DELTA_CONF).size() == 0);
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a").filter_time(t).
-                filter_type(paradevs::common::TA).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 1);
-    }
-}
-
-TEST_CASE("pdevs/flat", "run")
-{
-    paradevs::common::RootCoordinator <
-        paradevs::pdevs::MyTime, paradevs::pdevs::Coordinator <
-            paradevs::pdevs::MyTime,
-            paradevs::common::scheduler::VectorScheduler <
-                paradevs::pdevs::MyTime >,
-            paradevs::pdevs::FlatGraphManager >
-        > rc(0, 10, "root", paradevs::pdevs::Parameters());
-
-    paradevs::common::Trace < paradevs::pdevs::MyTime >::trace().clear();
-    rc.run();
-
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("a1").
-            filter_type(paradevs::common::START).size() == 1);
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("b1").
-            filter_type(paradevs::common::START).size() == 1);
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("a2").
-            filter_type(paradevs::common::START).size() == 1);
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("b2").
-            filter_type(paradevs::common::START).size() == 1);
-
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("a1").
-            filter_type(paradevs::common::DELTA_EXT).size() == 0);
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_type(paradevs::common::TA).size() == 1);
-    }
-
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_type(paradevs::common::TA).size() == 2);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_type(paradevs::common::DELTA_EXT).size() == 1);
-    }
-
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 2);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 2);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_type(paradevs::common::TA).size() == 3);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_type(paradevs::common::DELTA_EXT).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_type(paradevs::common::DELTA_CONF).size() == 0);
-    }
-
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 2);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 2);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_type(paradevs::common::TA).size() == 4);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_type(paradevs::common::DELTA_EXT).size() == 2);
-    }
-}
-
-TEST_CASE("pdevs/hierachical", "run")
-{
-    paradevs::common::RootCoordinator <
-        paradevs::pdevs::MyTime, paradevs::pdevs::Coordinator <
-            paradevs::pdevs::MyTime,
-            paradevs::common::scheduler::VectorScheduler <
-                paradevs::pdevs::MyTime >,
-            paradevs::pdevs::RootGraphManager >
-        > rc(0, 10, "root", paradevs::pdevs::Parameters());
-
-    paradevs::common::Trace < paradevs::pdevs::MyTime >::trace().clear();
-    rc.run();
-
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("a1").
-            filter_type(paradevs::common::START).size() == 1);
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("b1").
-            filter_type(paradevs::common::START).size() == 1);
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("a2").
-            filter_type(paradevs::common::START).size() == 1);
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("b2").
-            filter_type(paradevs::common::START).size() == 1);
-
-    REQUIRE(paradevs::common::Trace <
-                paradevs::pdevs::MyTime >::trace().elements().
-            filter_model_name("a1").
-            filter_type(paradevs::common::DELTA_EXT).size() == 0);
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_type(paradevs::common::TA).size() == 1);
-    }
-
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_type(paradevs::common::TA).size() == 2);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_type(paradevs::common::DELTA_EXT).size() == 1);
-    }
-
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 2);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 2);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_type(paradevs::common::TA).size() == 3);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_type(paradevs::common::DELTA_EXT).size() == 1);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_type(paradevs::common::DELTA_CONF).size() == 0);
-    }
-
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_type(paradevs::common::LAMBDA).size() == 2);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_type(paradevs::common::DELTA_INT).size() == 2);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_type(paradevs::common::TA).size() == 4);
-        REQUIRE(paradevs::common::Trace <
-                    paradevs::pdevs::MyTime >::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_type(paradevs::common::DELTA_EXT).size() == 2);
-    }
-}

+ 0 - 99
src/tests/pdevs_tests.hpp

@@ -1,99 +0,0 @@
-/**
- * @file pdevs_examples.hpp
- * @author The PARADEVS Development Team
- * See the AUTHORS or Authors.txt file
- */
-
-/*
- * PARADEVS - the multimodeling and simulation environment
- * This file is a part of the PARADEVS environment
- *
- * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <common/Time.hpp>
-
-#include <pdevs/Dynamics.hpp>
-
-#include <limits>
-
-namespace paradevs { namespace pdevs {
-
-template < typename T >
-struct Limits
-{
-    static constexpr T negative_infinity =
-        -std::numeric_limits < T >::infinity();
-    static constexpr T positive_infinity =
-        std::numeric_limits < T >::infinity();
-    static constexpr T null = 0;
-};
-
-typedef paradevs::common::Time < double, Limits < double > > MyTime;
-
-class A : public Dynamics < MyTime >
-{
-public:
-    A(const std::string& name) : Dynamics < MyTime >(name)
-    { }
-    virtual ~A()
-    { }
-
-    virtual void dint(typename MyTime::type /* t */);
-    virtual void dext(typename MyTime::type /* t */,
-                      typename MyTime::type /* e */,
-                      const common::Bag < MyTime >& /* msgs */);
-    virtual void dconf(typename MyTime::type /* t */,
-                       typename MyTime::type /* e */,
-                       const common::Bag < MyTime >& /* msgs */);
-    virtual typename MyTime::type start(typename MyTime::type /* t */);
-    virtual typename MyTime::type ta(typename MyTime::type /* t */) const;
-    virtual common::Bag < MyTime > lambda(typename MyTime::type /* t */) const;
-    virtual void observation(std::ostream& /* file */) const;
-
-private:
-    enum Phase { WAIT, SEND };
-
-    Phase _phase;
-};
-
-class B : public Dynamics < MyTime >
-{
-public:
-    B(const std::string& name) : Dynamics < MyTime >(name)
-    { }
-    virtual ~B()
-    { }
-
-    virtual void dint(typename MyTime::type /* t */);
-    virtual void dext(typename MyTime::type /* t */,
-                      typename MyTime::type /* e */,
-                      const common::Bag < MyTime >& /* msgs */);
-    virtual void dconf(typename MyTime::type /* t */,
-                       typename MyTime::type /* e */,
-                       const common::Bag < MyTime >& /* msgs */);
-    virtual typename MyTime::type start(typename MyTime::type /* t */);
-    virtual typename MyTime::type ta(typename MyTime::type /* t */) const;
-    virtual common::Bag < MyTime > lambda(typename MyTime::type /* t */) const;
-    virtual void observation(std::ostream& /* file */) const;
-
-private:
-    enum Phase { WAIT, SEND };
-
-    Phase _phase;
-};
-
-} } // namespace paradevs pdevs