Class CompositeData

Nested Relationships

Nested Types

Inheritance Relationships

Derived Type

Class Documentation

class CompositeData

A class that can store and return arbitrary data structures, as long as they are copyable.

Subclassed by rmf_task::State

Public Functions

CompositeData()

Create an empty CompositeData.

template<typename T>
InsertResult<T> insert(T &&value)

Attempt to insert some data structure into the CompositeData. If a data structure of type T already exists in the CompositeData, then this function will have no effect, and InsertResult<T>::value will point to the value that already existed in the CompositeData.

Parameters:

value[in] The value to attempt to insert.

template<typename T>
InsertResult<T> insert_or_assign(T &&value)

Insert or assign some data structure into the CompositeData. If a data structure of type T already exists in the CompositeData, then this function will overwrite it with the new value.

Parameters:

value[in] The value to insert or assign.

template<typename T>
CompositeData &with(T &&value)

Same as insert_or_assign, but *this is returned instead of the new value.

template<typename T>
T *get()

Get a reference to a data structure of type T if one is available in the CompositeData. If one is not available, this will return a nullptr.

template<typename T>
const T *get() const

Get a reference to an immutable data structure of type T if one is available in the CompositeData. If one is not available, this will return a nullptr.

template<typename T>
bool erase()

Erase the data structure of type T if one is available in the CompositeData. This will return true if it was erased, or false if type T was not available.

void clear()

Remove all data structures from this CompositeData.

template<typename T>
auto insert(T &&value) -> InsertResult<T>
template<typename T>
auto insert_or_assign(T &&value) -> InsertResult<T>
template<typename T>
struct InsertResult

The result of performing an insertion operation.

Public Members

bool inserted

True if the value was inserted. This means that an entry of value T did not already exist before you performed the insertion.

T *value

A reference to the value of type T that currently exists within the CompositeData.