VR-Forces 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 | Private Member Functions | 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

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)
 
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)
 

Protected Member Functions

 DtBackgroundLoader (DtDe &de)
 
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
 
std::atomic< intmyNumberOfActiveTasks
 
double myTimeSpentThisFrame
 
boost::mutex myMutableLoadedDefMapMutex
 
std::unordered_map
< std::string, bool
myLoadedDefMap
 
double myForegroundTimeBudget
 
bool myMultithreadedLoadingActive
 
tbb::task_arena myTaskArena
 

Private Member Functions

 DtBackgroundLoader ()=delete
 
 DtBackgroundLoader (const DtBackgroundLoader &)=delete
 
DtBackgroundLoaderoperator= (const DtBackgroundLoader &)=delete
 

Friends

class DtBackgroundLoadAsyncTask
 

Constructor & Destructor Documentation

virtual makVrv::DtBackgroundLoader::~DtBackgroundLoader ( )
virtual

destructor

makVrv::DtBackgroundLoader::DtBackgroundLoader ( DtDe de)
protected

not allowed directly

makVrv::DtBackgroundLoader::DtBackgroundLoader ( )
privatedelete

not allowed

makVrv::DtBackgroundLoader::DtBackgroundLoader ( const DtBackgroundLoader )
privatedelete

not allowed

Member Function Documentation

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

singleton access

DtBackgroundLoader& makVrv::DtBackgroundLoader::operator= ( const DtBackgroundLoader )
privatedelete

not allowed

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.

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

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
std::atomic<int> makVrv::DtBackgroundLoader::myNumberOfActiveTasks
protected
double makVrv::DtBackgroundLoader::myTimeSpentThisFrame
protected
boost::mutex makVrv::DtBackgroundLoader::myMutableLoadedDefMapMutex
mutableprotected
std::unordered_map<std::string, bool> makVrv::DtBackgroundLoader::myLoadedDefMap
protected
double makVrv::DtBackgroundLoader::myForegroundTimeBudget
protected
bool makVrv::DtBackgroundLoader::myMultithreadedLoadingActive
protected
tbb::task_arena makVrv::DtBackgroundLoader::myTaskArena
protected

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

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)