1 #ifndef _OSG_REQUEST_H_
2 #define _OSG_REQUEST_H_
5 #include "OSGContribBackgroundLoaderDef.h"
7 #include <boost/shared_ptr.hpp>
8 #include <boost/weak_ptr.hpp>
9 #include <boost/enable_shared_from_this.hpp>
17 typedef boost::shared_ptr
<Request
> RequestPtr
;
18 typedef boost::weak_ptr
<Request
> RequestWeakPtr
;
20 /** A request to be processed by the background loader.
22 class OSG_CONTRIBBACKGROUNDLOADER_DLLMAPPING Request
30 /** Return a text description of the request.
31 * This could be used in a user interface or debug output to provide
32 * a user understandable description.
34 virtual std::string
getDescription()
35 { return std::string("Base Request"); }
37 /** Called when it is time to execute the request and "do" something.
40 virtual void execute() = 0;
42 /** Called in the main thread when it is time to sync up
43 * and finish the processing. ex: add child node.
45 virtual void sync() = 0;
47 /** Return true if the request has been completed. */
52 void setPriority(float val
);
54 static bool comparePriority(RequestPtr lhs
, RequestPtr rhs
);
56 friend class BackgroundLoaderBase
;
58 bool mCompleted
; /**< True once the request has been completed and synced. */
59 float mPriority
; /**< Priority for this request. lower numbers are higher priority. */
64 #endif /*_REQUEST_H_*/