adevs
Public Member Functions | List of all members
adevs::Devs< X, T > Class Template Reference

#include <adevs_models.h>

Inheritance diagram for adevs::Devs< X, T >:
adevs::Atomic< X, T > adevs::Network< X, T > adevs::Hybrid< X, T > adevs::MealyAtomic< X, T >

Public Member Functions

 Devs ()
 Default constructor.
 
virtual ~Devs ()
 Destructor.
 
virtual Network< X, T > * typeIsNetwork ()
 
virtual Atomic< X, T > * typeIsAtomic ()
 Returns NULL if this is not an atomic model; returns itself otherwise.
 
virtual MealyAtomic< X, T > * typeIsMealyAtomic ()
 Returns NULL if this is not a mealy atomic model; returns itself otherwise.
 
const Network< X, T > * getParent () const
 
Network< X, T > * getParent ()
 
void setParent (Network< X, T > *parent)
 
virtual bool model_transition ()
 

Detailed Description

template<typename X, typename T = double>
class adevs::Devs< X, T >

The Devs class provides basic operations for all devs models. The model I/O type is set by the template argument X. The type to be used for time is set with the template argument T. The default type for time is double.

Member Function Documentation

template<typename X, typename T = double>
const Network<X,T>* adevs::Devs< X, T >::getParent ( ) const
inline

Get the model that contains this model as a component. Returns NULL if this model is at the top of the hierarchy.

Referenced by adevs::Simulator< InternalType, T >::addModel(), adevs::Simulator< X, T >::computeNextOutput(), adevs::Simulator< X, T >::computeNextState(), and adevs::Devs< PortValue< VALUE, PORT >, T >::getParent().

template<typename X, typename T = double>
virtual bool adevs::Devs< X, T >::model_transition ( )
inlinevirtual

This is the structure transition function, which is evaluated following every change of the model's state. It should return true if a structure change is to occur, and false otherwise. False is the default return value. This method is used by the simulator to limit the execution of potentially expensive structure changes. If the return value is true, then the parent's model_transition() will also be evaluated. For network models, the model_transition() function is preceded and anteceded by a call to getComponents(). The difference of these two sets is used to determine if any models were added or removed as part of the model transition.

Referenced by adevs::Simulator< X, T >::computeNextState().

template<typename X, typename T = double>
void adevs::Devs< X, T >::setParent ( Network< X, T > *  parent)
inline

Assign a new parent to this model. Network model's should always call this method to make themselves the parent of their components. If the parent is not set correctly, then the event routing algorithm in the simulator will fail.

Referenced by adevs::SimpleDigraph< VALUE, T >::add(), adevs::CellSpace< X, T >::add(), and adevs::Digraph< VALUE, PORT, T >::add().

template<typename X, typename T = double>
virtual Network<X,T>* adevs::Devs< X, T >::typeIsNetwork ( )
inlinevirtual

Returns NULL if this is not a network model; returns a pointer to itself otherwise. This method is used to avoid a relatively expensive dynamic cast.

Reimplemented in adevs::Network< X, T >, adevs::Network< InternalType, T >, adevs::Network< ExternalType, T >, adevs::Network< CellEvent< X >, T >, adevs::Network< X, double >, adevs::Network< VALUE, T >, and adevs::Network< PortValue< VALUE, PORT >, T >.

Referenced by adevs::Simulator< X, T >::computeNextState().


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