This object represents the default queue implementation used by Orocos objects. More...
#include <rtt/List.hpp>
Public Types | |
| typedef T | value_t |
Public Member Functions | |
| List (int qsize, int t=ORONUM_OS_MAX_THREADS) | |
| Create a queue of fixed size. | |
| size_t | capacity () const |
| size_t | size () const |
| bool | empty () const |
| void | grow (size_t items=1) |
| Grow the capacity to contain at least n additional items. | |
| void | shrink (size_t items=1) |
| Shrink the capacity with at most n items. | |
| void | reserve (size_t lsize) |
| Reserve a capacity for this list. | |
| void | clear () |
| bool | append (value_t item) |
| Append a single value to the list. | |
| size_t | append (const std::vector< T > &items) |
| Append a sequence of values to the list. | |
| value_t | front () const |
| Returns the first element of the list. | |
| value_t | back () const |
| Returns the last element of the list. | |
| bool | erase (value_t item) |
| Erase a value from the list. | |
| template<class Function > | |
| void | apply (Function func) |
| Apply a function to the elements of the whole list. | |
| template<class Function > | |
| void | apply_and_blank (Function func, value_t blank) |
| Apply a function to the non-blanked elements of the list. | |
| bool | erase_and_blank (value_t item, value_t blank) |
| Erase an element from the list and blank it if possible. | |
| template<class Function > | |
| value_t | find_if (Function func, value_t blank=value_t()) |
| Find an item in the list such that func( item ) == true. | |
Public Attributes | |
| const unsigned int | MAX_THREADS |
| The maximum number of threads. | |
This object represents the default queue implementation used by Orocos objects.
Definition at line 25 of file List.hpp.
| size_t RTT::ListLockFree< T >::append | ( | const std::vector< T > & | items | ) | [inline, inherited] |
Append a sequence of values to the list.
| items | the values to append. |
Definition at line 369 of file ListLockFree.hpp.
| bool RTT::ListLockFree< T >::append | ( | value_t | item | ) | [inline, inherited] |
Append a single value to the list.
| d | the value to write |
Definition at line 316 of file ListLockFree.hpp.
| void RTT::ListLockFree< T >::apply | ( | Function | func | ) | [inline, inherited] |
Apply a function to the elements of the whole list.
| func | The function to apply. |
Definition at line 443 of file ListLockFree.hpp.
| void RTT::ListLockFree< T >::apply_and_blank | ( | Function | func, | |
| value_t | blank | |||
| ) | [inline, inherited] |
Apply a function to the non-blanked elements of the list.
If during an apply_and_blank, the erase_and_blank function is called, that element will not be subject to func if not yet processed. You must not call this function concurrently from multiple threads.
| func | The function to apply. | |
| blank | The 'blank' item. Each item of this list will be compared to this item using operator==(), if it matches, it is considered blank, and func is not applied. |
Definition at line 469 of file ListLockFree.hpp.
| bool RTT::ListLockFree< T >::erase | ( | value_t | item | ) | [inline, inherited] |
Erase a value from the list.
| item | is to be erased from the list. |
Definition at line 404 of file ListLockFree.hpp.
Referenced by RTT::ListLockFree< detail::EventCatcher * >::erase_and_blank().
| bool RTT::ListLockFree< T >::erase_and_blank | ( | value_t | item, | |
| value_t | blank | |||
| ) | [inline, inherited] |
Erase an element from the list and blank it if possible.
If during an apply_and_blank, the erase_and_blank function is called, that element will not be subject to func if not yet processed. You may call this function concurrently from multiple threads.
| item | The item to erase from the list. | |
| blank | The 'blank' item to use to blank item from the list. |
Definition at line 512 of file ListLockFree.hpp.
| value_t RTT::ListLockFree< T >::find_if | ( | Function | func, | |
| value_t | blank = value_t() | |||
| ) | [inline, inherited] |
Find an item in the list such that func( item ) == true.
| blank | The value to return if not found. |
Definition at line 539 of file ListLockFree.hpp.
| void RTT::ListLockFree< T >::grow | ( | size_t | items = 1 |
) | [inline, inherited] |
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.
| items | The number of items to at least additionally reserve. |
Definition at line 207 of file ListLockFree.hpp.
| void RTT::ListLockFree< T >::reserve | ( | size_t | lsize | ) | [inline, inherited] |
Reserve a capacity for this list.
If you wish to invoke this method concurrently, guard it with a mutex. The other methods may be invoked concurrently with this method.
| 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 233 of file ListLockFree.hpp.
Referenced by RTT::ListLockFree< detail::EventCatcher * >::grow().
| void RTT::ListLockFree< T >::shrink | ( | size_t | items = 1 |
) | [inline, inherited] |
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.
| items | The number of items to at most remove from the capacity. |
Definition at line 220 of file ListLockFree.hpp.
const unsigned int RTT::ListLockFree< T >::MAX_THREADS [inherited] |
The maximum number of threads.
The number of threads which may concurrently access this buffer.
Definition at line 89 of file ListLockFree.hpp.
1.6.3