A class that allows you to build a NamedData structure.
More...
#include <NamedDataBuilder.h>
template<typename T>
class SurgSim::DataStructures::NamedDataBuilder< T >
A class that allows you to build a NamedData structure.
Since the data layout of a NamedData object cannot be modified, this class can be helpful in initially setting up the names and their corresponding indices. You can add entries to the builder using addEntry and addEntriesFrom calls, then create the NamedData instance with createData() or createSharedData().
- See also
- NamedData
§ addEntriesFrom() [1/4]
Create new entries from a vector of names.
- Parameters
-
§ addEntriesFrom() [2/4]
template<typename T>
template<typename U >
Create new entries from another NamedDataBuilder.
- Template Parameters
-
- Parameters
-
builder | The other builder. |
§ addEntriesFrom() [3/4]
template<typename T>
template<typename U >
Create new entries from an already initialized NamedData.
- Template Parameters
-
- Parameters
-
§ addEntriesFrom() [4/4]
Create new entries from an IndexDirectory.
- Parameters
-
directory | The index directory object. |
§ addEntry()
Creates a new entry for the specified name.
- Parameters
-
name | The name, which should be non-empty and should not already exist in the data. |
- Returns
- the index of the created entry, or -1 if the entry could not be added.
§ createData()
Produces a NamedData object with an immutable set of names and indices.
None of the values will contain any current data.
- Returns
- the NamedData object by value.
§ createSharedData()
Produces a shared pointer to an empty NamedData object with an immutable set of names and indices.
None of the values will contain any current data.
- Returns
- a shared pointer to the NamedData object.
§ getAllNames()
Get a list of all the names available in the builder.
- Returns
- all the names.
§ getIndex()
Given a name, return the corresponding index (or -1).
- Parameters
-
- Returns
- the index for that name if one exists; -1 otherwise.
§ getName()
Given an index, return the corresponding name (or "").
- Parameters
-
- Returns
- the name for that index if one exists; an empty string otherwise.
§ getNumEntries()
Check the number of existing entries in the builder.
- Returns
- the number of entries.
- See also
- size()
§ hasEntry()
Check whether the specified name exists in the builder.
- Parameters
-
- Returns
- true if the entry exists.
§ size()
Check the number of existing entries in the builder.
- Returns
- the number of entries.
- See also
- getNumEntries()
The documentation for this class was generated from the following file: