Visual Computing Library
|
Public Member Functions | |
void | clear () |
Removes all the custom component vectors stored in the mMap. | |
void | reserve (uint size) |
For each custom component vector, it reserves the given size. | |
void | resize (uint size) |
For each custom component vector, it resizes the vector to the given size. | |
void | compact (const std::vector< uint > &newIndices) |
Compacts each custom component vector according to the given indices. | |
template<typename CompType > | |
void | addNewComponent (const std::string &name, uint size) |
Adds a new vector of custom components having the given size, the given name and with the template argumet CompType. | |
void | deleteComponent (const std::string &name) |
Deletes the custom component vector with the given name. It does nothing if the element does not exist. | |
void | assertComponentExists (const std::string &compName) const |
Asserts that the compName component exists. | |
bool | componentExists (const std::string &compName) const |
Returns true if the compName exists. | |
std::vector< std::string > | allComponentNames () const |
Returns a vector of std::string containing all the custom components, regardless the types of the custom components. | |
template<typename CompType > | |
bool | isComponentOfType (const std::string &compName) const |
Returns true if the type associated to the compName custom component is the same of the given template argument CompType. | |
std::type_index | componentType (const std::string &compName) const |
Returns the std::type_index of the type of the CustomComponent having the input name. | |
template<typename CompType > | |
std::vector< std::string > | allComponentNamesOfType () const |
Returns a vector of strings of all the custom components having as type the given template argument CompType. | |
template<typename CompType > | |
const std::vector< std::any > & | componentVector (const std::string &compName) const |
Returns a const reference of std::vector<std::any> of the custom component with the given name and the given template argument CompType. | |
template<typename CompType > | |
std::vector< std::any > & | componentVector (const std::string &compName) |
Returns a reference of std::vector<std::any> of the custom component with the given name and the given template argument CompType. | |
void | importSameCustomComponentFrom (uint thisPos, uint otherPos, const std::string &compName, const CustomComponentsVectorMap< true > &other) |
Private Member Functions | |
template<typename CompType > | |
void | checkComponentType (const std::string &compName) const |
Private Attributes | |
std::unordered_map< std::string, std::vector< std::any > > | mMap |
std::unordered_map< std::string, bool > | mNeedToInitialize |
std::unordered_map< std::string, std::type_index > | mCompType |
|
inline |
Adds a new vector of custom components having the given size, the given name and with the template argumet CompType.
Data is initialized with the empty constructor of CompType.
CompType | the type of the newly added custom component. |
[in] | name | the unique name of the custom component. |
[in] | size | the initial size of the custom component vector. |
|
inline |
Returns a vector of std::string containing all the custom components, regardless the types of the custom components.
|
inline |
Returns a vector of strings of all the custom components having as type the given template argument CompType.
CompType | the type of the custom components to return. |
|
inline |
Asserts that the compName component exists.
[in] | compName | the name of the custom component to check. |
|
inline |
Compacts each custom component vector according to the given indices.
All the indices of the newIndices vector with value UINT_NULL are considered as deleted, and the corresponding elements in the custom component vectors are removed. The remaining indices are compacted, and the custom component vectors are resized to the new size.
[in] | newIndices | a vector that tells, for each element index, the new index of the element, and UINT_NULL if the element has been deleted. |
|
inline |
Returns true if the compName exists.
[in] | compName | the name of the custom component to check. |
|
inline |
Returns the std::type_index of the type of the CustomComponent having the input name.
std::out_of_range | if the compName does not exist. |
[in] | compName | the name of the custom component. |
|
inline |
Returns a reference of std::vector<std::any> of the custom component with the given name and the given template argument CompType.
If the CompType does not mach with the type associated with compName, thows a vcl::BadCustomComponentTypeException.
This function will initialize all the uninitialized values of the accessed custom component.
CompType | the type of the custom component to return. |
[in] | compName | the name of the custom component to return. |
|
inline |
Returns a const reference of std::vector<std::any> of the custom component with the given name and the given template argument CompType.
If the CompType does not mach with the type associated with compName, thows a vcl::BadCustomComponentTypeException.
CompType | the type of the custom component to return. |
[in] | compName | the name of the custom component to return. |
|
inline |
Deletes the custom component vector with the given name. It does nothing if the element does not exist.
[in] | name | the name of the custom component vector to delete. |
|
inline |
Returns true if the type associated to the compName custom component is the same of the given template argument CompType.
CompType | the type to check. |
[in] | compName | the name of the custom component to check. |
|
inline |
For each custom component vector, it reserves the given size.
[in] | size | the size to reserve for each custom component vector. |
|
inline |
For each custom component vector, it resizes the vector to the given size.
[in] | size | the size to reserve for each custom component vector. |