VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
makVrv::DtBackgroundLoader Class Reference

core singleton that manages loading for all the various DtModel subclasses More...

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

Public Member Functions

 DtBackgroundLoader (DtDe &de)
 
virtual ~DtBackgroundLoader ()
 
virtual void updateQueue (int max_thread_count, int active_threads)
 called from the foreground main event loop moves stuff from the producer queue into the consumer one, manages time and does foreground loading More...
 
virtual DtLoaderHandlequeueForLoad (DtModel *object)
 takes ownership of the handle More...
 
virtual void loadIfPossibleOrAddToQueue (DtModel *object)
 Spawns off task if definition hasn't been loaded yet, otherwise runs the foreground loading code if there's enough time. More...
 
virtual bool hasActiveAsyncTasks () const
 returns true if there are tasks active in the background More...
 
virtual int numModelDefinitionsToIco () const
 used by model preloader to decide if there's data to process More...
 
virtual std::string nextModelDefinitionToIco ()
 name of the next model to look up definition of and process its ICO data. More...
 
virtual int numOfActiveTasks () const
 number of current async tasks running More...
 
virtual void addToAdditionalIcoList (osgUtil::StateToCompile *compile)
 Can be used to add additional ICO objects, not used currently. More...
 
virtual std::list
< osgUtil::StateToCompile * > & 
additionalToIcoList ()
 returns list of additional ICO objects, not used currently. More...
 
virtual bool multithreadedLoadingActive () const
 is the system active or disabled, defaults to on More...
 
virtual void setMultithreadedLoadingActive (bool val)
 controls if the system is active More...
 
DtDede ()
 returns the de More...
 
time management functions

how long the system can spend in the main thread before it's stopped.

defaults to 2 ms

virtual void setForegroundTimeBudget (double budget)
 
virtual void incrementForegroundTime (double time_elapse)
 updates how much time has been spend already, allows per frame adjustment of budget More...
 
virtual bool isForegroundTimeBudgetExpired () const
 returns if foreground time is greater then budget More...
 
virtual double timeSpentThisFrame () const
 returns time spend working in the foreground. More...
 
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 Do nothing constructor. More...
 
virtual ~DtVirtualBaseClass ()
 Virtual do nothing destructor. More...
 

Static Public Member Functions

static DtBackgroundLoaderinstance (DtDe &de)
 Get/create the DtLightPointManager instance. More...
 
static void registerInstance (DtDe &de, DtBackgroundLoader *manager)
 
static const std::string & theClassName ()
 Get the name used to register this class. More...
 

Protected Member Functions

virtual void timedForegroundLoad (DtModel *object)
 runs foreground load code and updates time budgeting. More...
 
virtual void ts_setModelDefinitionLoaded (const std::string &modelDefinition)
 
virtual bool ts_isModelDefinitionLoaded (const std::string &modelDefinition) const
 

Protected Attributes

DtDemyDe
 
boost::mutex myProducerQueueMutex
 
std::list< DtLoaderHandle * > myProducerQueue
 
std::list< DtLoaderHandle * > myForegroundQueue
 
std::list< std::string > myModelDefsToIcoQueue
 
std::list< DtLoaderHandle * > myObjectsFinishedWithTBBTask
 
std::list
< osgUtil::StateToCompile * > 
myAdditionalToIcoList
 
boost::mutex myTaskFinishedMutex
 
std::list< DtLoaderHandle * > myObjectsToForegroundLoad
 
std::map< std::string, boolmyActivelyLoadingModelDefs
 
tbb::atomic< intmyNumberOfActiveTasks
 
double myTimeSpentThisFrame
 
boost::mutex myMutableLoadedDefMapMutex
 
boost::unordered_map
< std::string, bool
myLoadedDefMap
 
double myForegroundTimeBudget
 
bool myMultithreadedLoadingActive
 

Friends

class DtBackgroundLoadAsyncTask
 

Detailed Description

core singleton that manages loading for all the various DtModel subclasses

Constructor & Destructor Documentation

makVrv::DtBackgroundLoader::DtBackgroundLoader ( DtDe de)
virtual makVrv::DtBackgroundLoader::~DtBackgroundLoader ( )
virtual

Member Function Documentation

static DtBackgroundLoader& makVrv::DtBackgroundLoader::instance ( DtDe de)
static

Get/create the DtLightPointManager instance.

use de.registerInstance(DtLightPointManager::theClassName(),) to override the class instance

static void makVrv::DtBackgroundLoader::registerInstance ( DtDe de,
DtBackgroundLoader manager 
)
static
static const std::string& makVrv::DtBackgroundLoader::theClassName ( )
static

Get the name used to register this class.

virtual void makVrv::DtBackgroundLoader::updateQueue ( int  max_thread_count,
int  active_threads 
)
virtual

called from the foreground main event loop moves stuff from the producer queue into the consumer one, manages time and does foreground loading

virtual DtLoaderHandle* makVrv::DtBackgroundLoader::queueForLoad ( DtModel object)
virtual

takes ownership of the handle

virtual void makVrv::DtBackgroundLoader::setForegroundTimeBudget ( double  budget)
virtual
virtual void makVrv::DtBackgroundLoader::incrementForegroundTime ( double  time_elapse)
virtual

updates how much time has been spend already, allows per frame adjustment of budget

virtual bool makVrv::DtBackgroundLoader::isForegroundTimeBudgetExpired ( ) const
virtual

returns if foreground time is greater then budget

virtual double makVrv::DtBackgroundLoader::timeSpentThisFrame ( ) const
virtual

returns time spend working in the foreground.

virtual void makVrv::DtBackgroundLoader::loadIfPossibleOrAddToQueue ( DtModel object)
virtual

Spawns off task if definition hasn't been loaded yet, otherwise runs the foreground loading code if there's enough time.

virtual bool makVrv::DtBackgroundLoader::hasActiveAsyncTasks ( ) const
virtual

returns true if there are tasks active in the background

virtual int makVrv::DtBackgroundLoader::numModelDefinitionsToIco ( ) const
virtual

used by model preloader to decide if there's data to process

virtual std::string makVrv::DtBackgroundLoader::nextModelDefinitionToIco ( )
virtual

name of the next model to look up definition of and process its ICO data.

virtual int makVrv::DtBackgroundLoader::numOfActiveTasks ( ) const
virtual

number of current async tasks running

virtual void makVrv::DtBackgroundLoader::addToAdditionalIcoList ( osgUtil::StateToCompile *  compile)
virtual

Can be used to add additional ICO objects, not used currently.

virtual std::list<osgUtil::StateToCompile*>& makVrv::DtBackgroundLoader::additionalToIcoList ( )
virtual

returns list of additional ICO objects, not used currently.

virtual bool makVrv::DtBackgroundLoader::multithreadedLoadingActive ( ) const
virtual

is the system active or disabled, defaults to on

virtual void makVrv::DtBackgroundLoader::setMultithreadedLoadingActive ( bool  val)
virtual

controls if the system is active

DtDe& makVrv::DtBackgroundLoader::de ( )
inline

returns the de

virtual void makVrv::DtBackgroundLoader::timedForegroundLoad ( DtModel object)
protectedvirtual

runs foreground load code and updates time budgeting.

virtual void makVrv::DtBackgroundLoader::ts_setModelDefinitionLoaded ( const std::string &  modelDefinition)
protectedvirtual
virtual bool makVrv::DtBackgroundLoader::ts_isModelDefinitionLoaded ( const std::string &  modelDefinition) const
protectedvirtual

Friends And Related Function Documentation

friend class DtBackgroundLoadAsyncTask
friend

Member Data Documentation

DtDe& makVrv::DtBackgroundLoader::myDe
protected
boost::mutex makVrv::DtBackgroundLoader::myProducerQueueMutex
protected
std::list< DtLoaderHandle* > makVrv::DtBackgroundLoader::myProducerQueue
protected
std::list< DtLoaderHandle* > makVrv::DtBackgroundLoader::myForegroundQueue
protected
std::list< std::string > makVrv::DtBackgroundLoader::myModelDefsToIcoQueue
protected
std::list<DtLoaderHandle* > makVrv::DtBackgroundLoader::myObjectsFinishedWithTBBTask
protected
std::list<osgUtil::StateToCompile* > makVrv::DtBackgroundLoader::myAdditionalToIcoList
protected
boost::mutex makVrv::DtBackgroundLoader::myTaskFinishedMutex
protected
std::list<DtLoaderHandle* > makVrv::DtBackgroundLoader::myObjectsToForegroundLoad
protected
std::map<std::string, bool> makVrv::DtBackgroundLoader::myActivelyLoadingModelDefs
protected
tbb::atomic<int> makVrv::DtBackgroundLoader::myNumberOfActiveTasks
protected
double makVrv::DtBackgroundLoader::myTimeSpentThisFrame
protected
boost::mutex makVrv::DtBackgroundLoader::myMutableLoadedDefMapMutex
mutableprotected
boost::unordered_map<std::string, bool> makVrv::DtBackgroundLoader::myLoadedDefMap
protected
double makVrv::DtBackgroundLoader::myForegroundTimeBudget
protected
bool makVrv::DtBackgroundLoader::myMultithreadedLoadingActive
protected

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

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)