mixed_tests.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /**
  2. * @file mixed_examples.hpp
  3. * @author The PARADEVS Development Team
  4. * See the AUTHORS or Authors.txt file
  5. */
  6. /*
  7. * PARADEVS - the multimodeling and simulation environment
  8. * This file is a part of the PARADEVS environment
  9. *
  10. * Copyright (C) 2013 ULCO http://www.univ-litoral.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. #include <dtss/Dynamics.hpp>
  26. #include <pdevs/Dynamics.hpp>
  27. namespace paradevs {
  28. class A1 : public paradevs::pdevs::Dynamics
  29. {
  30. public:
  31. A1(const std::string& name) : paradevs::pdevs::Dynamics(name)
  32. { }
  33. virtual ~A1()
  34. { }
  35. virtual void dint(common::Time /* t */);
  36. virtual void dext(common::Time /* t */, common::Time /* e */,
  37. const common::Bag& /* msgs */);
  38. virtual void dconf(common::Time /* t */, common::Time /* e */,
  39. const common::Bag& /* msgs */);
  40. virtual common::Time start(common::Time /* t */);
  41. virtual common::Time ta(common::Time /* t */) const;
  42. virtual common::Bag lambda(common::Time /* t */) const;
  43. private:
  44. enum Phase { WAIT, SEND };
  45. Phase _phase;
  46. };
  47. class B1 : public paradevs::pdevs::Dynamics
  48. {
  49. public:
  50. B1(const std::string& name) : paradevs::pdevs::Dynamics(name)
  51. { }
  52. virtual ~B1()
  53. { }
  54. virtual void dint(common::Time /* t */);
  55. virtual void dext(common::Time /* t */, common::Time /* e */,
  56. const common::Bag& /* msgs */);
  57. virtual void dconf(common::Time /* t */, common::Time /* e */,
  58. const common::Bag& /* msgs */);
  59. virtual common::Time start(common::Time /* t */);
  60. virtual common::Time ta(common::Time /* t */) const;
  61. virtual common::Bag lambda(common::Time /* t */) const;
  62. private:
  63. enum Phase { WAIT, SEND };
  64. Phase _phase;
  65. };
  66. class A2 : public paradevs::dtss::Dynamics
  67. {
  68. public:
  69. A2(const std::string& name) : paradevs::dtss::Dynamics(name)
  70. { }
  71. virtual ~A2()
  72. { }
  73. virtual void transition(const common::Bag& /* x */, common::Time /* t */);
  74. virtual common::Time start(common::Time /* t */);
  75. virtual common::Bag lambda(common::Time /* t */) const;
  76. };
  77. class B2 : public paradevs::dtss::Dynamics
  78. {
  79. public:
  80. B2(const std::string& name) : paradevs::dtss::Dynamics(name)
  81. { }
  82. virtual ~B2()
  83. { }
  84. virtual void transition(const common::Bag& /* x */, common::Time /* t */);
  85. virtual common::Time start(common::Time /* t */);
  86. virtual common::Bag lambda(common::Time /* t */) const;
  87. };
  88. } // namespace paradevs