OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
unrefqueue.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_UNREFQUEUE_H
2 #define OPENMW_COMPONENTS_UNREFQUEUE_H
3 
4 #include <deque>
5 
6 #include <osg/ref_ptr>
7 #include <osg/Referenced>
8 
10 
11 namespace SceneUtil
12 {
13  class WorkQueue;
14 
16  {
17  public:
18  std::deque<osg::ref_ptr<const osg::Referenced> > mObjects;
19  virtual void doWork();
20  };
21 
24  class UnrefQueue : public osg::Referenced
25  {
26  public:
27  UnrefQueue();
28 
30  void push(const osg::Referenced* obj);
31 
34  void flush(SceneUtil::WorkQueue* workQueue);
35 
36  unsigned int getNumItems() const;
37 
38  private:
39  osg::ref_ptr<UnrefWorkItem> mWorkItem;
40  };
41 
42 }
43 
44 #endif
void push(const osg::Referenced *obj)
Adds an object to the list of objects to be unreferenced. Call from the main thread.
Definition: unrefqueue.cpp:19
A work queue that users can push work items onto, to be completed by one or more background threads...
Definition: workqueue.hpp:48
void flush(SceneUtil::WorkQueue *workQueue)
Definition: unrefqueue.cpp:24
Definition: unrefqueue.hpp:15
Definition: workqueue.hpp:17
std::deque< osg::ref_ptr< const osg::Referenced > > mObjects
Definition: unrefqueue.hpp:18
unsigned int getNumItems() const
Definition: unrefqueue.cpp:34
Handles unreferencing of objects through the WorkQueue. Typical use scenario would be the main thread...
Definition: unrefqueue.hpp:24
UnrefQueue()
Definition: unrefqueue.cpp:14
virtual void doWork()
Override in a derived WorkItem to perform actual work.
Definition: unrefqueue.cpp:9
osg::ref_ptr< UnrefWorkItem > mWorkItem
Definition: unrefqueue.hpp:39