fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Contrib / BackgroundLoader / OSGModelRequest.h
blob907a0f0665fa78fad0cde8cbd9fbc73ab6ac71f9
1 #ifndef _OSG_MODEL_REQUEST_H_
2 #define _OSG_MODEL_REQUEST_H_
4 #include "OSGContribBackgroundLoaderDef.h"
6 #include <boost/shared_ptr.hpp>
7 #include <boost/weak_ptr.hpp>
8 #include <boost/enable_shared_from_this.hpp>
10 #include "OSGNode.h"
12 #include "OSGRequest.h"
13 #include "OSGChangeList.h"
15 OSG_BEGIN_NAMESPACE
17 OSG_GEN_MEMOBJPTR(ChangeList);
19 class ModelRequest;
20 typedef boost::shared_ptr<ModelRequest> ModelRequestPtr;
21 typedef boost::weak_ptr<ModelRequest> ModelRequestWeakPtr;
23 /** A request for loading a model.
25 * note: We hold on using refptrs, so all objects passed to us must have a
26 * positive ref count.
29 class OSG_CONTRIBBACKGROUNDLOADER_DLLMAPPING ModelRequest :
30 public boost::enable_shared_from_this<ModelRequest>, public Request
32 protected:
34 ModelRequest(void);
36 public:
38 static ModelRequestPtr create(void)
40 return ModelRequestPtr(new ModelRequest);
43 virtual ~ModelRequest(void);
45 ModelRequestPtr init(NodeRefPtr parent, const std::string &filename)
47 mParent = parent;
48 mFilename = filename;
49 pChangeList = ChangeList::create();
51 return shared_from_this();
54 virtual std::string getDescription( void );
55 virtual void execute ( void );
56 virtual void sync ( void );
58 void setVerifyModel( bool bVal );
59 void setGraphOp (const std::string &szVal);
61 protected:
63 // Note: We use RefPtrs so the code can still work
64 // even if the original nodes have been left to cleanup in the main
65 // program. (ie. removed)
67 NodeUnrecPtr mParent; /**< The node that we are supposed to
68 * load the model under. */
69 NodeUnrecPtr mModel; /**< The model that we loaded. */
70 std::string mFilename;
71 ChangeListRefPtr pChangeList;
73 bool bVerifyModel;
74 std::string szGraphOp;
77 OSG_END_NAMESPACE
79 #endif /*_OSG_MODEL_REQUEST_H_*/