Workspace 6.21.5
Public Member Functions | List of all members
WSGLBufferObjectCacheItemPtr Class Reference

Holder class for managing items in a WSGLBufferObjectCache. More...

#include <Rendering/OpenGL/wsglbufferobjectcacheitemptr.h>

Public Member Functions

 WSGLBufferObjectCacheItemPtr ()
 
 WSGLBufferObjectCacheItemPtr (const WSGLBufferObjectCacheItemPtr &item)
 
 WSGLBufferObjectCacheItemPtr (WSGLBufferObjectCacheItem *item)
 
 ~WSGLBufferObjectCacheItemPtr ()
 
void clear ()
 
WSGLBufferObjectCacheItemget () const noexcept
 
bool isValid () const
 
WSGLBufferObjectCacheItemoperator* () const noexcept
 
WSGLBufferObjectCacheItemoperator-> () const noexcept
 
WSGLBufferObjectCacheItemPtroperator= (const WSGLBufferObjectCacheItemPtr &item)
 
bool unique () const noexcept
 
unsigned useCount () const noexcept
 

Detailed Description

The WSGLBufferObjectCacheItemPtr manages reference counting to internal cache objects. Once an internally cached object has no more WSGLBufferObjectCacheItemPtr's associated with it, the item becomes a candidate for expiry when the WSGLBufferObjectCache needs to free up memory.

Constructor & Destructor Documentation

◆ WSGLBufferObjectCacheItemPtr() [1/3]

This will create an invalid CacheItem. It is present to allow CacheItem objects to be stored in STL containers, since these containers require a default constructor to be provided. All uses of a CacheItem should never require the default constructor to actually be used though, and any attempt to do so will trigger an assertion if the module is built in debug mode.

◆ WSGLBufferObjectCacheItemPtr() [2/3]

Parameters
cacheItemThe item that this ptr with reference.

This will create a new cache object if necessary. Once an object has been obtained, its reference count will be incremented.

◆ WSGLBufferObjectCacheItemPtr() [3/3]

Parameters
itemCache item to share.

Internally, the const-ness of item is cast away. This is necessary because the CacheItem being constructed will share the cacheItem_ held by item and store it as a non-const pointer.

Postcondition
The two CacheItem instances will share the same private cacheItem_ data member (which is reference counted).

◆ ~WSGLBufferObjectCacheItemPtr()

Decrement the reference count of the cache object being held. This will place the cache object onto the expiry queue if the reference count is reduced to zero.

Member Function Documentation

◆ clear()

void clear ( )

◆ get()

WSGLBufferObjectCacheItem * get ( ) const
noexcept

◆ isValid()

bool isValid ( ) const

◆ operator*()

WSGLBufferObjectCacheItem & operator* ( ) const
noexcept

◆ operator->()

WSGLBufferObjectCacheItem * operator-> ( ) const
noexcept

◆ operator=()

Parameters
itemCache item to share.

Internally, the const-ness of item is cast away. This is necessary because the CacheItem being assigned to will share the cacheItem_ held by item and store it as a non-const pointer.

Postcondition
The two CacheItem instances will share the same private cacheItem_ data member (which is reference counted).

◆ unique()

bool unique ( ) const
noexcept

◆ useCount()

unsigned useCount ( ) const
noexcept