adevs
Public Member Functions | List of all members
adevs::ModelWrapper< ExternalType, InternalType, T > Class Template Referenceabstract

#include <adevs_wrapper.h>

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

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.
 
- Public Member Functions inherited from adevs::Atomic< ExternalType, T >
 Atomic ()
 The constructor should place the model into its initial state.
 
virtual void gc_output (Bag< ExternalType > &g)=0
 
virtual void beginLookahead ()
 
virtual void endLookahead ()
 
virtual ~Atomic ()
 Destructor.
 
Atomic< ExternalType, T > * typeIsAtomic ()
 Returns a pointer to this model.
 
- Public Member Functions inherited from adevs::Devs< ExternalType, T >
 Devs ()
 Default constructor.
 
virtual ~Devs ()
 Destructor.
 
virtual Network< ExternalType,
T > * 
typeIsNetwork ()
 
const Network< ExternalType, T > * getParent () const
 
Network< ExternalType, T > * getParent ()
 
void setParent (Network< ExternalType, T > *parent)
 
virtual bool model_transition ()
 
virtual T lookahead ()
 
void setProc (int proc)
 
int getProc ()
 
- Public Member Functions inherited from adevs::EventListener< InternalType, T >
virtual void stateChange (Atomic< InternalType, T > *model, T t)
 
virtual ~EventListener ()
 Destructor.
 

Additional Inherited Members

- Protected Member Functions inherited from adevs::Atomic< ExternalType, T >
getLastEventTime () const
 

Detailed Description

template<typename ExternalType, typename InternalType, class T = double>
class adevs::ModelWrapper< ExternalType, InternalType, T >

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

template<typename ExternalType , typename InternalType , class T >
adevs::ModelWrapper< ExternalType, InternalType, T >::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.

References adevs::AbstractSimulator< X, T >::addEventListener().

Member Function Documentation

template<typename ExternalType , typename InternalType , class T = double>
virtual void adevs::ModelWrapper< ExternalType, InternalType, T >::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.

template<typename ExternalType , typename InternalType , class T = double>
virtual void adevs::ModelWrapper< ExternalType, InternalType, T >::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.

template<typename ExternalType , typename InternalType , class T = double>
virtual void adevs::ModelWrapper< ExternalType, InternalType, T >::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: