graph_manager.hpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * @file tests/fddevs/graph_manager.cpp
  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_FDDEVS_GRAPH_MANAGER_HPP
  26. #define TESTS_FDDEVS_GRAPH_MANAGER_HPP
  27. #include <tests/fddevs/models.hpp>
  28. #include <artis-star/kernel/fddevs/Coordinator.hpp>
  29. #include <artis-star/kernel/fddevs/GraphManager.hpp>
  30. #include <artis-star/kernel/fddevs/Simulator.hpp>
  31. namespace artis {
  32. namespace tests {
  33. namespace fddevs {
  34. class FlatGraphManager :
  35. public artis::fddevs::GraphManager<common::DoubleTime>
  36. {
  37. public:
  38. enum submodels
  39. {
  40. M_BEEP, M_CRC, M_MXR,
  41. };
  42. FlatGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
  43. const artis::common::NoParameters &parameters,
  44. const artis::common::NoParameters &graph_parameters)
  45. :
  46. artis::fddevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
  47. _beep("beep", parameters), _crc("crc", parameters), _mxr("mxr", parameters)
  48. {
  49. add_child(M_BEEP, &_beep);
  50. add_child(M_CRC, &_crc);
  51. add_child(M_MXR, &_mxr);
  52. out({&_beep, Beep::OUT_P}) >> in({&_crc, CRC::IN_P});
  53. out({&_crc, CRC::OUT_G}) >> in({&_mxr, MXR::IN_A});
  54. out({&_crc, CRC::OUT_W}) >> in({&_mxr, MXR::IN_B});
  55. }
  56. ~FlatGraphManager() override = default;
  57. private:
  58. artis::fddevs::Simulator<common::DoubleTime, Beep> _beep;
  59. artis::fddevs::Simulator<common::DoubleTime, CRC> _crc;
  60. artis::fddevs::Simulator<common::DoubleTime, MXR> _mxr;
  61. };
  62. }
  63. }
  64. } // namespace artis tests fddevs
  65. #endif