25 #ifndef WGEGROUPNODE_H
26 #define WGEGROUPNODE_H
31 #include <boost/thread.hpp>
34 #include <osg/MatrixTransform>
35 #include <osg/NodeCallback>
37 #include "../common/WPredicateHelper.h"
64 void insert( osg::ref_ptr< osg::Node > node );
71 void remove( osg::ref_ptr< osg::Node > node );
85 void remove_if( boost::shared_ptr< WGEGroupNode::NodePredicate > predicate );
113 virtual void operator()( osg::Node* node, osg::NodeVisitor* nv );
193 #endif // WGEGROUPNODE_H
Update callback which inserts and removes nodes from m_childRemovalQueue and m_childInsertionQueue to...
remove all items where the predicate evaluates to true
virtual ~WGEGroupNode()
Destructor.
osg::ref_ptr< osg::Node > m_item
the item to delete/add
remove the specified node
A struct denoting an operation on this group.
virtual void operator()(osg::Node *node, osg::NodeVisitor *nv)
Callback method called by the NodeVisitor when visiting a node.
std::queue< boost::shared_ptr< ChildOperation > > m_childOperationQueue
Queue of childs that need to be added/removed during the next update cycle.
boost::shared_ptr< NodePredicate > m_predicate
the predicate used by conditional operations
boost::shared_mutex m_childOperationQueueLock
Lock used for inserting and removing childs into the child insertion/removal queue.
void insert(osg::ref_ptr< osg::Node > node)
Adds the specified node to the child list of this node in a safe manner.
ChildOperation(ChildOperationType what, boost::shared_ptr< NodePredicate > predicate)
Constructs instance and fills members properly.
WPredicateHelper::ArbitraryPredicateBase< osg::ref_ptr< osg::Node > const > NodePredicate
The base type of predicate.
osg::ref_ptr< SafeUpdaterCallback > m_nodeUpdater
Node callback used to update this root node.
ChildOperation(ChildOperationType what, osg::ref_ptr< osg::Node > item)
Constructs instance and fills members properly.
Class to wrap around the osg Group node and providing a thread safe add/removal mechanism.
void clear()
Removes all children from this node.
WGEGroupNode()
Default constructor.
bool m_removeAll
True whenever all child nodes should be removed.
insert the specified node
ChildOperationType
The type of operation to perform.
ChildOperationType m_operation
the operation to take
bool m_childOperationQueueDirty
Flag denoting whether the m_childOperationQueue should be considered during the next update of the no...
void remove_if(boost::shared_ptr< WGEGroupNode::NodePredicate > predicate)
Removes a node if the specified predicate evaluates to true.
This class builds the base for wrapping around nearly every possible predicates like functors...