3 #include <cgv/base/action.h>
14 std::vector<X*>& result;
19 x = p->get_interface<X>();
44 template <
class X,
typename T>
50 std::vector<T*> instances;
51 cgv::base::find_interface<T>(
base_ptr(start), instances);
52 if (instances.empty())
54 pointer = instances[i < instances.size() ? i : instances.size() - 1];
class used to traverse a tree structure
Definition: traverser.h:102
bool ensure_by_find(X *start, T *&pointer, unsigned i=0)
traverse the hierarchy to find the i-th instance of type T and set pointer to it but only in case poi...
Definition: find_action.h:45
action(bool _default_result_begin, bool _default_result_end)
construct with default return values for the begin and end method
Definition: action.cxx:6
data::ref_ptr< base, true > base_ptr
ref counted pointer to base
Definition: base.h:37
bool begin()
perform the enter part of the action on the current object
Definition: find_action.h:21
simple action implementation that adds nodes implementing X to a results vector
Definition: find_action.h:11
void find_interface(base_ptr start, std::vector< X * > &result)
collect all nodes that implement interface X
Definition: find_action.h:38
void select(base_ptr p)
make the passed object current
Definition: find_action.h:18
bool traverse(base_ptr start, traverse_callback_handler *tch=0)
traverse a tree starting at given node according to set strategy, order and dest and previously comin...
Definition: traverser.cxx:373
bool implements_action() const
check if the current object implements the interface needed for this action
Definition: find_action.h:31
the cgv namespace
Definition: vr_calib.cxx:9