VR-Forces 5.0.1 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
makVrv::DtTickableManager Class Reference

A base class for managers of DtTickable objects.

Inheritance diagram for makVrv::DtTickableManager:
Inheritance graph
[legend]

Public Types

typedef std::vector< DtTickable * > TickableList
 
typedef std::vector< TickableListTickablesArray
 

Public Member Functions

 DtTickableManager (DtDe &de)
 
virtual ~DtTickableManager ()
 
virtual bool addTickableObject (DtTickable *ticObj)
 
virtual bool addTickableObjectToMainList (DtTickable *ticObj)
 
virtual bool addTickableObjectToThreadSafeList (DtTickable *ticObj)
 
virtual void removeTickableObject (DtTickable *ticObj)
 
virtual void removeTickableObjectFromMainList (DtTickable *ticObj)
 
virtual void removeTickableObjectFromThreadSafeList (DtTickable *ticObj)
 
virtual void tick (DtTime tNow=0.0)
 
virtual bool inTick ()
 
virtual int numTickables ()
 
virtual int numMultithreadedTickables ()
 
virtual int numTickedLastFrame ()
 
virtual double timeSpentThisFrame ()
 
virtual void setUseAdaptiveTickRate (bool value)
 
virtual bool useAdaptiveTickRate ()
 
virtual void resetAdaptiveTickrate ()
 
virtual void setUseMultithreadUpdate (bool useIt)
 
virtual bool useMultithreadUpdate () const
 
- Public Member Functions inherited from makVrv::DtTickableManagerInterface
virtual ~DtTickableManagerInterface ()
 

Protected Member Functions

bool addTickableObject (TickableList &array, DtTickable *ticObj)
 

Protected Attributes

TickableList myTickables
 
TickableList myThreadSafeTickables
 
bool myUseMultithreadUpdate
 
DtSignalConnectionManager myConnections
 
DtTickablemyCurrentTickObject
 
tbb::atomic< boolmyOnTickFlag
 
bool myUseAdaptiveTickRate
 
int myNumTickablesLastFrame
 
DtDemyDe
 
double myTimeSpentThisFrame
 

Additional Inherited Members

- Public Attributes inherited from makVrv::DtTickableManagerInterface
boost::signalslib::signal< void()> signal_aboutToBeDeleted
 

Member Typedef Documentation

Constructor & Destructor Documentation

makVrv::DtTickableManager::DtTickableManager ( DtDe de)

CTOR.

virtual makVrv::DtTickableManager::~DtTickableManager ( )
virtual

DTOR.

Member Function Documentation

virtual bool makVrv::DtTickableManager::addTickableObject ( DtTickable ticObj)
virtual

Add a DtTickable object to this manager.

Parameters
[in]ticObjis a pointer to a tick-able object to add.
Return values
trueif the pointer was successfully added.
falseotherwise.
Note
Objects added to this manager are not destroyed at destruction time of this manager.
Exceptions
DtCorruptedStateif called during tick-update. This call checks DtTickable::isThreadSafe() and places the tickable on the appropriate tickable list

Implements makVrv::DtTickableManagerInterface.

virtual bool makVrv::DtTickableManager::addTickableObjectToMainList ( DtTickable ticObj)
virtual

Add a tickable to the main (not threaded) tickable list Even if a tickable is 'thread safe' we may choose to not place it on the threaded list (mainly because it may be a scene object updater at the head of a not thread safe updater chain). This call checks DtTickable::isThreadSafe() and places the tickable on the appropriate tickable list. This method sets the tickable's tickableListState to DtTickable::TickableOnMainList.

Implements makVrv::DtTickableManagerInterface.

virtual bool makVrv::DtTickableManager::addTickableObjectToThreadSafeList ( DtTickable ticObj)
virtual

Add a tickable to the threaded tickable list. This method checks the tickable's isThreadSafe() method and will not add the tickable to the list if not thread-safe.

Implements makVrv::DtTickableManagerInterface.

virtual void makVrv::DtTickableManager::removeTickableObject ( DtTickable ticObj)
virtual

Remove a DtTickable object from this manager.

Parameters
[in]ticObjis a pointer to a tick-able object to remove.
Exceptions
DtCorruptedStateif called during tick-update. Note: This form is kept for back compatibility. It is inefficient because it needs to check both tickable lists for the tickable to remove. The preferred method is to check the tickable for which list it's on (DtTickable::tickableListState()) and then explicitly remove it from the correct list

Implements makVrv::DtTickableManagerInterface.

virtual void makVrv::DtTickableManager::removeTickableObjectFromMainList ( DtTickable ticObj)
virtual

Remove a tickable from this manager's main (unthreaded) tickable list. This method sets the tickable's tickableListState to DtTickable::TickableNotOnList.

Implements makVrv::DtTickableManagerInterface.

virtual void makVrv::DtTickableManager::removeTickableObjectFromThreadSafeList ( DtTickable ticObj)
virtual

Remove a tickable from this manager's thread-safe tickable list. This method sets the tickable's tickableListState to DtTickable::TickableNotOnList.

Implements makVrv::DtTickableManagerInterface.

virtual void makVrv::DtTickableManager::tick ( DtTime  tNow = 0.0)
virtual

Function to update each tick-able object. Each tick-able object on the main (not threaded) list receives a call to its update() function if its needsUpdate() function returns true. If the myUseMultithreadUpdate is false, tickables on the the thread-safe list are treated the same way. But if the flag is true, a parallel_for is used to call the tickable's updateIfNeeded() method (which currently just combines the call to needsUpdate() and update().

Parameters
[in]tNowis a time-stamp to pass to each object.
Note
The order objects are updated is not guaranteed; but the objects on the multithreaded list will be updated before the tickables on the main list.

Implements makVrv::DtTickableManagerInterface.

virtual bool makVrv::DtTickableManager::inTick ( )
virtual

brief returns if the tick manager is currently updating

Implements makVrv::DtTickableManagerInterface.

virtual int makVrv::DtTickableManager::numTickables ( )
virtual

brief how many tickables there are total

Implements makVrv::DtTickableManagerInterface.

virtual int makVrv::DtTickableManager::numMultithreadedTickables ( )
virtual

brief how many tickables there are, having been filtered by the modelset vector

Implements makVrv::DtTickableManagerInterface.

virtual int makVrv::DtTickableManager::numTickedLastFrame ( )
virtual

brief how many tickables were ticked last frame

Implements makVrv::DtTickableManagerInterface.

virtual double makVrv::DtTickableManager::timeSpentThisFrame ( )
virtual

brief how long the last update took in seconds

Implements makVrv::DtTickableManagerInterface.

virtual void makVrv::DtTickableManager::setUseAdaptiveTickRate ( bool  value)
virtual

brief should objects attempt to call setUpdatePeriod on themselves with reasonable values.

Implements makVrv::DtTickableManagerInterface.

virtual bool makVrv::DtTickableManager::useAdaptiveTickRate ( )
virtual

brief are objects calling setUpdatePeriod on themselves when they are updated.

Implements makVrv::DtTickableManagerInterface.

virtual void makVrv::DtTickableManager::resetAdaptiveTickrate ( )
virtual

brief resets the tickables back to an update period of 1 frame

Implements makVrv::DtTickableManagerInterface.

virtual void makVrv::DtTickableManager::setUseMultithreadUpdate ( bool  useIt)
virtual

Set the flag that determines whether tickables on the threadsafe list are updated in a parallel_for.

Implements makVrv::DtTickableManagerInterface.

virtual bool makVrv::DtTickableManager::useMultithreadUpdate ( ) const
virtual

Get the flag that determines whether tickables on the threadsafe list are updated in a parallel_for.

Implements makVrv::DtTickableManagerInterface.

bool makVrv::DtTickableManager::addTickableObject ( TickableList array,
DtTickable ticObj 
)
protected

adds tickable to the array if it is not already in the list

Member Data Documentation

TickableList makVrv::DtTickableManager::myTickables
protected
TickableList makVrv::DtTickableManager::myThreadSafeTickables
protected
bool makVrv::DtTickableManager::myUseMultithreadUpdate
protected
DtSignalConnectionManager makVrv::DtTickableManager::myConnections
protected
DtTickable* makVrv::DtTickableManager::myCurrentTickObject
protected
tbb::atomic<bool> makVrv::DtTickableManager::myOnTickFlag
protected
bool makVrv::DtTickableManager::myUseAdaptiveTickRate
protected
int makVrv::DtTickableManager::myNumTickablesLastFrame
protected
DtDe& makVrv::DtTickableManager::myDe
protected
double makVrv::DtTickableManager::myTimeSpentThisFrame
protected

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

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)