#include <adevs_wrapper.h>
Public Member Functions | |
ModelWrapper (Devs< InternalType > *model) | |
virtual void | translateInput (const Bag< ExternalType > &external_input, Bag< Event< InternalType > > &internal_input)=0 |
virtual void | translateOutput (const Bag< Event< InternalType > > &internal_output, Bag< ExternalType > &external_output)=0 |
virtual void | gc_input (Bag< Event< InternalType > > &g)=0 |
Devs< InternalType > * | getWrappedModel () |
Get the model that is wrapped by this object. | |
void | delta_int () |
Atomic internal transition function. | |
void | delta_ext (double e, const Bag< ExternalType > &xb) |
Atomic external transition function. | |
void | delta_conf (const Bag< ExternalType > &xb) |
Atomic confluent transition function. | |
void | output_func (Bag< ExternalType > &yb) |
Atomic output function. | |
double | ta () |
Atomic time advance function. | |
void | outputEvent (Event< InternalType > y, double t) |
EventListener outputEvent method. | |
~ModelWrapper () | |
Destructor. This destroys the wrapped model too. |
You will need to implement the usual gc_output event for outputs produced by the ModelWrapper. You will also need to implement gcInputEvents method to clean up events that are created during the input translation process.
adevs::ModelWrapper< ExternalType, InternalType >::ModelWrapper | ( | Devs< InternalType > * | model | ) | [inline] |
Create a wrapper for the specified model. The ModelWrapper takes ownership of the supplied model and will delete it when the ModelWrapper is deleted.
References adevs::AbstractSimulator< X >::addEventListener().
virtual void adevs::ModelWrapper< ExternalType, InternalType >::translateInput | ( | const Bag< ExternalType > & | external_input, | |
Bag< Event< InternalType > > & | internal_input | |||
) | [pure virtual] |
This method is used to translate incoming input objects into input objects that the wrapped model can process. The supplied internal_input bag should be filled with Events that contain the targeted internal models and the values to supply to them. The external_input bag contains the input values supplied to the wrapper's external or confluent transition function.
Referenced by adevs::ModelWrapper< ExternalType, InternalType >::delta_conf(), and adevs::ModelWrapper< ExternalType, InternalType >::delta_ext().
virtual void adevs::ModelWrapper< ExternalType, InternalType >::translateOutput | ( | const Bag< Event< InternalType > > & | internal_output, | |
Bag< ExternalType > & | external_output | |||
) | [pure virtual] |
This method is used to translate outgoing output objects into objects that the ModelWrapper can produce. The internal_output bag contains all of the output events that the were produced by the wrapped model. The external_output bag should be filled with objects of type ExternalType that will be produced as output by the ModelWrapper.
Referenced by adevs::ModelWrapper< ExternalType, InternalType >::output_func().
virtual void adevs::ModelWrapper< ExternalType, InternalType >::gc_input | ( | Bag< Event< InternalType > > & | g | ) | [pure virtual] |
This is the garbage collection method for internal input events. It will be called when the wrapper is done with a set of events that you created with the translateInput method. The supplied bag is the same one that you filled out in the translateInput method.
Referenced by adevs::ModelWrapper< ExternalType, InternalType >::delta_conf(), and adevs::ModelWrapper< ExternalType, InternalType >::delta_ext().