VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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. Calling tick() on the system results in tick() being called on all the components of the system. A system may also contain other systems.

Inheritance diagram for DtComponentSystem:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

 DtComponentSystem (DtLocalObject *owner, DtSimulationServices *simManager, const DtComponentSystemDescriptor *desc, DtComponentSystem *parentSystem)
 
virtual ~DtComponentSystem ()
 
virtual bool init ()
 
virtual bool initializeFromDescriptor (int &priority, bool remoteOnly)
 
virtual bool postAddComponentsInit ()
 
virtual void tick ()
 
virtual DtString name () const
 
virtual DtString fullName () const
 
virtual DtString systemName () const
 
virtual DtString printName () const
 
virtual void setPrintName (const DtString &name)
 
virtual DtComponentSystemlookupSystem (const DtString &printName)
 
virtual DtComponentSystemlookupSystemFromRwName (const DtString &rwName)
 
virtual DtComponentSystemlookupSystemFromFullName (const DtString &fullName)
 
virtual void getSystemNames (std::list< std::string > &nameList) const
 
virtual
DtVrfProcessStateRepositoryManager
processStateRepositoryManager ()
 
virtual void restoreResources ()
 
virtual DtComponentSystemPSRprocessStateRepository ()
 
virtual DtSimComponentNetworkcomponentNetwork ()
 
virtual const
DtSimComponentNetwork
componentNetwork () const
 
virtual DtSimResourceManagerresourceManager ()
 
virtual const
DtSimResourceManager
resourceManager () const
 
virtual void resolveSystemOutput (const DtString &outputName, DtComponentPortList &componentOutputs)
 
virtual void resolveSystemInput (const DtString &inputName, DtComponentPortList &componentInputs)
 
virtual void enable ()
 
virtual void disable ()
 
virtual bool isEnabled () const
 
virtual void setIsEnabled (bool yesNo)
 
virtual bool canBeDisabled () const
 
virtual bool addAttributeProviderFunction (const DtString &attributeName, genericAttributeProviderFunctionType attributeFunction, void *controller)
 
virtual bool addAttributeSetFunction (const DtString &attributeName, genericAttributeSetterFunctionType attributeFunction, void *controller)
 
virtual DtReaderWritergetAttribute (const DtString &attributeName, bool &error) const
 
virtual bool setAttribute (const DtString &attributeName, DtReaderWriter *value)
 
virtual std::list< std::string > getAllAttributeNames () const
 
virtual void setUseParentSystemResourceManager (bool)
 
virtual bool useParentSystemResourceManager () const
 

Protected Member Functions

virtual bool createPsr ()
 
void removeCompatibilityPsrs ()
 
virtual void restore (DtSimComponentList *)
 

Protected Attributes

const DtComponentSystemDescriptormySystemDescriptor
 
DtSimulationServicesmySimManager
 
DtLocalObjectmyVrfObject
 
DtSimComponentNetworkmyComponentNetwork
 
DtComponentSystemPSRmyProcessStateRepository
 
DtComponentSystemmyParentSystem
 
DtString myPrintName
 
std::map< DtString, std::pair
< genericAttributeProviderFunctionType,
void * > > 
myReadableAttributes
 
std::map< DtString, std::pair
< genericAttributeSetterFunctionType,
void * > > 
myWritableAttributes
 
std::list< std::pair< DtString,
DtVrfProcessStateRepositoryManager * > > 
myAddedCompatibilityPsrs
 
bool myUseParentSystemResourceManager
 
DtPlatformLocalObjectFacade myPlatformLocalObjectFacade
 

Private Member Functions

 DtComponentSystem ()
 
 DtComponentSystem (const DtComponentSystem &orig)
 
DtComponentSystemoperator= (const DtComponentSystem &orig)
 

Member Typedef Documentation

Constructor & Destructor Documentation

DtComponentSystem::DtComponentSystem ( )
private

Not Implemented.

DtComponentSystem::DtComponentSystem ( const DtComponentSystem orig)
private

Not Implemented.

DtComponentSystem::DtComponentSystem ( DtLocalObject owner,
DtSimulationServices 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,
bool  remoteOnly 
)
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.

Parameters
remoteOnlyIf true, then only components configured for remote objects are created.
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::systemName ( ) const
virtual
Returns
The name of this system from the system descriptor
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 void DtComponentSystem::setPrintName ( const DtString name)
virtual

Sets the print name of the system. This function can be used by components that have customizable display names in their descriptors, e.g. the range ring names for guns. The customizable names may be important for identifying the system if more than one system of the same type is included on an entity.

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 DtComponentSystem* DtComponentSystem::lookupSystemFromFullName ( const DtString fullName)
virtual

Finds a system within this system that matches the given name. This tests the given name against the full name rather than the leaf name of the system. If this system matches, it s returned; otherwise, the systems in the component network are checked recursively.

Returns
the first component system inside this one whose full name matches the given 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 ( ) const
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::canBeDisabled ( ) const
virtual

Check if the system can be disabled.

virtual bool DtComponentSystem::addAttributeProviderFunction ( const 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 ( const 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. It should return True if there is an error.

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 there was an error (i.e., the attribute does not exist; false if the "set" was successful.
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 DtComponentSystemPSR* DtComponentSystem::processStateRepository ( )
virtual

Returns the process state repository used by this system.

virtual void DtComponentSystem::setUseParentSystemResourceManager ( bool  )
virtual

Accessor/mutator for myUseParentSystemResourceManager.

virtual bool DtComponentSystem::useParentSystemResourceManager ( ) const
virtual

Accessor/mutator for myUseParentSystemResourceManager.

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.

virtual void DtComponentSystem::restore ( DtSimComponentList )
protectedvirtual

Iterates over all components and calls onRestore on them.

Member Data Documentation

const DtComponentSystemDescriptor* DtComponentSystem::mySystemDescriptor
protected
DtSimulationServices* DtComponentSystem::mySimManager
protected
DtLocalObject* DtComponentSystem::myVrfObject
protected
DtSimComponentNetwork* DtComponentSystem::myComponentNetwork
protected
DtComponentSystemPSR* DtComponentSystem::myProcessStateRepository
protected
DtComponentSystem* DtComponentSystem::myParentSystem
protected
DtString DtComponentSystem::myPrintName
protected

A customized print name, if one was specified. Initialized by a component, or defaults to print name in metadata.

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.

bool DtComponentSystem::myUseParentSystemResourceManager
protected

If this is true uses the paren system's resource manager. By default is false. This is done such that systems included as part of the new template system can be backwards compatible with existing scenario and scripts by adding the resources to the parent system rather than it's own, which is what is done pre 4.7. This means that without this flag, if a system includes another system that has a resource manager (i.e. a Hellfile) the resource would be listes as weapon|laser-guides|Hellfire rather than what is used to be which is weapon|Hellfire.

DtPlatformLocalObjectFacade DtComponentSystem::myPlatformLocalObjectFacade
protected

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

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)