Browse Source

Apply namespace change of qss

Eric Ramat 6 months ago
parent
commit
69f820bc83
5 changed files with 73 additions and 65 deletions
  1. 17 11
      CMakeLists.txt
  2. 2 1
      src/tests/qss/CMakeLists.txt
  3. 29 29
      src/tests/qss/graph_manager.hpp
  4. 10 10
      src/tests/qss/main.cpp
  5. 15 14
      src/tests/qss/models.hpp

+ 17 - 11
CMakeLists.txt

@@ -2,16 +2,21 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(ARTIS_TEST CXX C)
 ENABLE_TESTING()
 
-SET(MODEL_MAJOR 0)
-SET(MODEL_MINOR 1)
-SET(MODEL_PATCH 0)
-SET(MODEL_EXTRA "-dev")
-
-IF ("${MODEL_EXTRA}" STREQUAL "")
-    SET(MODEL_NAME "${PROJECT_NAME}-${MODEL_MAJOR}.${MODEL_MINOR}.${MODEL_PATCH}")
-ELSE ("${MODEL_EXTRA}" STREQUAL "")
-    SET(MODEL_NAME "${PROJECT_NAME}-${MODEL_MAJOR}.${MODEL_MINOR}.${MODEL_PATCH}${MODEL_EXTRA}")
-ENDIF ("${MODEL_EXTRA}" STREQUAL "")
+SET(ARTIS_TEST_MAJOR 0)
+SET(ARTIS_TEST_MINOR 1)
+SET(ARTIS_TEST_PATCH 0)
+SET(ARTIS_TEST_EXTRA "-dev")
+SET(ARTIS_TEST_VERSION "${ARTIS_TEST_MAJOR}.${ARTIS_TEST_MINOR}.${ARTIS_TEST_PATCH}")
+SET(ARTIS_TEST_VERSION_SHORT "${ARTIS_TEST_MAJOR}.${ARTIS_TEST_MINOR}")
+SET(ARTIS_TEST_NAME "artis-test")
+SET(ARTIS_TEST_NAME_VERSION "${ARTIS_TEST_NAME}-${ARTIS_TEST_VERSION}")
+SET(ARTIS_TEST_LOCALE_NAME "${ARTIS_TEST_NAME}-${ARTIS_TEST_MAJOR}-${ARTIS_TEST_MINOR}")
+IF ("${ARTIS_TEST_EXTRA}" STREQUAL "")
+    SET(ARTIS_TEST_COMPLETE "${ARTIS_TEST_MAJOR}.${ARTIS_TEST_MINOR}.${ARTIS_TEST_PATCH}")
+ELSE ("${ARTIS_TEST_EXTRA}" STREQUAL "")
+    SET(ARTIS_TEST_COMPLETE "${ARTIS_TEST_MAJOR}.${ARTIS_TEST_MINOR}.${ARTIS_TEST_PATCH}-${ARTIS_TEST_EXTRA}")
+ENDIF ("${ARTIS_TEST_EXTRA}" STREQUAL "")
+SET(ARTIS_TEST_NAME_COMPLETE "${ARTIS_TEST_NAME}-${ARTIS_TEST_COMPLETE}")
 
 #
 # CPack configuration
@@ -76,6 +81,7 @@ INCLUDE(CMakeDetermineCCompiler)
 FIND_PACKAGE(PkgConfig REQUIRED)
 
 PKG_CHECK_MODULES(ARTIS REQUIRED artis-star-1.0)
+PKG_CHECK_MODULES(ARTIS_TEST REQUIRED artis-addons-1.0)
 
 #
 # Test the libboost header and libboost-text library.
@@ -130,7 +136,7 @@ ADD_SUBDIRECTORY(src)
 #
 
 MESSAGE(STATUS "- - - -")
-MESSAGE(STATUS "${ARTIS_NAME_COMPLETE} configured successfully")
+MESSAGE(STATUS "${ARTIS_TEST_NAME_COMPLETE} configured successfully")
 MESSAGE(STATUS "Using ${CMAKE_INSTALL_PREFIX} for installation")
 MESSAGE(STATUS "Build type ${CMAKE_BUILD_TYPE}")
 IF (ARTIS_HAVE_GCC_ABI_DEMANGLE)

+ 2 - 1
src/tests/qss/CMakeLists.txt

@@ -1,10 +1,11 @@
 INCLUDE_DIRECTORIES(
         ${CMAKE_SOURCE_DIR}/src
         ${ARTIS_INCLUDE_DIRS}
+        ${ARTIS_ADDONS_INCLUDE_DIRS}
         ${Boost_INCLUDE_DIRS})
 
 LINK_DIRECTORIES()
 
 ADD_EXECUTABLE(qss-main graph_manager.hpp models.hpp main.cpp)
 
-TARGET_LINK_LIBRARIES(qss-main  ${Boost_LIBRARIES})
+TARGET_LINK_LIBRARIES(qss-main ${Boost_LIBRARIES})

+ 29 - 29
src/tests/qss/graph_manager.hpp

@@ -30,7 +30,7 @@
 #include <tests/qss/models.hpp>
 
 #include <artis-star/kernel/pdevs/Coordinator.hpp>
-#include <artis-star/kernel/pdevs/qss/GraphManager.hpp>
+#include <artis-addons/qss/GraphManager.hpp>
 #include <artis-star/kernel/dtss/Coordinator.hpp>
 #include <artis-star/kernel/dtss/GraphManager.hpp>
 #include <artis-star/kernel/dtss/Policy.hpp>
@@ -40,30 +40,30 @@ namespace artis {
         namespace qss {
 
             class ConstantGraphManager :
-                    public artis::pdevs::qss::GraphManager<common::DoubleTime, Constant> {
+                    public artis::qss::GraphManager<common::DoubleTime, Constant> {
             public:
                 ConstantGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::pdevs::qss::QSSParameters<artis::common::NoParameters>& parameters,
+                        const artis::qss::QSSParameters<artis::common::NoParameters>& parameters,
                         const artis::common::NoParameters& graph_parameters)
                         :
-                        artis::pdevs::qss::GraphManager<common::DoubleTime, Constant>(coordinator,
+                        artis::qss::GraphManager<common::DoubleTime, Constant>(coordinator,
                                 parameters, graph_parameters) { }
 
                 ~ConstantGraphManager() override = default;
             };
 
             class OnlyOneGraphManager :
-                    public artis::pdevs::qss::GraphManager<common::DoubleTime, Constant> {
+                    public artis::qss::GraphManager<common::DoubleTime, Constant> {
             public:
                 enum submodels {
                     A
                 };
 
                 OnlyOneGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::pdevs::qss::QSSParameters<artis::common::NoParameters>& parameters,
+                        const artis::qss::QSSParameters<artis::common::NoParameters>& parameters,
                         const artis::common::NoParameters& graph_parameters)
                         :
-                        artis::pdevs::qss::GraphManager<common::DoubleTime, Constant>(coordinator,
+                        artis::qss::GraphManager<common::DoubleTime, Constant>(coordinator,
                                 parameters, graph_parameters),
                         S("a", parameters, graph_parameters)
                 {
@@ -73,34 +73,34 @@ namespace artis {
                 ~OnlyOneGraphManager() override = default;
 
             private:
-                artis::pdevs::Coordinator<common::DoubleTime, ConstantGraphManager, artis::pdevs::qss::QSSParameters<artis::common::NoParameters>> S;
+                artis::pdevs::Coordinator<common::DoubleTime, ConstantGraphManager, artis::qss::QSSParameters<artis::common::NoParameters>> S;
             };
 
             class ParabolaGraphManager :
-                    public artis::pdevs::qss::GraphManager<common::DoubleTime, Parabola, ParabolaParameters> {
+                    public artis::qss::GraphManager<common::DoubleTime, Parabola, ParabolaParameters> {
             public:
                 ParabolaGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::pdevs::qss::QSSParameters<ParabolaParameters>& parameters,
+                        const artis::qss::QSSParameters<ParabolaParameters>& parameters,
                         const artis::common::NoParameters& graph_parameters)
                         :
-                        artis::pdevs::qss::GraphManager<common::DoubleTime, Parabola, ParabolaParameters>(
+                        artis::qss::GraphManager<common::DoubleTime, Parabola, ParabolaParameters>(
                                 coordinator, parameters, graph_parameters) { }
 
                 ~ParabolaGraphManager() override = default;
             };
 
             class OnlyOneParabolaGraphManager :
-                    public artis::pdevs::GraphManager<common::DoubleTime, artis::pdevs::qss::QSSParameters<ParabolaParameters>> {
+                    public artis::pdevs::GraphManager<common::DoubleTime, artis::qss::QSSParameters<ParabolaParameters>> {
             public:
                 enum submodels {
                     A
                 };
 
                 OnlyOneParabolaGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::pdevs::qss::QSSParameters<ParabolaParameters>& parameters,
+                        const artis::qss::QSSParameters<ParabolaParameters>& parameters,
                         const artis::common::NoParameters& graph_parameters)
                         :
-                        artis::pdevs::GraphManager<common::DoubleTime, artis::pdevs::qss::QSSParameters<ParabolaParameters>>(
+                        artis::pdevs::GraphManager<common::DoubleTime, artis::qss::QSSParameters<ParabolaParameters>>(
                                 coordinator, parameters, graph_parameters),
                         S("a", parameters, graph_parameters)
                 {
@@ -110,23 +110,23 @@ namespace artis {
                 ~OnlyOneParabolaGraphManager() override = default;
 
             private:
-                artis::pdevs::Coordinator<common::DoubleTime, ParabolaGraphManager, artis::pdevs::qss::QSSParameters<ParabolaParameters>> S;
+                artis::pdevs::Coordinator<common::DoubleTime, ParabolaGraphManager, artis::qss::QSSParameters<ParabolaParameters>> S;
             };
 
             class PredatorGraphManager :
-                    public artis::pdevs::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters> {
+                    public artis::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters> {
             public:
                 enum inputs {
                     IN_X =
-                    artis::pdevs::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters>::RESET
+                    artis::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters>::RESET
                             + 1
                 };
 
                 PredatorGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::pdevs::qss::QSSParameters<PreyPredatorParameters>& parameters,
+                        const artis::qss::QSSParameters<PreyPredatorParameters>& parameters,
                         const artis::common::NoParameters& graph_parameters)
                         :
-                        artis::pdevs::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters>(
+                        artis::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters>(
                                 coordinator, parameters, graph_parameters)
                 {
                     coordinator->input_port({IN_X, "in_x"});
@@ -137,19 +137,19 @@ namespace artis {
             };
 
             class PreyGraphManager :
-                    public artis::pdevs::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters> {
+                    public artis::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters> {
             public:
                 enum inputs {
                     IN_Y =
-                    artis::pdevs::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters>::RESET
+                    artis::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters>::RESET
                             + 1
                 };
 
                 PreyGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::pdevs::qss::QSSParameters<PreyPredatorParameters>& parameters,
+                        const artis::qss::QSSParameters<PreyPredatorParameters>& parameters,
                         const artis::common::NoParameters& graph_parameters)
                         :
-                        artis::pdevs::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters>(
+                        artis::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters>(
                                 coordinator, parameters, graph_parameters)
                 {
                     coordinator->input_port({IN_Y, "in_y"});
@@ -160,8 +160,8 @@ namespace artis {
             };
 
             struct PreyPredatorGraphManagerParameters {
-                artis::pdevs::qss::QSSParameters<PreyPredatorParameters> _predator;
-                artis::pdevs::qss::QSSParameters<PreyPredatorParameters> _prey;
+                artis::qss::QSSParameters<PreyPredatorParameters> _predator;
+                artis::qss::QSSParameters<PreyPredatorParameters> _prey;
             };
 
             class PreyPredatorGraphManager :
@@ -214,8 +214,8 @@ namespace artis {
                 ~PreyPredatorGraphManager() override = default;
 
             private:
-                artis::pdevs::Coordinator<common::DoubleTime, PredatorGraphManager, artis::pdevs::qss::QSSParameters<PreyPredatorParameters>> _predator;
-                artis::pdevs::Coordinator<common::DoubleTime, PreyGraphManager, artis::pdevs::qss::QSSParameters<PreyPredatorParameters>> _prey;
+                artis::pdevs::Coordinator<common::DoubleTime, PredatorGraphManager, artis::qss::QSSParameters<PreyPredatorParameters>> _predator;
+                artis::pdevs::Coordinator<common::DoubleTime, PreyGraphManager, artis::qss::QSSParameters<PreyPredatorParameters>> _prey;
             };
 
             struct PreyPredatorSmartGardenerGraphManagerParameters {
@@ -304,7 +304,7 @@ namespace artis {
 
             struct MixedPreyPredatorGraphManagerParameters {
                 DiscretePreyPredatorParameters _predator;
-                artis::pdevs::qss::QSSParameters<PreyPredatorParameters> _prey;
+                artis::qss::QSSParameters<PreyPredatorParameters> _prey;
             };
 
             class MixedPreyPredatorGraphManager :
@@ -356,7 +356,7 @@ namespace artis {
 
             private:
                 artis::dtss::Coordinator<artis::common::DoubleTime, artis::dtss::LastBagPolicy, DiscretePredatorGraphManager, DiscretePreyPredatorParameters> _predator;
-                artis::pdevs::Coordinator<artis::common::DoubleTime, PreyGraphManager, artis::pdevs::qss::QSSParameters<PreyPredatorParameters>> _prey;
+                artis::pdevs::Coordinator<artis::common::DoubleTime, PreyGraphManager, artis::qss::QSSParameters<PreyPredatorParameters>> _prey;
             };
 
         }

+ 10 - 10
src/tests/qss/main.cpp

@@ -38,16 +38,16 @@ using namespace artis::tests::qss;
 
 void test_parabola()
 {
-    artis::pdevs::qss::QSSParameters<ParabolaParameters> parameters = {{0.5},
-                                                                       {true, true, 0.001, 3},
-                                                                       {0.2}};
+    artis::qss::QSSParameters<ParabolaParameters> parameters = {{0.5},
+                                                                {true, true, 0.001, 3},
+                                                                {0.2}};
 
     class View : public artis::observer::View<artis::common::DoubleTime> {
     public:
         View()
         {
             selector("Value", {OnlyOneParabolaGraphManager::A, ParabolaGraphManager::S_Integrator,
-                               artis::pdevs::qss::Integrator<artis::common::DoubleTime>::VALUE});
+                               artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
         }
     };
 
@@ -56,7 +56,7 @@ void test_parabola()
             artis::common::DoubleTime, artis::pdevs::Coordinator<
                     artis::common::DoubleTime,
                     OnlyOneParabolaGraphManager,
-                    artis::pdevs::qss::QSSParameters<ParabolaParameters>>
+                    artis::qss::QSSParameters<ParabolaParameters>>
     > rc(context, "root", parameters, artis::common::NoParameters());
 
     rc.attachView("Value", new View());
@@ -79,10 +79,10 @@ public:
     {
         selector("PredatorView",
                 {PreyPredatorGraphManager::PREDATOR, PredatorGraphManager::S_Integrator,
-                 artis::pdevs::qss::Integrator<artis::common::DoubleTime>::VALUE});
+                 artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
         selector("PreyView",
                 {PreyPredatorGraphManager::PREY, PreyGraphManager::S_Integrator,
-                 artis::pdevs::qss::Integrator<artis::common::DoubleTime>::VALUE});
+                 artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
     }
 };
 
@@ -159,11 +159,11 @@ public:
         selector("PredatorView",
                 {PreyPredatorSmartGardenerGraphManager::PREY_PREDATOR,
                  PreyPredatorGraphManager::PREDATOR, PredatorGraphManager::S_Integrator,
-                 artis::pdevs::qss::Integrator<artis::common::DoubleTime>::VALUE});
+                 artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
         selector("PreyView",
                 {PreyPredatorSmartGardenerGraphManager::PREY_PREDATOR,
                  PreyPredatorGraphManager::PREY, PreyGraphManager::S_Integrator,
-                 artis::pdevs::qss::Integrator<artis::common::DoubleTime>::VALUE});
+                 artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
     }
 };
 
@@ -203,7 +203,7 @@ public:
                  DiscretePredator::VALUE});
         selector("PreyView",
                 {MixedPreyPredatorGraphManager::PREY, PreyGraphManager::S_Integrator,
-                 artis::pdevs::qss::Integrator<artis::common::DoubleTime>::VALUE});
+                 artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
     }
 };
 

+ 15 - 14
src/tests/qss/models.hpp

@@ -30,19 +30,19 @@
 #include <artis-star/common/time/DoubleTime.hpp>
 #include <artis-star/common/utils/Trace.hpp>
 
-#include <artis-star/kernel/pdevs/qss/Derivative.hpp>
+#include <artis-star/kernel/qss/Derivative.hpp>
 #include <artis-star/kernel/dtss/Dynamics.hpp>
 
 namespace artis {
     namespace tests {
         namespace qss {
 
-            class Constant : public artis::pdevs::qss::Derivative<common::DoubleTime, Constant> {
+            class Constant : public artis::qss::Derivative<common::DoubleTime, Constant> {
             public:
                 Constant(const std::string& name,
                         const artis::pdevs::Context<common::DoubleTime, Constant, artis::common::NoParameters>& context)
                         :
-                        artis::pdevs::qss::Derivative<common::DoubleTime, Constant>(name,
+                        artis::qss::Derivative<common::DoubleTime, Constant>(name,
                                 context) { }
 
                 ~Constant() override = default;
@@ -55,12 +55,12 @@ namespace artis {
             };
 
             class Parabola
-                    : public artis::pdevs::qss::Derivative<common::DoubleTime, Parabola, ParabolaParameters> {
+                    : public artis::qss::Derivative<common::DoubleTime, Parabola, ParabolaParameters> {
             public:
                 Parabola(const std::string& name,
                         const artis::pdevs::Context<common::DoubleTime, Parabola, ParabolaParameters>& context)
                         :
-                        artis::pdevs::qss::Derivative<common::DoubleTime, Parabola, ParabolaParameters>(
+                        artis::qss::Derivative<common::DoubleTime, Parabola, ParabolaParameters>(
                                 name,
                                 context), _alpha(context.parameters().alpha)
                 {
@@ -85,14 +85,14 @@ namespace artis {
             };
 
             class Predator
-                    : public artis::pdevs::qss::Derivative<common::DoubleTime, Predator, PreyPredatorParameters> {
+                    : public artis::qss::Derivative<common::DoubleTime, Predator, PreyPredatorParameters> {
             public:
                 unsigned int IN_X;
 
                 Predator(const std::string& name,
                         const artis::pdevs::Context<common::DoubleTime, Predator, PreyPredatorParameters>& context)
                         :
-                        artis::pdevs::qss::Derivative<common::DoubleTime, Predator, PreyPredatorParameters>(
+                        artis::qss::Derivative<common::DoubleTime, Predator, PreyPredatorParameters>(
                                 name,
                                 context), _b(context.parameters().b), _d(context.parameters().d),
                         _e(context.parameters().e)
@@ -117,14 +117,14 @@ namespace artis {
             };
 
             class Prey
-                    : public artis::pdevs::qss::Derivative<common::DoubleTime, Prey, PreyPredatorParameters> {
+                    : public artis::qss::Derivative<common::DoubleTime, Prey, PreyPredatorParameters> {
             public:
                 unsigned int IN_Y;
 
                 Prey(const std::string& name,
                         const artis::pdevs::Context<common::DoubleTime, Prey, PreyPredatorParameters>& context)
                         :
-                        artis::pdevs::qss::Derivative<common::DoubleTime, Prey, PreyPredatorParameters>(
+                        artis::qss::Derivative<common::DoubleTime, Prey, PreyPredatorParameters>(
                                 name,
                                 context), _a(context.parameters().a), _b(context.parameters().b)
                 {
@@ -210,7 +210,7 @@ namespace artis {
                 {
                     std::for_each(bag.begin(), bag.end(),
                             [this](const common::ExternalEvent<common::DoubleTime>& event) {
-                                artis::pdevs::qss::IntegratorData data;
+                                artis::qss::IntegratorData data;
 
                                 event.data()(data);
                                 if (event.on_port(IN_X)) {
@@ -245,7 +245,7 @@ namespace artis {
                     common::Bag<common::DoubleTime> bag;
 
                     if (_phase == PEST) {
-                        artis::pdevs::qss::IntegratorData data = {_prey_amount * _prey_proportion};
+                        artis::qss::IntegratorData data = {_prey_amount * _prey_proportion};
 
                         bag.push_back(common::ExternalEvent<common::DoubleTime>(OUT_X, data));
                         data = {_predator_amount * _predator_proportion};
@@ -317,7 +317,7 @@ namespace artis {
                     std::for_each(bag.begin(), bag.end(),
                             [this](const artis::common::ExternalEvent<artis::common::DoubleTime>& event) {
                                 if (event.on_port(IN_X)) {
-                                    artis::pdevs::qss::IntegratorData data;
+                                    artis::qss::IntegratorData data;
 
                                     event.data()(data);
                                     _x = data.value;
@@ -337,9 +337,10 @@ namespace artis {
                 lambda(const artis::common::DoubleTime::type& /* t */) const override
                 {
                     artis::common::Bag<artis::common::DoubleTime> msgs;
-                    artis::pdevs::qss::IntegratorData data = {_y};
+                    artis::qss::IntegratorData data = {_y};
 
-                    msgs.push_back(artis::common::ExternalEvent<artis::common::DoubleTime>(OUT, data));
+                    msgs.push_back(
+                            artis::common::ExternalEvent<artis::common::DoubleTime>(OUT, data));
                     return msgs;
                 }