|
@@ -27,7 +27,7 @@
|
|
|
#ifndef TESTS_MIXED_MODELS_HPP
|
|
|
#define TESTS_MIXED_MODELS_HPP 1
|
|
|
|
|
|
-#include <common/Time.hpp>
|
|
|
+#include <common/time/DoubleTime.hpp>
|
|
|
#include <common/Trace.hpp>
|
|
|
|
|
|
#include <dtss/Dynamics.hpp>
|
|
@@ -36,33 +36,22 @@
|
|
|
|
|
|
namespace paradevs { namespace tests { namespace mixed {
|
|
|
|
|
|
-template < typename T >
|
|
|
-struct Limits
|
|
|
-{
|
|
|
- static constexpr T negative_infinity =
|
|
|
- -std::numeric_limits < T >::infinity();
|
|
|
- static constexpr T positive_infinity =
|
|
|
- std::numeric_limits < T >::infinity();
|
|
|
- static constexpr T null = 0;
|
|
|
-};
|
|
|
-
|
|
|
-typedef paradevs::common::Time < double, Limits < double > > MyTime;
|
|
|
-
|
|
|
template < class SchedulerHandle>
|
|
|
-class A1 : public paradevs::pdevs::Dynamics < MyTime, SchedulerHandle,
|
|
|
- paradevs::common::NoParameters >
|
|
|
+class A1 :
|
|
|
+ public paradevs::pdevs::Dynamics < common::DoubleTime, SchedulerHandle,
|
|
|
+ paradevs::common::NoParameters >
|
|
|
{
|
|
|
public:
|
|
|
A1(const std::string& name,
|
|
|
const paradevs::common::NoParameters& parameters) :
|
|
|
- paradevs::pdevs::Dynamics < MyTime, SchedulerHandle,
|
|
|
+ paradevs::pdevs::Dynamics < common::DoubleTime, SchedulerHandle,
|
|
|
paradevs::common::NoParameters >(
|
|
|
name, parameters)
|
|
|
{ }
|
|
|
virtual ~A1()
|
|
|
{ }
|
|
|
|
|
|
- void dint(typename MyTime::type t)
|
|
|
+ void dint(typename common::DoubleTime::type t)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -70,10 +59,10 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace() <<
|
|
|
- common::TraceElement < MyTime >(get_name(), t,
|
|
|
+ common::Trace < common::DoubleTime >::trace() <<
|
|
|
+ common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
common::DELTA_INT);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
if (_phase == SEND) {
|
|
@@ -81,8 +70,9 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void dext(typename MyTime::type t, typename MyTime::type /* e */,
|
|
|
- const common::Bag < MyTime, SchedulerHandle >& msgs)
|
|
|
+ void dext(typename common::DoubleTime::type t,
|
|
|
+ typename common::DoubleTime::type /* e */,
|
|
|
+ const common::Bag < common::DoubleTime, SchedulerHandle >& msgs)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -91,18 +81,19 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::DELTA_EXT)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::DELTA_EXT)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
_phase = SEND;
|
|
|
}
|
|
|
|
|
|
- void dconf(typename MyTime::type t, typename MyTime::type /* e */,
|
|
|
- const common::Bag < MyTime, SchedulerHandle >& msgs)
|
|
|
+ void dconf(typename common::DoubleTime::type t,
|
|
|
+ typename common::DoubleTime::type /* e */,
|
|
|
+ const common::Bag < common::DoubleTime, SchedulerHandle >& msgs)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -111,15 +102,15 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::DELTA_CONF)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::DELTA_CONF)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
- typename MyTime::type start(typename MyTime::type t)
|
|
|
+ typename common::DoubleTime::type start(typename common::DoubleTime::type t)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -127,26 +118,27 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::START);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::START);
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
_phase = WAIT;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- typename MyTime::type ta(typename MyTime::type t) const
|
|
|
+ typename common::DoubleTime::type ta(
|
|
|
+ typename common::DoubleTime::type t) const
|
|
|
{
|
|
|
#ifndef WITH_TRACE
|
|
|
(void)t;
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::TA);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::TA);
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
if (_phase == WAIT) {
|
|
|
return 1;
|
|
@@ -155,25 +147,25 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- common::Bag < MyTime, SchedulerHandle > lambda(
|
|
|
- typename MyTime::type t) const
|
|
|
+ common::Bag < common::DoubleTime, SchedulerHandle > lambda(
|
|
|
+ typename common::DoubleTime::type t) const
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
|
(void)t;
|
|
|
#endif
|
|
|
|
|
|
- common::Bag < MyTime, SchedulerHandle > msgs;
|
|
|
+ common::Bag < common::DoubleTime, SchedulerHandle > msgs;
|
|
|
|
|
|
- msgs.push_back(common::ExternalEvent < MyTime, SchedulerHandle >(
|
|
|
- "out", 0.));
|
|
|
+ msgs.push_back(common::ExternalEvent < common::DoubleTime,
|
|
|
+ SchedulerHandle >("out", 0.));
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::LAMBDA)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::LAMBDA)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
return msgs;
|
|
@@ -186,20 +178,21 @@ private:
|
|
|
};
|
|
|
|
|
|
template < class SchedulerHandle>
|
|
|
-class B1 : public paradevs::pdevs::Dynamics < MyTime, SchedulerHandle,
|
|
|
- paradevs::common::NoParameters >
|
|
|
+class B1 :
|
|
|
+ public paradevs::pdevs::Dynamics < common::DoubleTime, SchedulerHandle,
|
|
|
+ paradevs::common::NoParameters >
|
|
|
{
|
|
|
public:
|
|
|
B1(const std::string& name,
|
|
|
const paradevs::common::NoParameters& parameters) :
|
|
|
- paradevs::pdevs::Dynamics < MyTime, SchedulerHandle,
|
|
|
+ paradevs::pdevs::Dynamics < common::DoubleTime, SchedulerHandle,
|
|
|
paradevs::common::NoParameters >(
|
|
|
name, parameters)
|
|
|
{ }
|
|
|
virtual ~B1()
|
|
|
{ }
|
|
|
|
|
|
- void dint(typename MyTime::type t)
|
|
|
+ void dint(typename common::DoubleTime::type t)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -207,10 +200,10 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::DELTA_INT);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::DELTA_INT);
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
if (_phase == SEND) {
|
|
@@ -218,8 +211,9 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void dext(typename MyTime::type t, typename MyTime::type /* e */,
|
|
|
- const common::Bag < MyTime, SchedulerHandle >& msgs)
|
|
|
+ void dext(typename common::DoubleTime::type t,
|
|
|
+ typename common::DoubleTime::type /* e */,
|
|
|
+ const common::Bag < common::DoubleTime, SchedulerHandle >& msgs)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -228,36 +222,37 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::DELTA_EXT)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::DELTA_EXT)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
_phase = SEND;
|
|
|
}
|
|
|
|
|
|
- void dconf(typename MyTime::type t, typename MyTime::type /* e */,
|
|
|
- const common::Bag < MyTime, SchedulerHandle >& msgs)
|
|
|
+ void dconf(typename common::DoubleTime::type t,
|
|
|
+ typename common::DoubleTime::type /* e */,
|
|
|
+ const common::Bag < common::DoubleTime, SchedulerHandle >& msgs)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
|
- (void)t;
|
|
|
- (void)msgs;
|
|
|
+ (void)t;
|
|
|
+ (void)msgs;
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::DELTA_CONF)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::DELTA_CONF)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
- typename MyTime::type start(typename MyTime::type t)
|
|
|
+ typename common::DoubleTime::type start(typename common::DoubleTime::type t)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -265,17 +260,18 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::START);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::START);
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
_phase = WAIT;
|
|
|
return std::numeric_limits < double >::max();
|
|
|
}
|
|
|
|
|
|
- typename MyTime::type ta(typename MyTime::type t) const
|
|
|
+ typename common::DoubleTime::type ta(
|
|
|
+ typename common::DoubleTime::type t) const
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -283,10 +279,10 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::TA);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::TA);
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
if (_phase == WAIT) {
|
|
@@ -296,24 +292,24 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- common::Bag < MyTime, SchedulerHandle > lambda(
|
|
|
- typename MyTime::type t) const
|
|
|
+ common::Bag < common::DoubleTime, SchedulerHandle > lambda(
|
|
|
+ typename common::DoubleTime::type t) const
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
|
(void)t;
|
|
|
#endif
|
|
|
- common::Bag < MyTime, SchedulerHandle > msgs;
|
|
|
+ common::Bag < common::DoubleTime, SchedulerHandle > msgs;
|
|
|
|
|
|
- msgs.push_back(common::ExternalEvent < MyTime, SchedulerHandle >(
|
|
|
- "out", t));
|
|
|
+ msgs.push_back(common::ExternalEvent < common::DoubleTime,
|
|
|
+ SchedulerHandle >("out", t));
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::LAMBDA)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::LAMBDA)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
return msgs;
|
|
@@ -326,21 +322,22 @@ private:
|
|
|
};
|
|
|
|
|
|
template < class SchedulerHandle >
|
|
|
-class A2 : public paradevs::dtss::Dynamics < MyTime, SchedulerHandle >
|
|
|
+class A2 :
|
|
|
+ public paradevs::dtss::Dynamics < common::DoubleTime, SchedulerHandle >
|
|
|
{
|
|
|
public:
|
|
|
A2(const std::string& name,
|
|
|
const paradevs::common::NoParameters& parameters) :
|
|
|
- paradevs::dtss::Dynamics <
|
|
|
- MyTime, SchedulerHandle,
|
|
|
- paradevs::common::NoParameters >(name, parameters)
|
|
|
+ paradevs::dtss::Dynamics < common::DoubleTime, SchedulerHandle,
|
|
|
+ paradevs::common::NoParameters >(
|
|
|
+ name, parameters)
|
|
|
{ }
|
|
|
virtual ~A2()
|
|
|
{ }
|
|
|
|
|
|
void transition(
|
|
|
- const common::Bag < MyTime, SchedulerHandle >& x,
|
|
|
- typename MyTime::type t)
|
|
|
+ const common::Bag < common::DoubleTime, SchedulerHandle >& x,
|
|
|
+ typename common::DoubleTime::type t)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -349,16 +346,16 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::DELTA_INT)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::DELTA_INT)
|
|
|
<< "x = " << x.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
- typename MyTime::type start(typename MyTime::type t)
|
|
|
+ typename common::DoubleTime::type start(typename common::DoubleTime::type t)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -366,33 +363,34 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::START);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::START);
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- common::Bag < MyTime, SchedulerHandle > lambda(
|
|
|
- typename MyTime::type t) const
|
|
|
+ common::Bag < common::DoubleTime, SchedulerHandle > lambda(
|
|
|
+ typename common::DoubleTime::type t) const
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
|
(void)t;
|
|
|
#endif
|
|
|
- common::Bag < MyTime, SchedulerHandle > msgs;
|
|
|
+ common::Bag < common::DoubleTime, SchedulerHandle > msgs;
|
|
|
|
|
|
msgs.push_back(
|
|
|
- common::ExternalEvent < MyTime, SchedulerHandle >( "out", 0.));
|
|
|
+ common::ExternalEvent < common::DoubleTime,
|
|
|
+ SchedulerHandle >( "out", 0.));
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::LAMBDA)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::LAMBDA)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
return msgs;
|
|
@@ -400,21 +398,22 @@ public:
|
|
|
};
|
|
|
|
|
|
template < class SchedulerHandle >
|
|
|
-class B2 : public paradevs::dtss::Dynamics < MyTime, SchedulerHandle >
|
|
|
+class B2 :
|
|
|
+ public paradevs::dtss::Dynamics < common::DoubleTime, SchedulerHandle >
|
|
|
{
|
|
|
public:
|
|
|
B2(const std::string& name,
|
|
|
const paradevs::common::NoParameters& parameters) :
|
|
|
- paradevs::dtss::Dynamics <
|
|
|
- MyTime, SchedulerHandle,
|
|
|
- paradevs::common::NoParameters >(name, parameters)
|
|
|
+ paradevs::dtss::Dynamics < common::DoubleTime, SchedulerHandle,
|
|
|
+ paradevs::common::NoParameters >(
|
|
|
+ name, parameters)
|
|
|
{ }
|
|
|
virtual ~B2()
|
|
|
{ }
|
|
|
|
|
|
void transition(
|
|
|
- const common::Bag < MyTime, SchedulerHandle >& x,
|
|
|
- typename MyTime::type t)
|
|
|
+ const common::Bag < common::DoubleTime, SchedulerHandle >& x,
|
|
|
+ typename common::DoubleTime::type t)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -423,16 +422,16 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::DELTA_INT)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::DELTA_INT)
|
|
|
<< "x = " << x.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
- typename MyTime::type start(typename MyTime::type t)
|
|
|
+ typename common::DoubleTime::type start(typename common::DoubleTime::type t)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -440,33 +439,34 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::START);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::START);
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- common::Bag < MyTime, SchedulerHandle > lambda(
|
|
|
- typename MyTime::type t) const
|
|
|
+ common::Bag < common::DoubleTime, SchedulerHandle > lambda(
|
|
|
+ typename common::DoubleTime::type t) const
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
|
(void)t;
|
|
|
#endif
|
|
|
- common::Bag < MyTime, SchedulerHandle > msgs;
|
|
|
+ common::Bag < common::DoubleTime, SchedulerHandle > msgs;
|
|
|
|
|
|
msgs.push_back(
|
|
|
- common::ExternalEvent < MyTime, SchedulerHandle >("out", 0.));
|
|
|
+ common::ExternalEvent < common::DoubleTime,
|
|
|
+ SchedulerHandle >("out", 0.));
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::LAMBDA)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::LAMBDA)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
return msgs;
|
|
@@ -474,20 +474,21 @@ public:
|
|
|
};
|
|
|
|
|
|
template < class SchedulerHandle>
|
|
|
-class Beep : public paradevs::pdevs::Dynamics < MyTime, SchedulerHandle,
|
|
|
- paradevs::common::NoParameters >
|
|
|
+class Beep :
|
|
|
+ public paradevs::pdevs::Dynamics < common::DoubleTime, SchedulerHandle,
|
|
|
+ paradevs::common::NoParameters >
|
|
|
{
|
|
|
public:
|
|
|
Beep(const std::string& name,
|
|
|
const paradevs::common::NoParameters& parameters) :
|
|
|
- paradevs::pdevs::Dynamics < MyTime, SchedulerHandle,
|
|
|
+ paradevs::pdevs::Dynamics < common::DoubleTime, SchedulerHandle,
|
|
|
paradevs::common::NoParameters >(name,
|
|
|
parameters)
|
|
|
{ }
|
|
|
virtual ~Beep()
|
|
|
{ }
|
|
|
|
|
|
- void dint(typename MyTime::type t)
|
|
|
+ void dint(typename common::DoubleTime::type t)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -495,10 +496,10 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace() <<
|
|
|
- common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::DELTA_INT);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace() <<
|
|
|
+ common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::DELTA_INT);
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
if (_phase == SEND) {
|
|
@@ -506,8 +507,9 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void dext(typename MyTime::type t, typename MyTime::type /* e */,
|
|
|
- const common::Bag < MyTime, SchedulerHandle >& msgs)
|
|
|
+ void dext(typename common::DoubleTime::type t,
|
|
|
+ typename common::DoubleTime::type /* e */,
|
|
|
+ const common::Bag < common::DoubleTime, SchedulerHandle >& msgs)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -516,18 +518,19 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::DELTA_EXT)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::DELTA_EXT)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
_phase = SEND;
|
|
|
}
|
|
|
|
|
|
- void dconf(typename MyTime::type t, typename MyTime::type /* e */,
|
|
|
- const common::Bag < MyTime, SchedulerHandle >& msgs)
|
|
|
+ void dconf(typename common::DoubleTime::type t,
|
|
|
+ typename common::DoubleTime::type /* e */,
|
|
|
+ const common::Bag < common::DoubleTime, SchedulerHandle >& msgs)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -536,16 +539,16 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::DELTA_CONF)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::DELTA_CONF)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
- typename MyTime::type start(typename MyTime::type t)
|
|
|
+ typename common::DoubleTime::type start(typename common::DoubleTime::type t)
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -553,17 +556,18 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::START);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::START);
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
_phase = WAIT;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- typename MyTime::type ta(typename MyTime::type t) const
|
|
|
+ typename common::DoubleTime::type ta(
|
|
|
+ typename common::DoubleTime::type t) const
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
@@ -571,10 +575,10 @@ public:
|
|
|
#endif
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::TA);
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::TA);
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
if (_phase == WAIT) {
|
|
@@ -584,24 +588,24 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- common::Bag < MyTime, SchedulerHandle > lambda(
|
|
|
- typename MyTime::type t) const
|
|
|
+ common::Bag < common::DoubleTime, SchedulerHandle > lambda(
|
|
|
+ typename common::DoubleTime::type t) const
|
|
|
{
|
|
|
|
|
|
#ifndef WITH_TRACE
|
|
|
(void)t;
|
|
|
#endif
|
|
|
- common::Bag < MyTime, SchedulerHandle > msgs;
|
|
|
+ common::Bag < common::DoubleTime, SchedulerHandle > msgs;
|
|
|
|
|
|
- msgs.push_back(common::ExternalEvent < MyTime, SchedulerHandle >(
|
|
|
- "out", 0.));
|
|
|
+ msgs.push_back(common::ExternalEvent < common::DoubleTime,
|
|
|
+ SchedulerHandle >("out", 0.));
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
- common::Trace < MyTime >::trace()
|
|
|
- << common::TraceElement < MyTime >(get_name(), t,
|
|
|
- common::LAMBDA)
|
|
|
+ common::Trace < common::DoubleTime >::trace()
|
|
|
+ << common::TraceElement < common::DoubleTime >(get_name(), t,
|
|
|
+ common::LAMBDA)
|
|
|
<< "messages = " << msgs.to_string();
|
|
|
- common::Trace < MyTime >::trace().flush();
|
|
|
+ common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
return msgs;
|