public |
Inheritance Graph
graph BT
CacheContext
click CacheContext "classMinSG_1_1OutOfCore_1_1CacheContext"
Description
Context for holding global cache information.
Structure holding information needed by different entities in the out-of-core system (e.g. CacheManager , CacheLevel ). The class takes care of providing exclusive access to the required data structures, which makes it thread-safe.
Author: Benjamin Eikel
Date: 2012-12-05
Public Functions
CacheContext() | |
~CacheContext() | |
void | addObject( CacheObject * object) Inform the context about a new cache object. |
void | removeObject( CacheObject * object) Remove an existing cache object. |
void | onEndFrame(const std::vector< CacheLevel * > & levels) |
uint16_t | updateUserPriority( CacheObject * object, uint16_t userPriority) |
void | updateFrameNumber( CacheObject * object, uint32_t frameNumber) |
CacheObject * | getMostImportantMissingObject(const CacheLevel & level) |
CacheObject * | getLeastImportantStoredObject(const CacheLevel & level) |
bool | isTargetStateReached(const CacheLevel & level) const |
Rendering::Mesh * | getContent( CacheObject * object) Access the content of the given cache object. |
const Rendering::Mesh * | getContent( CacheObject * object) const Read the content of the given cache object. |
void | setContent( CacheObject * object, Rendering::Mesh * newContent) Update the content of the given cache object. |
void | lockContentMutex() LockcontentMutex. |
void | unlockContentMutex() UnlockcontentMutex. |
void | addObjectToLevel( CacheObject * object, const CacheLevel & level) |
void | removeObjectFromLevel( CacheObject * object, const CacheLevel & level) |
bool | isObjectStoredInLevel(const CacheObject * object, const CacheLevel & level) const |
Documentation
function
MinSG::OutOfCore::CacheContext::CacheContext
public |
CacheContext( | ) |
Defined in MinSG/Ext/OutOfCore/CacheContext.h:130
function
MinSG::OutOfCore::CacheContext::~CacheContext
public |
~CacheContext( | ) |
Defined in MinSG/Ext/OutOfCore/CacheContext.h:132
function
MinSG::OutOfCore::CacheContext::addObject
public |
void addObject( | CacheObject * | object ) |
Inform the context about a new cache object.
Defined in MinSG/Ext/OutOfCore/CacheContext.h:135
function
MinSG::OutOfCore::CacheContext::removeObject
public |
void removeObject( | CacheObject * | object ) |
Remove an existing cache object.
Defined in MinSG/Ext/OutOfCore/CacheContext.h:138
function
MinSG::OutOfCore::CacheContext::onEndFrame
public |
void onEndFrame( | const std::vector< CacheLevel * > & | levels ) |
Inform the context that the frame has ended. It will perform maintenance work to restore the correct sort order ofsortedCacheObjectsincorporating the priority changes of the last frame.
Defined in MinSG/Ext/OutOfCore/CacheContext.h:146
function
MinSG::OutOfCore::CacheContext::updateUserPriority
public |
uint16_t updateUserPriority( | CacheObject * | object, |
uint16_t | userPriority | |
) |
Update the user priority of a cache object. If the new user priority is the same as the old one, nothing will be changed.
Parameters
- object
- Cache object to update
Returns
Previous user priority
Defined in MinSG/Ext/OutOfCore/CacheContext.h:155
function
MinSG::OutOfCore::CacheContext::updateFrameNumber
public |
void updateFrameNumber( | CacheObject * | object, |
uint32_t | frameNumber | |
) |
Update the frame number in which a cache object was used last. If the cache objects already has been used in that frame, its usage count is increased by one. Otherwise its usage frame number is updated.
Parameters
- object
- Cache object to update
- frameNumber
- Frame number in which the cache object was used
Defined in MinSG/Ext/OutOfCore/CacheContext.h:167
function
MinSG::OutOfCore::CacheContext::getMostImportantMissingObject
public |
CacheObject * getMostImportantMissingObject( | const CacheLevel & | level ) |
Return the cache object with the highest priority that is not stored in the given cache level. If the cache level does store all cache objects,nullptr
is returned.
Parameters
- level
- Cache level
Returns
Most important missing cache object, ornullptr
Defined in MinSG/Ext/OutOfCore/CacheContext.h:177
function
MinSG::OutOfCore::CacheContext::getLeastImportantStoredObject
public |
CacheObject * getLeastImportantStoredObject( | const CacheLevel & | level ) |
Return the cache object with the smallest priority that is stored in the given cache level. If the cache level does not store any cache object,nullptr
is returned. Additionally, it is checked that the cache object can be removed by the requesting cache level.
Parameters
- level
- Cache level
Returns
Least important stored cache object, ornullptr
Defined in MinSG/Ext/OutOfCore/CacheContext.h:188
function
MinSG::OutOfCore::CacheContext::isTargetStateReached
public | const |
bool isTargetStateReached( | const CacheLevel & | level ) const |
Check if the target state for the given cache level has been reached. This means that the last stored cache object has at least the priority of the first missing cache object for that cache level. If the cache level is full already, it has no work to do.
Parameters
- level
- Cache level
Returns
true
if the cache level has reached the target state
Defined in MinSG/Ext/OutOfCore/CacheContext.h:199
function
MinSG::OutOfCore::CacheContext::getContent
public |
Rendering::Mesh * getContent( | CacheObject * | object ) |
Access the content of the given cache object.
Defined in MinSG/Ext/OutOfCore/CacheContext.h:202
function
MinSG::OutOfCore::CacheContext::getContent
public | const |
const Rendering::Mesh * getContent( | CacheObject * | object ) const |
Read the content of the given cache object.
Defined in MinSG/Ext/OutOfCore/CacheContext.h:204
function
MinSG::OutOfCore::CacheContext::setContent
public |
void setContent( | CacheObject * | object, |
Rendering::Mesh * | newContent | |
) |
Update the content of the given cache object.
Defined in MinSG/Ext/OutOfCore/CacheContext.h:206
function
MinSG::OutOfCore::CacheContext::lockContentMutex
public |
void lockContentMutex( | ) |
LockcontentMutex.
Defined in MinSG/Ext/OutOfCore/CacheContext.h:209
function
MinSG::OutOfCore::CacheContext::unlockContentMutex
public |
void unlockContentMutex( | ) |
UnlockcontentMutex.
Defined in MinSG/Ext/OutOfCore/CacheContext.h:212
function
MinSG::OutOfCore::CacheContext::addObjectToLevel
public |
void addObjectToLevel( | CacheObject * | object, |
const CacheLevel & | level | |
) |
Inform the cache context that a cache object is to be added to a cache level.
Parameters
- object
- Cache object that will be added
- level
- Cache level that will contain the cache object
Defined in MinSG/Ext/OutOfCore/CacheContext.h:221
function
MinSG::OutOfCore::CacheContext::removeObjectFromLevel
public |
void removeObjectFromLevel( | CacheObject * | object, |
const CacheLevel & | level | |
) |
Inform the cache context that a cache object is to be remove from a cache level.
Parameters
- object
- Cache object that will be removed
- level
- Cache level that currently contains the cache object
Defined in MinSG/Ext/OutOfCore/CacheContext.h:230
function
MinSG::OutOfCore::CacheContext::isObjectStoredInLevel
public | const |
bool isObjectStoredInLevel( | const CacheObject * | object, |
const CacheLevel & | level | |
) const |
Check if a cache level contains a specific cache object.
Parameters
- object
- Cache object
- level
- Cache level
Returns
true
if the given cache level contains the cache object,false
otherwise
Defined in MinSG/Ext/OutOfCore/CacheContext.h:240