A simple lock-based list implementation to append or erase data of type T.
More...
#include <rtt/internal/ListLocked.hpp>
template<class T>
class RTT::internal::ListLocked< T >
A simple lock-based list implementation to append or erase data of type T.
- Note
- The mutex used by this implementation is recursive in order to allow apply() to call apply() recursively. Erasing self (using clear() or erase()) from within apply() is not supported and may lead to abnormal program termination.
- Parameters
-
T | The value type to be stored in the list. Example : ListLocked is a list which holds values of type A. |
Definition at line 72 of file ListLocked.hpp.
Create a lock-based list wich can store lsize elements.
- Parameters
-
lsize | the initial capacity of the list. |
Definition at line 96 of file ListLocked.hpp.
Append a single value to the list.
- Parameters
-
- Returns
- false if the list is full.
Definition at line 182 of file ListLocked.hpp.
Append a sequence of values to the list.
- Parameters
-
items | the values to append. |
- Returns
- the number of values written (may be less than items.size())
Definition at line 214 of file ListLocked.hpp.
template<class T>
template<class Function >
Apply a function to the elements of the whole list.
- Parameters
-
func | The function to apply. |
- Note
- func may not call clear() or erase() on the current element of this list.
Definition at line 274 of file ListLocked.hpp.
template<class T>
template<typename Pred >
Erase a value from the list.
- Parameters
-
function | each elements for which pred returns true are removed |
- Returns
- true if at least one element has been removed
- Note
- This function is only real-time if the destructor and copy-constructor of of T is real-time.
Definition at line 245 of file ListLocked.hpp.
Erase a value from the list.
- Parameters
-
item | is to be erased from the list. |
- Returns
- true if found and erased.
Definition at line 230 of file ListLocked.hpp.
template<class T>
template<class Function >
Find an item in the list such that func( item ) == true.
- Parameters
-
blank | The value to return if not found. |
- Returns
- The item that matches func(item) or blank if none matches.
Definition at line 288 of file ListLocked.hpp.
Returns the first element of the list.
Definition at line 194 of file ListLocked.hpp.
Grow the capacity to contain at least n additional items.
This method tries to avoid too much re-allocations, by growing a bit more than required every N invocations and growing nothing in between.
- Parameters
-
items | The number of items to at least additionally reserve. |
Definition at line 136 of file ListLocked.hpp.
Reserve a capacity for this list.
- Parameters
-
lsize | the minimal number of items this list will be able to hold. Will not drop below the current capacity() and this method will do nothing if lsize < this->capacity(). |
Definition at line 163 of file ListLocked.hpp.
Shrink the capacity with at most n items.
This method does not actually free memory, it just prevents a (number of) subsequent grow() invocations to allocate more memory.
- Parameters
-
items | The number of items to at most remove from the capacity. |
Definition at line 152 of file ListLocked.hpp.
The documentation for this class was generated from the following file: