|
#include <SynchronizedMap.h>
Public Types | |
| using | CallbackFunction = std::function< bool(const K &key, T &item)> |
Public Member Functions | |
| virtual void | insert (const K &key, const T &data) |
| virtual bool | get (const K &key, T &item, bool remove=false) |
| virtual bool | remove (const K &key) |
| bool | empty () const |
| size_t | size () const |
| void | clear () |
| bool | for_each (CallbackFunction callbackFunction) |
Synchronized map
Simple thread-safe map
| using sptk::SynchronizedMap< K, T >::CallbackFunction = std::function<bool(const K& key, T& item)> |
Map callback function used in each() method.
Iterates through list until false is returned.
| key | const K&, Map item key |
| item | T&, Map item |
| data | void*, Optional function-specific data |
|
inline |
Removes all items from the list
|
inline |
Returns true if the list is empty
|
inline |
Calls callbackFunction() for every list until false is returned
| callbackFunction | Callback function that is executed for list items |
|
inlinevirtual |
Finds a data item from the list front
Returns true if key exists and data populated.
| key | A data key |
| item | A list item (output) |
| remove | If true, then item is removed from map |
References sptk::SynchronizedMap< K, T >::remove().
|
inlinevirtual |
Inserts data item to the map
| key | const K&, A data key |
| data | const T&, A data item |
|
inlinevirtual |
Removes data with matching key
Returns true if key existed.
| key | const K&, A data key |
Referenced by sptk::SynchronizedMap< K, T >::get().
|
inline |
Returns number of items in the list