graph_manager.hpp 3.4 KB

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