|
@@ -52,6 +52,16 @@ namespace artis {
|
|
|
:x(_x), y(_y) { }
|
|
|
};
|
|
|
|
|
|
+ class Inactive : public artis::pdevs::Dynamics<common::DoubleTime, Inactive> {
|
|
|
+ public:
|
|
|
+ Inactive(const std::string& name,
|
|
|
+ const artis::pdevs::Context<common::DoubleTime, Inactive>& context)
|
|
|
+ :
|
|
|
+ artis::pdevs::Dynamics<common::DoubleTime, Inactive>(name, context) { }
|
|
|
+
|
|
|
+ ~Inactive() override = default;
|
|
|
+ };
|
|
|
+
|
|
|
class A : public artis::pdevs::Dynamics<common::DoubleTime, A> {
|
|
|
public:
|
|
|
enum inputs {
|
|
@@ -72,7 +82,7 @@ namespace artis {
|
|
|
|
|
|
~A() override = default;
|
|
|
|
|
|
- void dint(typename common::DoubleTime::type t) override
|
|
|
+ void dint(const typename common::DoubleTime::type& t) override
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -98,7 +108,8 @@ namespace artis {
|
|
|
}
|
|
|
|
|
|
void
|
|
|
- dext(typename common::DoubleTime::type t, typename common::DoubleTime::type /* e */,
|
|
|
+ dext(const typename common::DoubleTime::type& t,
|
|
|
+ const typename common::DoubleTime::type& /* e */,
|
|
|
const common::Bag<common::DoubleTime>& msgs) override
|
|
|
{
|
|
|
|
|
@@ -120,8 +131,8 @@ namespace artis {
|
|
|
_phase = SEND;
|
|
|
}
|
|
|
|
|
|
- void dconf(typename common::DoubleTime::type t,
|
|
|
- typename common::DoubleTime::type /* e */,
|
|
|
+ void dconf(const typename common::DoubleTime::type& t,
|
|
|
+ const typename common::DoubleTime::type& /* e */,
|
|
|
const common::Bag<common::DoubleTime>& msgs) override
|
|
|
{
|
|
|
|
|
@@ -142,7 +153,7 @@ namespace artis {
|
|
|
|
|
|
}
|
|
|
|
|
|
- void start(typename common::DoubleTime::type t) override
|
|
|
+ void start(const typename common::DoubleTime::type& t) override
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -162,7 +173,7 @@ namespace artis {
|
|
|
}
|
|
|
|
|
|
typename common::DoubleTime::type
|
|
|
- ta(typename common::DoubleTime::type t) const override
|
|
|
+ ta(const typename common::DoubleTime::type& t) const override
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -186,7 +197,7 @@ namespace artis {
|
|
|
}
|
|
|
|
|
|
common::Bag<common::DoubleTime>
|
|
|
- lambda(typename common::DoubleTime::type t) const override
|
|
|
+ lambda(const typename common::DoubleTime::type& t) const override
|
|
|
{
|
|
|
#ifndef WITH_TRACE
|
|
|
(void)t;
|
|
@@ -241,7 +252,7 @@ namespace artis {
|
|
|
|
|
|
~B() override = default;
|
|
|
|
|
|
- void dint(typename common::DoubleTime::type t) override
|
|
|
+ void dint(const typename common::DoubleTime::type& t) override
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -263,7 +274,8 @@ namespace artis {
|
|
|
}
|
|
|
|
|
|
void
|
|
|
- dext(typename common::DoubleTime::type t, typename common::DoubleTime::type /* e */,
|
|
|
+ dext(const typename common::DoubleTime::type& t,
|
|
|
+ const typename common::DoubleTime::type& /* e */,
|
|
|
const common::Bag<common::DoubleTime>& msgs) override
|
|
|
{
|
|
|
|
|
@@ -285,8 +297,8 @@ namespace artis {
|
|
|
_phase = SEND;
|
|
|
}
|
|
|
|
|
|
- void dconf(typename common::DoubleTime::type t,
|
|
|
- typename common::DoubleTime::type e,
|
|
|
+ void dconf(const typename common::DoubleTime::type& t,
|
|
|
+ const typename common::DoubleTime::type& e,
|
|
|
const common::Bag<common::DoubleTime>& msgs) override
|
|
|
{
|
|
|
|
|
@@ -309,7 +321,7 @@ namespace artis {
|
|
|
|
|
|
}
|
|
|
|
|
|
- void start(typename common::DoubleTime::type t) override
|
|
|
+ void start(const typename common::DoubleTime::type& t) override
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -329,7 +341,7 @@ namespace artis {
|
|
|
}
|
|
|
|
|
|
typename common::DoubleTime::type ta(
|
|
|
- typename common::DoubleTime::type t) const override
|
|
|
+ const typename common::DoubleTime::type& t) const override
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -353,7 +365,7 @@ namespace artis {
|
|
|
}
|
|
|
|
|
|
common::Bag<common::DoubleTime> lambda(
|
|
|
- typename common::DoubleTime::type t) const override
|
|
|
+ const typename common::DoubleTime::type& t) const override
|
|
|
{
|
|
|
#ifndef WITH_TRACE
|
|
|
(void)t;
|
|
@@ -396,7 +408,7 @@ namespace artis {
|
|
|
|
|
|
~TwoStateModel() override = default;
|
|
|
|
|
|
- void dint(typename common::DoubleTime::type t) override
|
|
|
+ void dint(const typename common::DoubleTime::type& t) override
|
|
|
{
|
|
|
if (_phase == S1) {
|
|
|
_phase = S2;
|
|
@@ -406,14 +418,14 @@ namespace artis {
|
|
|
_last_time = t;
|
|
|
}
|
|
|
|
|
|
- void start(typename common::DoubleTime::type t) override
|
|
|
+ void start(const typename common::DoubleTime::type& t) override
|
|
|
{
|
|
|
_phase = S1;
|
|
|
_last_time = t;
|
|
|
}
|
|
|
|
|
|
typename common::DoubleTime::type
|
|
|
- ta(typename common::DoubleTime::type /* t */) const override
|
|
|
+ ta(const typename common::DoubleTime::type& /* t */) const override
|
|
|
{
|
|
|
if (_phase == S1) {
|
|
|
return 5;
|
|
@@ -423,7 +435,7 @@ namespace artis {
|
|
|
}
|
|
|
|
|
|
common::Bag<common::DoubleTime>
|
|
|
- lambda(typename common::DoubleTime::type t) const override
|
|
|
+ lambda(const typename common::DoubleTime::type& t) const override
|
|
|
{
|
|
|
|
|
|
std::cout << (t - _last_time) << std::endl;
|
|
@@ -468,15 +480,15 @@ namespace artis {
|
|
|
|
|
|
~ThreeStateModel() override = default;
|
|
|
|
|
|
- void dconf(typename common::DoubleTime::type t,
|
|
|
- typename common::DoubleTime::type e,
|
|
|
+ void dconf(const typename common::DoubleTime::type& t,
|
|
|
+ const typename common::DoubleTime::type& e,
|
|
|
const common::Bag<common::DoubleTime>& msgs) override
|
|
|
{
|
|
|
dext(t, e, msgs);
|
|
|
}
|
|
|
|
|
|
- void dext(typename common::DoubleTime::type /* t */,
|
|
|
- typename common::DoubleTime::type /* e */,
|
|
|
+ void dext(const typename common::DoubleTime::type& /* t */,
|
|
|
+ const typename common::DoubleTime::type& /* e */,
|
|
|
const common::Bag<common::DoubleTime>& msgs) override
|
|
|
{
|
|
|
for (common::Bag<common::DoubleTime>::const_iterator it = msgs.begin();
|
|
@@ -504,7 +516,7 @@ namespace artis {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void dint(typename common::DoubleTime::type t) override
|
|
|
+ void dint(const typename common::DoubleTime::type& t) override
|
|
|
{
|
|
|
mark_full(t);
|
|
|
if (full_N()) {
|
|
@@ -513,7 +525,7 @@ namespace artis {
|
|
|
compute();
|
|
|
}
|
|
|
|
|
|
- void start(typename common::DoubleTime::type t) override
|
|
|
+ void start(const typename common::DoubleTime::type& t) override
|
|
|
{
|
|
|
heights = {0, 0, 0, 0, 0};
|
|
|
speeds = {0.21, 0.3, 0.7, 0.56, 0.14};
|
|
@@ -525,10 +537,10 @@ namespace artis {
|
|
|
}
|
|
|
|
|
|
typename common::DoubleTime::type
|
|
|
- ta(typename common::DoubleTime::type /* t */) const override { return sigma; }
|
|
|
+ ta(const typename common::DoubleTime::type& /* t */) const override { return sigma; }
|
|
|
|
|
|
common::Bag<common::DoubleTime>
|
|
|
- lambda(typename common::DoubleTime::type /* t */) const override
|
|
|
+ lambda(const typename common::DoubleTime::type& /* t */) const override
|
|
|
{
|
|
|
common::Bag<common::DoubleTime> msgs;
|
|
|
|
|
@@ -596,7 +608,7 @@ namespace artis {
|
|
|
return n >= 2;
|
|
|
}
|
|
|
|
|
|
- void mark_full(typename common::DoubleTime::type t)
|
|
|
+ void mark_full(const typename common::DoubleTime::type& t)
|
|
|
{
|
|
|
for (std::vector<double>::iterator it = heights.begin();
|
|
|
it != heights.end(); ++it) {
|