VR-Forces 4.2 Class Documentation
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
DtComponentSystem Class Reference

A DtComponentSystem is a collection of DtSimComponents that are associated with each other. More...

Inheritance diagram for DtComponentSystem:
Inheritance graph
[legend]

Public Types

typedef std::list< std::pair
< DtSimComponent *, DtString > > 
DtComponentPortList

Public Member Functions

 DtComponentSystem (DtVrfObject *owner, DtSimManager *simManager, const DtComponentSystemDescriptor *desc, DtComponentSystem *parentSystem)
virtual ~DtComponentSystem ()
virtual bool init ()
virtual bool initializeFromDescriptor (int &priority)
 Creates the components, systems, and resources specified in the descriptor for the system.
virtual bool postAddComponentsInit ()
 Calls DtSimComponent::postAddComponentsInit() on all contained components.
virtual void tick ()
 Calls DtSimCompoennt::tick() on all contained components.
virtual DtString name () const
virtual DtString fullName () const
virtual DtString printName () const
virtual DtComponentSystemlookupSystem (const DtString &printName)
 Finds a system within this system that matches the given print name.
virtual DtComponentSystemlookupSystemFromRwName (const DtString &rwName)
 Finds a system within this system that matches the given name.
virtual void getSystemNames (std::list< std::string > &nameList) const
 Adds the system's print name and the names of all subsystems in this system to the list in nameList.
virtual
DtVrfProcessStateRepositoryManager
processStateRepositoryManager ()
 Provides a list of all of the systems, by print name, in this system.
virtual void restoreResources ()
 Restores resource values to the values specified in the parameters for this system and all child systems.
virtual DtSimComponentNetworkcomponentNetwork ()
virtual const
DtSimComponentNetwork
componentNetwork () const
virtual DtSimResourceManagerresourceManager ()
virtual const
DtSimResourceManager
resourceManager () const
virtual void resolveSystemOutput (const DtString &outputName, DtComponentPortList &componentOutputs)
 Within systems, connections are made from components to "system" or vice versa.
virtual void resolveSystemInput (const DtString &inputName, DtComponentPortList &componentInputs)
 Within systems, connections are made from components to "system" or vice versa.
virtual void enable ()
 Enables/disables components/systems in the system.
virtual void disable ()
 Enables/disables components/systems in the system.
virtual bool isEnabled ()
 Check if the system is enabled, component's tick function will be called, otherwise it will not.
virtual void setIsEnabled (bool yesNo)
 Check if the system is enabled, component's tick function will be called, otherwise it will not.
virtual bool addAttributeProviderFunction (DtString &attributeName, genericAttributeProviderFunctionType attributeFunction, void *controller)
 Functions for defining system attribute functions, and getting attributes.
virtual bool addAttributeSetFunction (DtString &attributeName, genericAttributeSetterFunctionType attributeFunction, void *controller)
 Similar to above, but adds a function to myWritableAttributes.
virtual DtReaderWritergetAttribute (const DtString &attributeName, bool &error) const
 Retrieves the attribute value (by running the function mapped to this attribute).The status of the get is returned in the error parameter.
virtual bool setAttribute (const DtString &attributeName, DtReaderWriter *value)
 Sets the attribute value (by running the function mapped to this attribute).
virtual std::list< std::string > getAllAttributeNames () const
 Gets the names of all of the attributes that have been registered by provider (i.e., Get) functions for this system.

Protected Member Functions

virtual bool createPsr ()
 Creates the PSR and sets it to myProcessStateRepository.
void removeCompatibilityPsrs ()
 Non-virtual because it is called by the destructor.

Protected Attributes

const DtComponentSystemDescriptormySystemDescriptor
DtSimManagermySimManager
DtVrfObjectmyVrfObject
DtSimComponentNetworkmyComponentNetwork
DtComponentSystemPSRmyProcessStateRepository
DtComponentSystemmyParentSystem
std::map< DtString, std::pair
< genericAttributeProviderFunctionType,
void * > > 
myReadableAttributes
 Map of attribute-names to provider-functions.
std::map< DtString, std::pair
< genericAttributeSetterFunctionType,
void * > > 
myWritableAttributes
std::list< std::pair< DtString,
DtVrfProcessStateRepositoryManager * > > 
myAddedCompatibilityPsrs
 This list is kept so the compatibility PSRs can be removed upon destruction.

Private Member Functions

 DtComponentSystem ()
 Not Implemented.
 DtComponentSystem (const DtComponentSystem &orig)
 Not Implemented.
DtComponentSystemoperator= (const DtComponentSystem &orig)
 Not Implemented.

Detailed Description

A DtComponentSystem is a collection of DtSimComponents that are associated with each other.

Calling tick() on the system results in tick() being called on all the components of the system. A system may also contain other systems.

Member Typedef Documentation

Constructor & Destructor Documentation

DtComponentSystem::DtComponentSystem ( )
private

Not Implemented.

DtComponentSystem::DtComponentSystem ( const DtComponentSystem orig)
private

Not Implemented.

DtComponentSystem::DtComponentSystem ( DtVrfObject owner,
DtSimManager simManager,
const DtComponentSystemDescriptor desc,
DtComponentSystem parentSystem 
)
virtual DtComponentSystem::~DtComponentSystem ( )
virtual

Member Function Documentation

DtComponentSystem& DtComponentSystem::operator= ( const DtComponentSystem orig)
private

Not Implemented.

virtual bool DtComponentSystem::init ( )
virtual

Reimplemented in DtTopLevelComponentSystem.

virtual bool DtComponentSystem::initializeFromDescriptor ( int &  priority)
virtual

Creates the components, systems, and resources specified in the descriptor for the system.

The first component is created with the specified priority, and priority is incremented for each component created. The next available priority value is return in priority.

virtual bool DtComponentSystem::postAddComponentsInit ( )
virtual

Calls DtSimComponent::postAddComponentsInit() on all contained components.

virtual void DtComponentSystem::tick ( )
virtual

Calls DtSimCompoennt::tick() on all contained components.

virtual DtString DtComponentSystem::name ( ) const
virtual
Returns
The name that is supplied as the RW name of the system in the system definition.
virtual DtString DtComponentSystem::fullName ( ) const
virtual
Returns
A string that uniquely identifies this system on the entity. This name will be composed of the parent system's full name and this system's name, as returned by name().
virtual DtString DtComponentSystem::printName ( ) const
virtual
Returns
A string that is the human readable print name, i.e. the system name in the metadata.
virtual DtSimComponentNetwork* DtComponentSystem::componentNetwork ( )
virtual
Returns
The component network that is used by this system.
virtual const DtSimComponentNetwork* DtComponentSystem::componentNetwork ( ) const
virtual
Returns
The component network that is used by this system.
virtual DtComponentSystem* DtComponentSystem::lookupSystem ( const DtString printName)
virtual

Finds a system within this system that matches the given print name.

If this system matches, it is returned; otherwise, the systems in the component network are checked recursively.

Returns
the first component system inside this one that matches the name
virtual DtComponentSystem* DtComponentSystem::lookupSystemFromRwName ( const DtString rwName)
virtual

Finds a system within this system that matches the given name.

This function tests the given name against the RW name rather than the print name of the system. If this system matches, it is returned; otherwise, the systems in the component network are checked recursively.

Returns
the first component system inside this one that matches the name
virtual void DtComponentSystem::getSystemNames ( std::list< std::string > &  nameList) const
virtual

Adds the system's print name and the names of all subsystems in this system to the list in nameList.

virtual DtVrfProcessStateRepositoryManager* DtComponentSystem::processStateRepositoryManager ( )
virtual

Provides a list of all of the systems, by print name, in this system.

virtual std::list<DtString> getSubsystemList();

Returns
The process state repository manager that manages all PSRs for this system.
virtual DtSimResourceManager& DtComponentSystem::resourceManager ( )
virtual
Returns
The resource manager for this system. This includes resources for this system only.

Reimplemented in DtTopLevelComponentSystem.

virtual const DtSimResourceManager& DtComponentSystem::resourceManager ( ) const
virtual
Returns
The resource manager for this system. This includes resources for this system only.

Reimplemented in DtTopLevelComponentSystem.

virtual void DtComponentSystem::restoreResources ( )
virtual

Restores resource values to the values specified in the parameters for this system and all child systems.

virtual void DtComponentSystem::resolveSystemOutput ( const DtString outputName,
DtComponentPortList componentOutputs 
)
virtual

Within systems, connections are made from components to "system" or vice versa.

This designates that as a public input/output to the system. External connections can be made to these named connections, which in turn result in a connection down to the actual component within the system. These methods take the system connection name and resolve it to the internal components and ports on those components. Each method fills the second parameter with a list of component pointers and port names on that component that should be connected to.

virtual void DtComponentSystem::resolveSystemInput ( const DtString inputName,
DtComponentPortList componentInputs 
)
virtual

Within systems, connections are made from components to "system" or vice versa.

This designates that as a public input/output to the system. External connections can be made to these named connections, which in turn result in a connection down to the actual component within the system. These methods take the system connection name and resolve it to the internal components and ports on those components. Each method fills the second parameter with a list of component pointers and port names on that component that should be connected to.

virtual void DtComponentSystem::enable ( )
virtual

Enables/disables components/systems in the system.

virtual void DtComponentSystem::disable ( )
virtual

Enables/disables components/systems in the system.

virtual bool DtComponentSystem::isEnabled ( )
virtual

Check if the system is enabled, component's tick function will be called, otherwise it will not.

Default is true (enabled).

virtual void DtComponentSystem::setIsEnabled ( bool  yesNo)
virtual

Check if the system is enabled, component's tick function will be called, otherwise it will not.

Default is true (enabled).

virtual bool DtComponentSystem::addAttributeProviderFunction ( DtString attributeName,
genericAttributeProviderFunctionType  attributeFunction,
void *  controller 
)
virtual

Functions for defining system attribute functions, and getting attributes.

Adds a function that will provide the value of the given attribute. The name-function pair is put in the map myReadableAttributes. The function should create a new DtReaderWriter of the appropriate sub-type (e.g., DtRwInt, DtRwString, etc.) and return a pointer to it. Users of this data are responsible for deleting it. Controllers should call, in their init functions, these functions to register attributes the controllers support. The call in the controller will use their mySystem object.
If there was already a function registered for the same attribute, this add... function will do nothing; i.e. this is not an error. Thus some care must be used in defining attribute names, but usually the registrations work as desired. For example, in a movement system there may be several task controllers all of which use a move-along-route controller that provides a next-waypoint-index attribute (e.g. move-along, patrol-route). If the move-along controller registers to provide the attribute, all derived controllers will fail when they register. However, if all these controllers get the attribute data from the same PSR, the correct information will be returned for patrol-route even if move-along provides the attribute value.

Returns
true if there was an error trying to add this function. false if the entry was inserted in the map successfully.
virtual bool DtComponentSystem::addAttributeSetFunction ( DtString attributeName,
genericAttributeSetterFunctionType  attributeFunction,
void *  controller 
)
virtual

Similar to above, but adds a function to myWritableAttributes.

The function registered here should take a Reader-Writer value and check its type before using its value.

virtual DtReaderWriter* DtComponentSystem::getAttribute ( const DtString attributeName,
bool error 
) const
virtual

Retrieves the attribute value (by running the function mapped to this attribute).The status of the get is returned in the error parameter.

Returns
A pointer to a new DtReaderWriter containing the value of the attribute. This will be NULL if there is some error.
In the error argument–true if there was an error (i.e., the attribute does not exist; false if the query was successful.
virtual bool DtComponentSystem::setAttribute ( const DtString attributeName,
DtReaderWriter value 
)
virtual

Sets the attribute value (by running the function mapped to this attribute).

The value is passed in as a Reader-Writer. This function does not delete the RW.
Note that setting an attribute can be used to trigger actions.

Returns
True if the attribute was set successfully; false if no set function was found for this attribute, or if the value could not be accepted for some reason.
virtual std::list<std::string> DtComponentSystem::getAllAttributeNames ( ) const
virtual

Gets the names of all of the attributes that have been registered by provider (i.e., Get) functions for this system.

virtual bool DtComponentSystem::createPsr ( )
protectedvirtual

Creates the PSR and sets it to myProcessStateRepository.

void DtComponentSystem::removeCompatibilityPsrs ( )
protected

Non-virtual because it is called by the destructor.

Member Data Documentation

const DtComponentSystemDescriptor* DtComponentSystem::mySystemDescriptor
protected
DtSimManager* DtComponentSystem::mySimManager
protected
DtVrfObject* DtComponentSystem::myVrfObject
protected
DtSimComponentNetwork* DtComponentSystem::myComponentNetwork
protected
DtComponentSystemPSR* DtComponentSystem::myProcessStateRepository
protected
DtComponentSystem* DtComponentSystem::myParentSystem
protected
std::map<DtString, std::pair<genericAttributeProviderFunctionType, void*> > DtComponentSystem::myReadableAttributes
protected

Map of attribute-names to provider-functions.

std::map<DtString, std::pair<genericAttributeSetterFunctionType, void*> > DtComponentSystem::myWritableAttributes
protected
std::list< std::pair<DtString, DtVrfProcessStateRepositoryManager*> > DtComponentSystem::myAddedCompatibilityPsrs
protected

This list is kept so the compatibility PSRs can be removed upon destruction.


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

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)