graph_manager.hpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /**
  2. * @file tests/dtss/graph_manager.hpp
  3. * @author The ARTIS Development Team
  4. * See the AUTHORS or Authors.txt file
  5. */
  6. /*
  7. * ARTIS - the multimodeling and simulation environment
  8. * This file is a part of the ARTIS environment
  9. *
  10. * Copyright (C) 2013-2019 ULCO http://www.univ-littoral.fr
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation, either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. #ifndef TESTS_DTSS_GRAPH_MANAGER_HPP
  26. #define TESTS_DTSS_GRAPH_MANAGER_HPP 1
  27. #include <tests/dtss/models.hpp>
  28. #include <artis-star/kernel/dtss/Coordinator.hpp>
  29. #include <artis-star/kernel/dtss/GraphManager.hpp>
  30. #include <artis-star/kernel/dtss/Simulator.hpp>
  31. namespace artis {
  32. namespace tests {
  33. namespace dtss {
  34. class OnlyOneGraphManager :
  35. public artis::dtss::GraphManager<common::DoubleTime,
  36. artis::dtss::Parameters<common::DoubleTime>,
  37. artis::common::NoParameters> {
  38. public:
  39. enum submodels {
  40. OneA
  41. };
  42. OnlyOneGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
  43. const artis::dtss::Parameters<common::DoubleTime>& parameters,
  44. const artis::common::NoParameters& graph_parameters)
  45. :
  46. artis::dtss::GraphManager<common::DoubleTime,
  47. artis::dtss::Parameters<common::DoubleTime>,
  48. artis::common::NoParameters>(
  49. coordinator, parameters, graph_parameters),
  50. a("a", parameters)
  51. {
  52. add_child(OneA, &a);
  53. }
  54. ~OnlyOneGraphManager() override = default;
  55. private:
  56. artis::dtss::Simulator<common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>> a;
  57. };
  58. class TwoGraphManager :
  59. public artis::dtss::GraphManager<common::DoubleTime,
  60. artis::dtss::Parameters<common::DoubleTime>,
  61. artis::common::NoParameters> {
  62. public:
  63. enum submodels {
  64. OneA, OneB
  65. };
  66. TwoGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
  67. const artis::dtss::Parameters<common::DoubleTime>& parameters,
  68. const artis::common::NoParameters& graph_parameters)
  69. :
  70. artis::dtss::GraphManager<common::DoubleTime,
  71. artis::dtss::Parameters<common::DoubleTime>,
  72. artis::common::NoParameters>(
  73. coordinator, parameters, graph_parameters),
  74. a("a", parameters),
  75. b("b", parameters)
  76. {
  77. add_child(OneA, &a);
  78. add_child(OneB, &b);
  79. out({&a, A::OUT}) >> in({&b, B::IN});
  80. }
  81. ~TwoGraphManager() override = default;
  82. private:
  83. artis::dtss::Simulator<common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>> a;
  84. artis::dtss::Simulator<common::DoubleTime, B, artis::dtss::Parameters<common::DoubleTime>> b;
  85. };
  86. }
  87. }
  88. } // namespace artis tests dtss
  89. #endif