28#ifndef __ResourceBackgroundQueue_H__
29#define __ResourceBackgroundQueue_H__
114 RT_INITIALISE_GROUP = 0,
115 RT_INITIALISE_ALL_GROUPS = 1,
116 RT_PREPARE_GROUP = 2,
117 RT_PREPARE_RESOURCE = 3,
119 RT_LOAD_RESOURCE = 5,
121 RT_UNLOAD_RESOURCE = 7
138 { (void)r;
return o; }
148 : resource(r), request(req)
155 { (void)r;
return o; }
265 const String& group,
bool isManual =
false,
287 const String& group,
bool isManual =
false,
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Interface describing a manual resource loader.
This abstract listener interface lets you get notifications of completed background processes instead...
virtual ~Listener()
Need virtual destructor in case subclasses use it.
virtual void operationCompleted(BackgroundProcessTicket ticket, const BackgroundProcessResult &result)=0
Called when a requested operation completes, queued into main thread.
This class is used to perform Resource operations in a background thread.
static ResourceBackgroundQueue * getSingletonPtr(void)
Override standard Singleton retrieval.
virtual BackgroundProcessTicket initialiseResourceGroup(const String &name, Listener *listener=0)
Initialise a resource group in the background.
static ResourceBackgroundQueue & getSingleton(void)
Override standard Singleton retrieval.
virtual BackgroundProcessTicket prepare(const String &resType, const String &name, const String &group, bool isManual=false, ManualResourceLoader *loader=0, const NameValuePairList *loadParams=0, Listener *listener=0)
Prepare a single resource in the background.
void abortRequest(BackgroundProcessTicket ticket)
Aborts background process.
bool canHandleResponse(const WorkQueue::Response *res, const WorkQueue *srcQ)
Implementation for WorkQueue::ResponseHandler.
virtual ~ResourceBackgroundQueue()
WorkQueue::Response * handleRequest(const WorkQueue::Request *req, const WorkQueue *srcQ)
Implementation for WorkQueue::RequestHandler.
virtual BackgroundProcessTicket unloadResourceGroup(const String &name, Listener *listener=0)
Unloads a resource group in the background.
virtual bool isProcessComplete(BackgroundProcessTicket ticket)
Returns whether a previously queued process has completed or not.
ResourceBackgroundQueue()
void handleResponse(const WorkQueue::Response *res, const WorkQueue *srcQ)
Implementation for WorkQueue::ResponseHandler.
virtual void initialise(void)
Initialise the background queue system.
virtual BackgroundProcessTicket loadResourceGroup(const String &name, Listener *listener=0)
Loads a resource group in the background.
virtual BackgroundProcessTicket unload(const String &resType, ResourceHandle handle, Listener *listener=0)
Unload a single resource in the background.
set< BackgroundProcessTicket >::type OutstandingRequestSet
virtual BackgroundProcessTicket prepareResourceGroup(const String &name, Listener *listener=0)
Prepares 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.
OutstandingRequestSet mOutstandingRequestSet
virtual BackgroundProcessTicket initialiseAllResourceGroups(Listener *listener=0)
Initialise all resource groups which are yet to be initialised in the background.
bool canHandleRequest(const WorkQueue::Request *req, const WorkQueue *srcQ)
Implementation for WorkQueue::RequestHandler.
virtual BackgroundProcessTicket unload(const String &resType, const String &name, Listener *listener=0)
Unload a single resource in the background.
virtual void shutdown(void)
Shut down the background queue system.
BackgroundProcessTicket addRequest(ResourceRequest &req)
RequestType
Enumerates the type of requests.
Template class for creating single-instance global classes.
Interface definition for a handler of requests.
General purpose request structure.
Interface definition for a handler of responses.
Interface to a general purpose request / response style background work queue.
unsigned long long int RequestID
Numeric identifier for a request.
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
WorkQueue::RequestID BackgroundProcessTicket
Identifier of a background process.
unsigned long long int ResourceHandle
Encapsulates the result of a background queue request.
BackgroundProcessResult()
String message
Any messages from the process.
bool error
Whether an error occurred.
Encapsulates a queued request for the background queue.
NameValuePairList * loadParams
_OgreExport friend std::ostream & operator<<(std::ostream &o, const ResourceRequest &r)
BackgroundProcessResult result
ResourceHandle resourceHandle
ManualResourceLoader * loader
Struct that holds details of queued notifications.
ResourceResponse(ResourcePtr r, const ResourceRequest &req)
_OgreExport friend std::ostream & operator<<(std::ostream &o, const ResourceResponse &r)
General purpose response structure.