VR-Forces 4.8 Class Documentation
 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. More...

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)
 CTOR. More...
 
virtual ~DtTickableManager ()
 DTOR. More...
 
virtual bool addTickableObject (DtTickable *ticObj)
 Add a DtTickable object to this manager. More...
 
virtual bool addTickableObjectToMainList (DtTickable *ticObj)
 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). More...
 
virtual bool addTickableObjectToThreadSafeList (DtTickable *ticObj)
 Add a tickable to the threaded tickable list. More...
 
virtual void removeTickableObject (DtTickable *ticObj)
 Remove a DtTickable object from this manager. More...
 
virtual void removeTickableObjectFromMainList (DtTickable *ticObj)
 Remove a tickable from this manager's main (unthreaded) tickable list. More...
 
virtual void removeTickableObjectFromThreadSafeList (DtTickable *ticObj)
 Remove a tickable from this manager's thread-safe tickable list. More...
 
virtual void tick (DtTime tNow=0.0)
 Function to update each tick-able object. More...
 
virtual bool inTick ()
 brief returns if the tick manager is currently updating More...
 
virtual int numTickables ()
 brief how many tickables there are total More...
 
virtual int numMultithreadedTickables ()
 brief how many tickables there are, having been filtered by the modelset vector More...
 
virtual int numTickedLastFrame ()
 brief how many tickables were ticked last frame More...
 
virtual double timeSpentThisFrame ()
 brief how long the last update took in seconds More...
 
virtual void setUseAdaptiveTickRate (bool value)
 brief should objects attempt to call setUpdatePeriod on themselves with reasonable values. More...
 
virtual bool useAdaptiveTickRate ()
 brief are objects calling setUpdatePeriod on themselves when they are updated. More...
 
virtual void resetAdaptiveTickrate ()
 brief resets the tickables back to an update period of 1 frame More...
 
virtual void setUseMultithreadUpdate (bool useIt)
 Set the flag that determines whether tickables on the threadsafe list are updated in a parallel_for. More...
 
virtual bool useMultithreadUpdate () const
 Get the flag that determines whether tickables on the threadsafe list are updated in a parallel_for. More...
 
- Public Member Functions inherited from makVrv::DtTickableManagerInterface
virtual ~DtTickableManagerInterface ()
 Virtual DTOR. More...
 

Protected Member Functions

bool addTickableObject (TickableList &array, DtTickable *ticObj)
 adds tickable to the array if it is not already in the list More...
 

Protected Attributes

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

Additional Inherited Members

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

Detailed Description

A base class for managers of DtTickable objects.

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
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 Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)