16 #ifndef SURGSIM_DATASTRUCTURES_NAMEDDATABUILDER_H 17 #define SURGSIM_DATASTRUCTURES_NAMEDDATABUILDER_H 21 #include "SurgSim/DataStructures/NamedData.h" 25 namespace DataStructures
50 std::shared_ptr<IndexDirectory> dir = std::make_shared<IndexDirectory>();
60 return std::make_shared<NamedData<T>>(
createData());
76 for (
auto it = names.cbegin(); it != names.cend(); ++it)
120 return m_directory.
getName(index);
144 return m_directory.
size();
163 #endif // SURGSIM_DATASTRUCTURES_NAMEDDATABUILDER_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
std::shared_ptr< NamedData< T > > createSharedData() const
Produces a shared pointer to an empty NamedData object with an immutable set of names and indices...
Definition: NamedDataBuilder.h:58
const std::vector< std::string > & getAllNames() const
Get a list of all the names available from the index directory.
Definition: IndexDirectory.cpp:36
std::shared_ptr< const IndexDirectory > getDirectory() const
Return the object's layout directory, which is its collection of names and indices.
Definition: NamedData-inl.h:127
bool hasEntry(const std::string &name) const
Check whether the specified name exists in the builder.
Definition: NamedDataBuilder.h:134
A templated dictionary in which data can be accessed by name or index, with immutable names & indices...
Definition: NamedData.h:102
void addEntriesFrom(const std::vector< std::string > &names)
Create new entries from a vector of names.
Definition: NamedDataBuilder.h:74
void addEntriesFrom(const NamedDataBuilder< U > &builder)
Create new entries from another NamedDataBuilder.
Definition: NamedDataBuilder.h:86
A class that allows you to build a NamedData structure.
Definition: NamedDataBuilder.h:36
const std::vector< std::string > & getAllNames() const
Get a list of all the names available in the builder.
Definition: NamedDataBuilder.h:125
int addEntry(const std::string &name)
Create a new entry for the specified name.
Definition: IndexDirectory.cpp:53
int getIndex(const std::string &name) const
Given a name, return the corresponding index (or -1).
Definition: IndexDirectory.h:45
int addEntry(const std::string &name)
Creates a new entry for the specified name.
Definition: NamedDataBuilder.h:67
A simple bidirectional mapping between names (strings) and distinct consecutive non-negative indices...
Definition: IndexDirectory.h:32
size_t size() const
Check the number of existing entries in the directory.
Definition: IndexDirectory.h:93
int getIndex(const std::string &name) const
Given a name, return the corresponding index (or -1).
Definition: NamedDataBuilder.h:110
NamedData< T > createData() const
Produces a NamedData object with an immutable set of names and indices.
Definition: NamedDataBuilder.h:47
NamedDataBuilder()
Constructs an empty builder object.
Definition: NamedDataBuilder.h:40
int getNumEntries() const
Check the number of existing entries in the builder.
Definition: NamedDataBuilder.h:150
std::string getName(int index) const
Given an index, return the corresponding name (or "").
Definition: NamedDataBuilder.h:118
bool hasEntry(const std::string &name) const
Check whether the specified name exists in the directory.
Definition: IndexDirectory.h:85
size_t size() const
Check the number of existing entries in the builder.
Definition: NamedDataBuilder.h:142
std::string getName(int index) const
Given an index, return the corresponding name (or "").
Definition: IndexDirectory.h:65
void addEntriesFrom(const IndexDirectory &directory)
Create new entries from an IndexDirectory.
Definition: NamedDataBuilder.h:102
int getNumEntries() const
Check the number of existing entries in the directory.
Definition: IndexDirectory.h:101
void addEntriesFrom(const NamedData< U > &data)
Create new entries from an already initialized NamedData.
Definition: NamedDataBuilder.h:95