VR-Forces 5.0.3 Developer's Guide
 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

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)
 
virtual DtLoaderHandlequeueForLoad (DtModel *object)
 
virtual void loadIfPossibleOrAddToQueue (DtModel *object)
 
virtual bool hasActiveAsyncTasks () const
 
virtual int numModelDefinitionsToIco () const
 
virtual std::string nextModelDefinitionToIco ()
 
virtual int numOfActiveTasks () const
 
virtual void addToAdditionalIcoList (osgUtil::StateToCompile *compile)
 
virtual std::list
< osgUtil::StateToCompile * > & 
additionalToIcoList ()
 
virtual bool multithreadedLoadingActive () const
 
virtual void setMultithreadedLoadingActive (bool val)
 
DtDede ()
 
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)
 
virtual bool isForegroundTimeBudgetExpired () const
 
virtual double timeSpentThisFrame () const
 
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 
virtual ~DtVirtualBaseClass ()
 

Static Public Member Functions

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

Protected Member Functions

virtual void timedForegroundLoad (DtModel *object)
 
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
 

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

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

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 Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)