31 #ifndef __adevs_wrapper_h_
32 #define __adevs_wrapper_h_
33 #include "adevs_models.h"
54 template <
typename ExternalType,
typename InternalType,
class T =
double>
class ModelWrapper:
55 public Atomic<ExternalType,T>,
110 ModelWrapper(
const ModelWrapper&){}
111 void operator=(
const ModelWrapper&){}
113 Bag<Event<InternalType,T> > input;
115 Bag<Event<InternalType,T> > output;
117 Devs<InternalType,T>* model;
119 Simulator<InternalType,T>* sim;
124 template <
typename ExternalType,
typename InternalType,
class T>
135 template <
typename ExternalType,
typename InternalType,
class T>
139 tL = sim->nextEventTime();
141 sim->execNextEvent();
144 template <
typename ExternalType,
typename InternalType,
class T>
150 translateInput(xb,input);
152 sim->computeNextState(input,tL);
158 template <
typename ExternalType,
typename InternalType,
class T>
162 tL = sim->nextEventTime();
164 translateInput(xb,input);
166 sim->computeNextState(input,tL);
172 template <
typename ExternalType,
typename InternalType,
class T>
175 if (sim->nextEventTime() < adevs_inf<T>())
return sim->nextEventTime()-tL;
176 else return adevs_inf<T>();
179 template <
typename ExternalType,
typename InternalType,
class T>
183 sim->computeNextOutput();
185 translateOutput(output,yb);
191 template <
typename ExternalType,
typename InternalType,
class T>
198 template <
typename ExternalType,
typename InternalType,
class T>
Definition: adevs_event_listener.h:43
Definition: adevs_wrapper.h:54
virtual void gc_input(Bag< Event< InternalType, T > > &g)=0
void delta_ext(T e, const Bag< ExternalType > &xb)
Atomic external transition function.
Definition: adevs_wrapper.h:145
void delta_conf(const Bag< ExternalType > &xb)
Atomic confluent transition function.
Definition: adevs_wrapper.h:159
virtual void translateInput(const Bag< ExternalType > &external_input, Bag< Event< InternalType, T > > &internal_input)=0
void outputEvent(Event< InternalType, T > y, T t)
EventListener outputEvent method.
Definition: adevs_wrapper.h:192
void output_func(Bag< ExternalType > &yb)
Atomic output function.
Definition: adevs_wrapper.h:180
virtual void translateOutput(const Bag< Event< InternalType, T > > &internal_output, Bag< ExternalType > &external_output)=0
T ta()
Atomic time advance function.
Definition: adevs_wrapper.h:173
void delta_int()
Atomic internal transition function.
Definition: adevs_wrapper.h:136
void addEventListener(EventListener< X, T > *l)
Definition: adevs_abstract_simulator.h:53
Definition: adevs_models.h:47
Devs< InternalType, T > * getWrappedModel()
Get the model that is wrapped by this object.
Definition: adevs_wrapper.h:93
~ModelWrapper()
Destructor. This destroys the wrapped model too.
Definition: adevs_wrapper.h:199