Changeset 13041 for OpenSceneGraph/trunk/include/osg/OperationThread
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osg/OperationThread (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/OperationThread
r12139 r13041 64 64 const std::string& getName() const { return _name; } 65 65 66 /** Set whether the operation should be kept once its been applied.*/ 66 /** Set whether the operation should be kept once its been applied.*/ 67 67 void setKeep(bool keep) { _keep = keep; } 68 68 69 /** Get whether the operation should be kept once its been applied.*/ 69 /** Get whether the operation should be kept once its been applied.*/ 70 70 bool getKeep() const { return _keep; } 71 71 … … 73 73 virtual void release() {} 74 74 75 /** Do the actual task of this operation.*/ 75 /** Do the actual task of this operation.*/ 76 76 virtual void operator () (Object*) = 0; 77 77 78 78 protected: 79 79 80 80 Operation(): 81 81 Referenced(true), … … 98 98 { 99 99 public: 100 100 101 101 OperationQueue(); 102 103 /** Get the next operation from the operation queue. 104 * Return null ref_ptr<> if no operations are left in queue. */ 102 103 /** Get the next operation from the operation queue. 104 * Return null ref_ptr<> if no operations are left in queue. */ 105 105 osg::ref_ptr<Operation> getNextOperation(bool blockIfEmpty = false); 106 106 107 107 /** Return true if the operation queue is empty. */ 108 108 bool empty(); 109 109 110 110 /** Return the num of pending operations that are sitting in the OperationQueue.*/ 111 111 unsigned int getNumOperationsInQueue(); 112 112 113 /** Add operation to end of OperationQueue, this will be 113 /** Add operation to end of OperationQueue, this will be 114 114 * executed by the operation thread once this operation gets to the head of the queue.*/ 115 115 void add(Operation* operation); 116 116 117 117 /** Remove operation from OperationQueue.*/ 118 118 void remove(Operation* operation); … … 123 123 /** Remove all operations from OperationQueue.*/ 124 124 void removeAllOperations(); 125 125 126 126 /** Run the operations. */ 127 127 void runOperations(Object* callingObject=0); 128 128 129 129 /** Call release on all operations. */ 130 void releaseAllOperations(); 130 void releaseAllOperations(); 131 131 132 132 /** Release operations block that is used to block threads that are waiting on an empty operations queue.*/ … … 134 134 135 135 typedef std::set<OperationThread*> OperationThreads; 136 136 137 137 /** Get the set of OperationThreads that are sharing this OperationQueue. */ 138 138 const OperationThreads& getOperationThreads() const { return _operationThreads; } … … 143 143 144 144 friend class OperationThread; 145 145 146 146 void addOperationThread(OperationThread* thread); 147 147 void removeOperationThread(OperationThread* thread); 148 148 149 149 typedef std::list< osg::ref_ptr<Operation> > Operations; 150 150 … … 166 166 167 167 Object* getParent() { return _parent.get(); } 168 168 169 169 const Object* getParent() const { return _parent.get(); } 170 170 … … 179 179 const OperationQueue* getOperationQueue() const { return _operationQueue.get(); } 180 180 181 182 /** Add operation to end of OperationQueue, this will be 181 182 /** Add operation to end of OperationQueue, this will be 183 183 * executed by the graphics thread once this operation gets to the head of the queue.*/ 184 184 void add(Operation* operation); 185 185 186 186 /** Remove operation from OperationQueue.*/ 187 187 void remove(Operation* operation); … … 193 193 void removeAllOperations(); 194 194 195 195 196 196 /** Get the operation currently being run.*/ 197 197 osg::ref_ptr<Operation> getCurrentOperation() { return _currentOperation; } … … 199 199 /** Run does the opertion thread run loop.*/ 200 200 virtual void run(); 201 201 202 202 void setDone(bool done); 203 203 204 204 bool getDone() const { return _done; } 205 205 206 /** Cancel this graphics thread.*/ 206 /** Cancel this graphics thread.*/ 207 207 virtual int cancel(); 208 208 209 209 protected: 210 210 211 211 virtual ~OperationThread(); 212 212 213 213 observer_ptr<Object> _parent; 214 214
