Easy3D 2.6.1
|
Implementation of a generic property container. More...
#include <easy3d/core/property.h>
Public Member Functions | |
PropertyContainer () | |
Default constructor. | |
virtual | ~PropertyContainer () |
Destructor. Deletes all property arrays. | |
PropertyContainer (const PropertyContainer &_rhs) | |
Copy constructor. Performs deep copy of property arrays. | |
PropertyContainer & | operator= (const PropertyContainer &_rhs) |
Assignment operator. Performs deep copy of property arrays. | |
void | transfer (const PropertyContainer &_rhs) const |
Transfers properties from another property container. | |
void | copy_properties (const PropertyContainer &_rhs) |
Copies properties that don't already exist from another container. | |
bool | transfer (const PropertyContainer &_rhs, std::size_t from, std::size_t to) const |
Transfers one element with all properties. | |
size_t | size () const |
Returns the current size of the property arrays. | |
size_t | n_properties () const |
Returns the number of property arrays. | |
std::vector< std::string > | properties () const |
Returns a vector of all property names. | |
template<class T> | |
Property< T > | add (const std::string &name, const T t=T()) |
Adds a property with a given name and default value. | |
template<class T> | |
Property< T > | get (const std::string &name) const |
Gets a property by its name. | |
template<class T> | |
Property< T > | get_or_add (const std::string &name, const T t=T()) |
Gets or adds a property by its name. | |
const std::type_info & | get_type (const std::string &name) const |
Gets the type information of a property by its name. | |
template<class T> | |
bool | remove (Property< T > &h) |
Removes a property. | |
bool | remove (const std::string &name) |
Removes a property by its name. | |
bool | rename (const std::string &old_name, const std::string &new_name) |
Renames a property. | |
void | clear () |
Deletes all properties. | |
void | reserve (size_t n) const |
Reserves memory for n entries in all arrays. | |
void | resize (size_t n) |
Resizes all arrays to size n. | |
void | resize_property_array (size_t n) |
Resizes the vector of properties to n, deleting all other properties. | |
void | shrink_to_fit () const |
Frees unused space in all arrays. | |
void | push_back () |
Adds a new element to each vector. | |
void | reset (size_t idx) const |
Resets an element to its default property values. | |
void | swap (size_t i0, size_t i1) const |
Swaps elements i0 and i1 in all arrays. | |
void | swap (PropertyContainer &other) noexcept |
Swaps content with another property container. | |
void | copy (size_t from, size_t to) const |
Copies an element from one index to another in all arrays. | |
const std::vector< BasePropertyArray * > & | arrays () const |
Returns the vector of property arrays (read-only). | |
std::vector< BasePropertyArray * > & | arrays () |
Returns the vector of property arrays. | |
Implementation of a generic property container.
|
inline |
Copy constructor. Performs deep copy of property arrays.
_rhs | The property container to copy from. |
|
inline |
Adds a property with a given name and default value.
T | The type of the property. |
name | The name of the property. |
t | The default value of the property. |
|
inline |
Returns the vector of property arrays.
|
inline |
Returns the vector of property arrays (read-only).
|
inline |
Copies an element from one index to another in all arrays.
from | The index to copy from. |
to | The index to copy to. |
|
inline |
Copies properties that don't already exist from another container.
_rhs | The property container to copy from. |
|
inline |
Gets a property by its name.
T | The type of the property. |
name | The name of the property. |
|
inline |
Gets or adds a property by its name.
T | The type of the property. |
name | The name of the property. |
t | The default value of the property. |
|
inline |
Gets the type information of a property by its name.
name | The name of the property. |
|
inline |
Returns the number of property arrays.
|
inline |
Assignment operator. Performs deep copy of property arrays.
_rhs | The property container to assign from. |
|
inline |
Returns a vector of all property names.
|
inline |
Removes a property by its name.
name | The name of the property to remove. |
|
inline |
Removes a property.
T | The type of the property. |
h | The property to remove. |
|
inline |
Renames a property.
old_name | The current name of the property. |
new_name | The new name of the property. |
|
inline |
Reserves memory for n entries in all arrays.
n | The number of entries to reserve memory for. |
|
inline |
Resets an element to its default property values.
idx | The index of the element to reset. |
|
inline |
Resizes all arrays to size n.
n | The new size of the arrays. |
|
inline |
Resizes the vector of properties to n, deleting all other properties.
n | The new size of the property vector. |
|
inline |
Returns the current size of the property arrays.
|
inlinenoexcept |
Swaps content with another property container.
other | The other property container to swap with. |
|
inline |
Swaps elements i0 and i1 in all arrays.
i0 | The index of the first element. |
i1 | The index of the second element. |
|
inline |
Transfers properties from another property container.
_rhs | The property container to transfer from. |
|
inline |
Transfers one element with all properties.
_rhs | The property container to transfer from. |
from | The index to transfer from. |
to | The index to transfer to. |