graph_manager.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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
  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. add_child(OneA, &a);
  52. }
  53. ~OnlyOneGraphManager() override = default;
  54. private:
  55. artis::dtss::Simulator<common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>> a;
  56. };
  57. class TwoGraphManager :
  58. public artis::dtss::GraphManager<common::DoubleTime,
  59. artis::dtss::Parameters<common::DoubleTime>,
  60. artis::common::NoParameters> {
  61. public:
  62. enum submodels {
  63. OneA, OneB
  64. };
  65. TwoGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
  66. const artis::dtss::Parameters<common::DoubleTime> &parameters,
  67. const artis::common::NoParameters &graph_parameters)
  68. :
  69. artis::dtss::GraphManager<common::DoubleTime,
  70. artis::dtss::Parameters<common::DoubleTime>,
  71. artis::common::NoParameters>(
  72. coordinator, parameters, graph_parameters),
  73. a("a", parameters),
  74. b("b", parameters) {
  75. add_child(OneA, &a);
  76. add_child(OneB, &b);
  77. out({&a, A::OUT}) >> in({&b, B::IN});
  78. }
  79. ~TwoGraphManager() override = default;
  80. private:
  81. artis::dtss::Simulator<common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>> a;
  82. artis::dtss::Simulator<common::DoubleTime, B, artis::dtss::Parameters<common::DoubleTime>> b;
  83. };
  84. }
  85. }
  86. } // namespace artis tests dtss
  87. #endif