adevs
Public Member Functions | List of all members
adevs::SimEnv< DataType, TimeType > Class Template Referenceabstract

Interface to a simulation context for sending messages, getting the time, and adding or removing models. More...

#include <adevs_base.h>

Inheritance diagram for adevs::SimEnv< DataType, TimeType >:
adevs::Simulator< DataType, TimeType >

Public Member Functions

virtual void send (Model< DataType, TimeType > *src, Model< DataType, TimeType > *dst, DataType data)=0
 Send a message to a model. More...
 
virtual void add (Model< DataType, TimeType > *model)=0
 Add a model to the simulator. More...
 
virtual void remove (Model< DataType, TimeType > *model)=0
 Remove a model from a running simulation. More...
 
virtual TimeType now ()=0
 Get the current time.
 
virtual ~SimEnv ()
 Destructor.
 

Detailed Description

template<typename DataType, typename TimeType = Time>
class adevs::SimEnv< DataType, TimeType >

Interface to a simulation context for sending messages, getting the time, and adding or removing models.

The simulation context passed to the Model update() and init() method is the same context to which the Model was added. The first template argument is the data type of a message and the second is the type to use for time.

Member Function Documentation

◆ add()

template<typename DataType, typename TimeType = Time>
virtual void adevs::SimEnv< DataType, TimeType >::add ( Model< DataType, TimeType > *  model)
pure virtual

Add a model to the simulator.

This method causes the new model to be assigned a state via Model::init(SimEnv*) at time now(). The model being added cannot already be active in the simulation.

Parameters
modelThe model to add to the simulation

Implemented in adevs::Simulator< DataType, TimeType >.

Referenced by adevs::Atomic< DataType, TimeType >::add(), and adevs::Model< port_value< DataType >, TimeType >::reset().

◆ remove()

template<typename DataType, typename TimeType = Time>
virtual void adevs::SimEnv< DataType, TimeType >::remove ( Model< DataType, TimeType > *  model)
pure virtual

Remove a model from a running simulation.

The model is removed at time now()+adevs_epsilon(). At that instant its Model::fini() method is called.

Parameters
modelThe model to remove

Implemented in adevs::Simulator< DataType, TimeType >.

◆ send()

template<typename DataType, typename TimeType = Time>
virtual void adevs::SimEnv< DataType, TimeType >::send ( Model< DataType, TimeType > *  src,
Model< DataType, TimeType > *  dst,
DataType  data 
)
pure virtual

Send a message to a model.

Send a message that will be delivered via the destination's update method at now()+adevs_epsilon().

Parameters
srcWho is sending the message?
dstWho will receive the message?
dataThe data to transmit

Implemented in adevs::Simulator< DataType, TimeType >.

Referenced by adevs::Model< port_value< DataType >, TimeType >::reset(), and adevs::Atomic< DataType, TimeType >::update().


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