![]() |
API
4.0
For C++ developers
|
Collection (linked list) of components to iterate through.
More...
Public Member Functions | |
ComponentList (const Component &root, const ComponentFilter &f) | |
Constructor that takes a Component to iterate over (itself and its descendants) and a ComponentFilter. More... | |
ComponentList (const Component &root) | |
Constructor that takes only a Component to iterate over (itself and its descendants). More... | |
virtual | ~ComponentList () |
Destructor of ComponentList. More... | |
iterator | begin () |
Return an iterator pointing to the first component in the tree traversal of components under and including the root component passed to the ComponentList constructor. More... | |
const_iterator | begin () const |
Same as cbegin(). More... | |
const_iterator | cbegin () const |
Similar to begin(), except it does not permit modifying the elements of the list, even if T is non-const (e.g., ComponentList<Body>). More... | |
iterator | end () |
Use this method to check if you have reached the end of the list. More... | |
const_iterator | end () const |
Same as cend(). More... | |
const_iterator | cend () const |
Use this method to check if you have reached the end of the list. More... | |
void | setFilter (const ComponentFilter &filter) |
Allow users to specify a custom ComponentFilter. More... | |
Public Types | |
typedef std::add_const< T >::type | ConstT |
typedef ComponentListIterator< ConstT > | const_iterator |
A const forward iterator for iterating through ComponentList<T>. More... | |
typedef ComponentListIterator< T > | iterator |
If T is const (e.g., ComponentList<const Body>), then this is the same as const_iterator, and does not allow modifying the elements. More... | |
Collection (linked list) of components to iterate through.
Typical use is to call getComponentList() on a component (e.g. model) to obtain an instance of this class, then call begin() to get an iterator pointing to the first entry in the list then increment the iterator until end(). The linked list is formed by tree pre-order traversal where each component is visited followed by all its immediate subcomponents (recursively).
The traversal order is wired via Component::initComponentTreeTraversal(), which is called just before getting a ComponentList from a Component, either via Component::getComponentList() or Component::updComponentList().
typedef ComponentListIterator<ConstT> OpenSim::ComponentList< T >::const_iterator |
A const forward iterator for iterating through ComponentList<T>.
The const indicates that the iterator provides only const references/pointers, and that components can't be modified through this iterator.
typedef std::add_const<T>::type OpenSim::ComponentList< T >::ConstT |
typedef ComponentListIterator<T> OpenSim::ComponentList< T >::iterator |
If T is const (e.g., ComponentList<const Body>), then this is the same as const_iterator, and does not allow modifying the elements.
If T is not const, then this iterator allows modifying the elements.
|
inline |
Constructor that takes a Component to iterate over (itself and its descendants) and a ComponentFilter.
You can change the filter later using the setFilter() method. The filter is cloned on construction and can only be changed using setFilter().
|
inline |
Constructor that takes only a Component to iterate over (itself and its descendants).
ComponentFilterMatchAll is used internally. You can change the filter using setFilter() method.
|
inlinevirtual |
Destructor of ComponentList.
|
inline |
Return an iterator pointing to the first component in the tree traversal of components under and including the root component passed to the ComponentList constructor.
If T is non-const, then this iterator allows you to modify the elements of this list.
|
inline |
Same as cbegin().
|
inline |
Similar to begin(), except it does not permit modifying the elements of the list, even if T is non-const (e.g., ComponentList<Body>).
|
inline |
Use this method to check if you have reached the end of the list.
This points past the end of the list, not to the last item in the list. Use this if you used cbegin().
Referenced by OpenSim::ComponentList< T >::end().
|
inline |
Use this method to check if you have reached the end of the list.
This points past the end of the list, not to the last item in the list.
|
inline |
Same as cend().
References OpenSim::ComponentList< T >::cend().
|
inline |
Allow users to specify a custom ComponentFilter.
This object makes a clone of the passed in filter.