adevs
Public Member Functions
adevs::ModelWrapper Class Reference

#include <adevs_wrapper.h>

Inheritance diagram for adevs::ModelWrapper:
adevs::Atomic< ExternalType, T > adevs::EventListener< InternalType, T >

List of all members.

Public Member Functions

 ModelWrapper (Devs< InternalType, T > *model)
virtual void translateInput (const Bag< ExternalType > &external_input, Bag< Event< InternalType, T > > &internal_input)=0
virtual void translateOutput (const Bag< Event< InternalType, T > > &internal_output, Bag< ExternalType > &external_output)=0
virtual void gc_input (Bag< Event< InternalType, T > > &g)=0
Devs< InternalType, T > * getWrappedModel ()
 Get the model that is wrapped by this object.
void delta_int ()
 Atomic internal transition function.
void delta_ext (T 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.
ta ()
 Atomic time advance function.
void outputEvent (Event< InternalType, T > y, T t)
 EventListener outputEvent method.
 ~ModelWrapper ()
 Destructor. This destroys the wrapped model too.

Detailed Description

This class wraps a Network or Atomic model with interface type InternalType in an Atomic model with interface type ExternalType. Input to the ModelWrapper is passed through a user provided input translation method before being handed off to the wrapped model for processing. Output from the wrapped model is passed through a user provided output translation method before emerging as output from the ModelWrapper. If the wrapped model is a Network, the input translation method can create inputs for any of its components. Similarly the output translation method is provided with every output produced by every component in the Network. If the wrapped model is Atomic then there is, of course, only one possible destination for incoming events and only one source of outgoing events.

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.


Constructor & Destructor Documentation

adevs::ModelWrapper::ModelWrapper ( Devs< InternalType, T > *  model)

Create a wrapper for the specified model. The ModelWrapper takes ownership of the supplied model and will delete it when the ModelWrapper is deleted.


Member Function Documentation

virtual void adevs::ModelWrapper::gc_input ( Bag< Event< InternalType, T > > &  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.

virtual void adevs::ModelWrapper::translateInput ( const Bag< ExternalType > &  external_input,
Bag< Event< InternalType, T > > &  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.

virtual void adevs::ModelWrapper::translateOutput ( const Bag< Event< InternalType, T > > &  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.


The documentation for this class was generated from the following file: