|
Easy3D 2.6.1
|
Implementation of a generic property array. More...
#include <easy3d/core/property.h>
Public Types | |
| typedef T | value_type |
| The value type of the property. | |
| typedef std::vector< value_type > | vector_type |
| The vector type of the property. | |
| typedef vector_type::reference | reference |
| The reference type of the property. | |
| typedef vector_type::const_reference | const_reference |
| The const reference type of the property. | |
Public Member Functions | |
| PropertyArray (const std::string &name, T t=T()) | |
| Constructor. | |
| void | reserve (size_t n) override |
| Reserves memory for n elements. | |
| void | resize (size_t n) override |
| Resizes storage to hold n elements. | |
| void | push_back () override |
| Extend the number of elements by one. | |
| void | reset (size_t idx) override |
| Resets an element to its default value. | |
| bool | transfer (const BasePropertyArray &other) override |
| Copies the entire properties from another property array. | |
| bool | transfer (const BasePropertyArray &other, std::size_t from, std::size_t to) override |
| Copies a property from one index to another. | |
| void | shrink_to_fit () override |
| Free unused memory. | |
| void | swap (size_t i0, size_t i1) override |
| Swaps the storage place of two elements. | |
| void | copy (size_t from, size_t to) override |
| Copies an element from one index to another. | |
| BasePropertyArray * | clone () const override |
| Returns a deep copy of the property array. | |
| BasePropertyArray * | empty_clone () const override |
| Returns an empty copy of the property array. | |
| const std::type_info & | type () const override |
| Returns the type information of the property. | |
| const T * | data () const |
| Gets a pointer to the array (does not work for T == bool). | |
| std::vector< T > & | vector () |
| Gets a reference to the underlying vector. | |
| reference | operator[] (size_t _idx) |
| Accesses the i-th element. No range check is performed. | |
| const_reference | operator[] (size_t _idx) const |
| Const access to the i-th element. No range check is performed. | |
| const bool * | data () const |
| Specialization for bool properties. It crashes the program and simply returns nullptr as bool* is not allowed. | |
Public Member Functions inherited from BasePropertyArray | |
| BasePropertyArray (const std::string &name) | |
| Default constructor. | |
| virtual | ~BasePropertyArray ()=default |
| Destructor. | |
| const std::string & | name () const |
| Returns the name of the property. | |
| void | set_name (const std::string &n) |
| Sets the name of the property. | |
| bool | is_same (const BasePropertyArray &other) const |
| Tests if two properties are the same. | |
Implementation of a generic property array.
| T | The type of the property. |
|
inlineexplicit |
Constructor.
| name | The name of the property array. |
| t | The default value of the property. |
|
inlineoverridevirtual |
Returns a deep copy of the property array.
Implements BasePropertyArray.
|
inlineoverridevirtual |
Copies an element from one index to another.
| from | The index to copy from. |
| to | The index to copy to. |
Implements BasePropertyArray.
|
inline |
Gets a pointer to the array (does not work for T == bool).
|
inlineoverridevirtual |
Returns an empty copy of the property array.
Implements BasePropertyArray.
|
inline |
Accesses the i-th element. No range check is performed.
| _idx | The index of the element. |
|
inline |
Const access to the i-th element. No range check is performed.
| _idx | The index of the element. |
|
inlineoverridevirtual |
Extend the number of elements by one.
Implements BasePropertyArray.
|
inlineoverridevirtual |
Reserves memory for n elements.
| n | The number of elements to reserve memory for. |
Implements BasePropertyArray.
|
inlineoverridevirtual |
Resets an element to its default value.
| idx | The index of the element to reset. |
Implements BasePropertyArray.
|
inlineoverridevirtual |
Resizes storage to hold n elements.
| n | The number of elements to resize to. |
Implements BasePropertyArray.
|
inlineoverridevirtual |
Free unused memory.
Implements BasePropertyArray.
|
inlineoverridevirtual |
Swaps the storage place of two elements.
| i0 | The index of the first element. |
| i1 | The index of the second element. |
Implements BasePropertyArray.
|
inlineoverridevirtual |
Copies the entire properties from another property array.
| other | The other property array to copy from. |
Implements BasePropertyArray.
|
inlineoverridevirtual |
Copies a property from one index to another.
| other | The other property array to copy from. |
| from | The index to copy from. |
| to | The index to copy to. |
Implements BasePropertyArray.
|
inlineoverridevirtual |
Returns the type information of the property.
Implements BasePropertyArray.
|
inline |
Gets a reference to the underlying vector.