#include <OgreResourceBackgroundQueue.h>
Public Member Functions | |
OGRE_THREAD_SYNCHRONISER (initSync) | |
Init notification mutex (must lock before waiting on initCondition). | |
ResourceBackgroundQueue () | |
virtual | ~ResourceBackgroundQueue () |
void | setStartBackgroundThread (bool startThread) |
Sets whether or not a thread should be created and started to handle the background loading, or whether a user thread will call the appropriate hooks. | |
bool | getStartBackgroundThread (void) |
Gets whether or not a thread should be created and started to handle the background loading, or whether a user thread will call the appropriate hooks. | |
virtual void | initialise (void) |
Initialise the background queue system. | |
virtual void | shutdown (void) |
Shut down the background queue system. | |
virtual BackgroundProcessTicket | initialiseResourceGroup (const String &name, Listener *listener=0) |
Initialise a resource group in the background. | |
virtual BackgroundProcessTicket | initialiseAllResourceGroups (Listener *listener=0) |
Initialise all resource groups which are yet to be initialised in the background. | |
virtual BackgroundProcessTicket | loadResourceGroup (const String &name, Listener *listener=0) |
Loads a resource group in the background. | |
virtual BackgroundProcessTicket | unload (const String &resType, const String &name, Listener *listener=0) |
Unload a single resource in the background. | |
virtual BackgroundProcessTicket | unload (const String &resType, ResourceHandle handle, Listener *listener=0) |
Unload a single resource in the background. | |
virtual BackgroundProcessTicket | unloadResourceGroup (const String &name, Listener *listener=0) |
Unloads a resource group in the background. | |
virtual BackgroundProcessTicket | load (const String &resType, const String &name, const String &group, bool isManual=false, ManualResourceLoader *loader=0, const NameValuePairList *loadParams=0, Listener *listener=0) |
Load a single resource in the background. | |
virtual bool | isProcessComplete (BackgroundProcessTicket ticket) |
Returns whether a previously queued process has completed or not. | |
bool | _doNextQueuedBackgroundProcess () |
Process a single queued background operation. | |
void | _initThread () |
Initialise processing for a background thread. | |
virtual void | _queueFireBackgroundLoadingComplete (Resource *res) |
Queue the firing of the 'background loading complete' event to a Resource::Listener event. | |
virtual void | _fireBackgroundLoadingComplete (void) |
Fires all the queued events for background loaded resources. | |
Static Public Member Functions | |
static ResourceBackgroundQueue & | getSingleton (void) |
Override standard Singleton retrieval. | |
static ResourceBackgroundQueue * | getSingletonPtr (void) |
Override standard Singleton retrieval. | |
Protected Types | |
enum | RequestType { RT_INITIALISE_GROUP, RT_INITIALISE_ALL_GROUPS, RT_LOAD_GROUP, RT_LOAD_RESOURCE, RT_UNLOAD_GROUP, RT_UNLOAD_RESOURCE, RT_SHUTDOWN } |
Enumerates the type of requests. More... | |
typedef std::list < Request > | RequestQueue |
typedef std::map < BackgroundProcessTicket, Request * > | RequestTicketMap |
typedef std::list < QueuedNotification > | NotificationQueue |
Protected Member Functions | |
virtual OGRE_AUTO_MUTEX void | queueFireBackgroundOperationComplete (Listener *listener, BackgroundProcessTicket ticket) |
Private mutex, not allowed to lock from outside. | |
Protected Attributes | |
RequestQueue | mRequestQueue |
Queue of requests, used to store and order requests. | |
RequestTicketMap | mRequestTicketMap |
Request lookup by ticket. | |
unsigned long | mNextTicketID |
Next ticket ID. | |
NotificationQueue | mNotificationQueue |
Queued notifications of background loading being finished. | |
bool | mStartThread |
Mutex to protect the background event queue]. | |
void * | mThread |
Dummy. | |
Static Protected Attributes | |
static T * | ms_Singleton |
Classes | |
class | Listener |
This abstract listener interface lets you get notifications of completed background processes instead of having to poll ticket statuses. More... | |
struct | QueuedNotification |
Struct that holds details of queued notifications. More... | |
struct | Request |
Encapsulates a queued request for the background queue. More... |
Definition at line 81 of file OgreResourceBackgroundQueue.h.
typedef std::list<Request> Ogre::ResourceBackgroundQueue::RequestQueue [protected] |
Definition at line 146 of file OgreResourceBackgroundQueue.h.
typedef std::map<BackgroundProcessTicket, Request*> Ogre::ResourceBackgroundQueue::RequestTicketMap [protected] |
Definition at line 147 of file OgreResourceBackgroundQueue.h.
typedef std::list<QueuedNotification> Ogre::ResourceBackgroundQueue::NotificationQueue [protected] |
Definition at line 175 of file OgreResourceBackgroundQueue.h.
enum Ogre::ResourceBackgroundQueue::RequestType [protected] |
Enumerates the type of requests.
RT_INITIALISE_GROUP | |
RT_INITIALISE_ALL_GROUPS | |
RT_LOAD_GROUP | |
RT_LOAD_RESOURCE | |
RT_UNLOAD_GROUP | |
RT_UNLOAD_RESOURCE | |
RT_SHUTDOWN |
Definition at line 122 of file OgreResourceBackgroundQueue.h.
Ogre::ResourceBackgroundQueue::ResourceBackgroundQueue | ( | ) |
virtual Ogre::ResourceBackgroundQueue::~ResourceBackgroundQueue | ( | ) | [virtual] |
Ogre::ResourceBackgroundQueue::OGRE_THREAD_SYNCHRONISER | ( | initSync | ) |
Init notification mutex (must lock before waiting on initCondition).
Synchroniser token to wait / notify on thread init (public incase external thread)
virtual OGRE_AUTO_MUTEX void Ogre::ResourceBackgroundQueue::queueFireBackgroundOperationComplete | ( | Listener * | listener, | |
BackgroundProcessTicket | ticket | |||
) | [protected, virtual] |
Private mutex, not allowed to lock from outside.
Queue the firing of the 'background loading complete' event to a Resource::Listener event.
listener | The listener to be notified | |
ticket | The ticket for the operation that has completed |
void Ogre::ResourceBackgroundQueue::setStartBackgroundThread | ( | bool | startThread | ) |
Sets whether or not a thread should be created and started to handle the background loading, or whether a user thread will call the appropriate hooks.
Definition at line 240 of file OgreResourceBackgroundQueue.h.
bool Ogre::ResourceBackgroundQueue::getStartBackgroundThread | ( | void | ) |
Gets whether or not a thread should be created and started to handle the background loading, or whether a user thread will call the appropriate hooks.
Definition at line 246 of file OgreResourceBackgroundQueue.h.
virtual void Ogre::ResourceBackgroundQueue::initialise | ( | void | ) | [virtual] |
virtual void Ogre::ResourceBackgroundQueue::shutdown | ( | void | ) | [virtual] |
virtual BackgroundProcessTicket Ogre::ResourceBackgroundQueue::initialiseResourceGroup | ( | const String & | name, | |
Listener * | listener = 0 | |||
) | [virtual] |
Initialise a resource group in the background.
name | The name of the resource group to initialise | |
listener | Optional callback interface, take note of warnings in the header and only use if you understand them. |
virtual BackgroundProcessTicket Ogre::ResourceBackgroundQueue::initialiseAllResourceGroups | ( | Listener * | listener = 0 |
) | [virtual] |
Initialise all resource groups which are yet to be initialised in the background.
listener | Optional callback interface, take note of warnings in the header and only use if you understand them. |
virtual BackgroundProcessTicket Ogre::ResourceBackgroundQueue::loadResourceGroup | ( | const String & | name, | |
Listener * | listener = 0 | |||
) | [virtual] |
Loads a resource group in the background.
name | The name of the resource group to load | |
listener | Optional callback interface, take note of warnings in the header and only use if you understand them. |
virtual BackgroundProcessTicket Ogre::ResourceBackgroundQueue::unload | ( | const String & | resType, | |
const String & | name, | |||
Listener * | listener = 0 | |||
) | [virtual] |
Unload a single resource in the background.
resType | The type of the resource (from ResourceManager::getResourceType()) | |
name | The name of the Resource |
virtual BackgroundProcessTicket Ogre::ResourceBackgroundQueue::unload | ( | const String & | resType, | |
ResourceHandle | handle, | |||
Listener * | listener = 0 | |||
) | [virtual] |
Unload a single resource in the background.
resType | The type of the resource (from ResourceManager::getResourceType()) | |
handle | Handle to the resource |
virtual BackgroundProcessTicket Ogre::ResourceBackgroundQueue::unloadResourceGroup | ( | const String & | name, | |
Listener * | listener = 0 | |||
) | [virtual] |
Unloads a resource group in the background.
name | The name of the resource group to load |
virtual BackgroundProcessTicket Ogre::ResourceBackgroundQueue::load | ( | const String & | resType, | |
const String & | name, | |||
const String & | group, | |||
bool | isManual = false , |
|||
ManualResourceLoader * | loader = 0 , |
|||
const NameValuePairList * | loadParams = 0 , |
|||
Listener * | listener = 0 | |||
) | [virtual] |
Load a single resource in the background.
resType | The type of the resource (from ResourceManager::getResourceType()) | |
name | The name of the Resource | |
group | The resource group to which this resource will belong | |
isManual | Is the resource to be manually loaded? If so, you should provide a value for the loader parameter | |
loader | The manual loader which is to perform the required actions when this resource is loaded; only applicable when you specify true for the previous parameter. NOTE: must be thread safe!! | |
loadParams | Optional pointer to a list of name/value pairs containing loading parameters for this type of resource. Remember that this must have a lifespan longer than the return of this call! |
virtual bool Ogre::ResourceBackgroundQueue::isProcessComplete | ( | BackgroundProcessTicket | ticket | ) | [virtual] |
Returns whether a previously queued process has completed or not.
ticket | The ticket which was returned when the process was queued |
bool Ogre::ResourceBackgroundQueue::_doNextQueuedBackgroundProcess | ( | ) |
Process a single queued background operation.
void Ogre::ResourceBackgroundQueue::_initThread | ( | ) |
Initialise processing for a background thread.
virtual void Ogre::ResourceBackgroundQueue::_queueFireBackgroundLoadingComplete | ( | Resource * | res | ) | [virtual] |
Queue the firing of the 'background loading complete' event to a Resource::Listener event.
res | The resource listened on |
virtual void Ogre::ResourceBackgroundQueue::_fireBackgroundLoadingComplete | ( | void | ) | [virtual] |
Fires all the queued events for background loaded resources.
static ResourceBackgroundQueue& Ogre::ResourceBackgroundQueue::getSingleton | ( | void | ) | [static] |
Override standard Singleton retrieval.
Reimplemented from Ogre::Singleton< T >.
static ResourceBackgroundQueue* Ogre::ResourceBackgroundQueue::getSingletonPtr | ( | void | ) | [static] |
Override standard Singleton retrieval.
Reimplemented from Ogre::Singleton< T >.
Queue of requests, used to store and order requests.
Definition at line 150 of file OgreResourceBackgroundQueue.h.
unsigned long Ogre::ResourceBackgroundQueue::mNextTicketID [protected] |
Queued notifications of background loading being finished.
Definition at line 177 of file OgreResourceBackgroundQueue.h.
bool Ogre::ResourceBackgroundQueue::mStartThread [protected] |
Mutex to protect the background event queue].
Whether this class should start it's own thread or not
Definition at line 182 of file OgreResourceBackgroundQueue.h.
void* Ogre::ResourceBackgroundQueue::mThread [protected] |
T* Ogre::Singleton< T >::ms_Singleton [static, protected, inherited] |
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Mon Jun 16 12:52:29 2008