Class uipc::geometry::AttributeCollection
ClassList > uipc > geometry > AttributeCollection
A collection of geometries attributes. More...
#include <attribute_collection.h>
Public Functions
Type | Name |
---|---|
AttributeCollection () = default |
|
AttributeCollection (const AttributeCollection &) |
|
AttributeCollection (AttributeCollection &&) noexcept |
|
SizeT | attribute_count () const Get the number of attribute slots. |
void | clear () clear the underlying attribute values of all attribute slots, the attribute slots will not be destroyed. |
void | copy_from (const AttributeCollection & other, const AttributeCopy & copy, span< const string > include_names={}, span< const string > exclude_names={}) copy_from the underlying attribute values of all attribute slots. |
S< AttributeSlot< T > > | create (std::string_view name, const T & default_value={}, bool allow_destroy=true) Create a new attribute slot of type T with a given name. |
void | destroy (std::string_view name) Remove the attribute slot with the given name. |
S< IAttributeSlot > | find (std::string_view name) Find the attribute slot with the given name. |
S< const IAttributeSlot > | find (std::string_view name) const const version of find. |
S< AttributeSlot< T > > | find (std::string_view name) Template version of find. |
S< const AttributeSlot< T > > | find (std::string_view name) const Template const version of find. |
vector< string > | names () const Get the names of all attribute slots. |
AttributeCollection & | operator= (const AttributeCollection &) |
AttributeCollection & | operator= (AttributeCollection &&) noexcept |
void | reorder (span< const SizeT > O) Reorder the underlying attribute values of all attribute slots. |
void | reserve (SizeT N) Reserve memory for all attribute slots. |
void | resize (SizeT N) Resize all attribute slots to the given size. |
S< IAttributeSlot > | share (std::string_view name, const IAttributeSlot & slot, bool allow_destroy=true) Share the underlying attribute of the given slot with a new name. |
S< AttributeSlot< T > > | share (std::string_view name, const AttributeSlot< T > & slot, bool allow_destroy=true) Template version of share. |
SizeT | size () const Get the size of the attribute slots. |
Json | to_json () const Get the json representation of the attribute collection. |
Detailed Description
All geometries attributes in the collection always have the same size.
Public Functions Documentation
function AttributeCollection [1/3]
function AttributeCollection [2/3]
function AttributeCollection [3/3]
function attribute_count
function clear
clear the underlying attribute values of all attribute slots, the attribute slots will not be destroyed.
Note:
This method may generate data clones.
function copy_from
copy_from the underlying attribute values of all attribute slots.
void uipc::geometry::AttributeCollection::copy_from (
const AttributeCollection & other,
const AttributeCopy & copy,
span< const string > include_names={},
span< const string > exclude_names={}
)
Parameters:
O
A New2Old mapping. O[i] = j means the i-th element in the new order has the value of the j-th element in the old order.include_names
The names of the attribute slots to be copied. If it is empty, all attribute slots will be copied.exclude_names
The names of the attribute slots not to be copied, the exclude_names has higher priority than include_names.
function create
Create a new attribute slot of type T with a given name.
template<typename T>
S< AttributeSlot < T > > uipc::geometry::AttributeCollection::create (
std::string_view name,
const T & default_value={},
bool allow_destroy=true
)
Template parameters:
T
The type of the attribute values.
Parameters:
name
The name of the attribute slot.
Returns:
The created attribute slot.
function destroy
Remove the attribute slot with the given name.
The underlying attribute will not be destroyed if it is shared by other attribute slots.
@danger Accessing the removed attribute slot will cause undefined behavior. It's user's responsibility to ensure that the removed attribute slot is not accessed.
Parameters:
name
function find [1/4]
Find the attribute slot with the given name.
Parameters:
name
The name of the attribute slot.
Returns:
The attribute slot with the given name.
Returns:
nullptr if the attribute slot with the given name does not exist.
function find [2/4]
function find [3/4]
template<typename T>
S< AttributeSlot < T > > uipc::geometry::AttributeCollection::find (
std::string_view name
)
function find [4/4]
template<typename T>
S< const AttributeSlot < T > > uipc::geometry::AttributeCollection::find (
std::string_view name
) const
function names
function operator=
AttributeCollection & uipc::geometry::AttributeCollection::operator= (
const AttributeCollection &
)
function operator=
AttributeCollection & uipc::geometry::AttributeCollection::operator= (
AttributeCollection &&
) noexcept
function reorder
Reorder the underlying attribute values of all attribute slots.
Parameters:
O
A New2Old mapping. O[i] = j means the i-th element in the new order has the value of the j-th element in the old order.
Note:
This method may generate data clones.
function reserve
Reserve memory for all attribute slots.
Note:
This method generates no data clone. But the memory of the underlying attribute values may be reallocated.
function resize
Resize all attribute slots to the given size.
Note:
This method may generate data clones.
function share [1/2]
Share the underlying attribute of the given slot with a new name.
S< IAttributeSlot > uipc::geometry::AttributeCollection::share (
std::string_view name,
const IAttributeSlot & slot,
bool allow_destroy=true
)
The slot may be from another geometries attribute collection or just current geometries attribute collection.
Parameters:
name
The name of the attribute slot.slot
The slot brings the underlying attribute.
Returns:
The new created attribute slot.
Exception:
AttributeAlreadyExist
if the attribute with the given name already exists.
function share [2/2]
template<typename T>
S< AttributeSlot < T > > uipc::geometry::AttributeCollection::share (
std::string_view name,
const AttributeSlot < T > & slot,
bool allow_destroy=true
)
function size
function to_json
Friends Documentation
friend formatter< AttributeCollection >
struct uipc::geometry::AttributeCollection::formatter< AttributeCollection > (
fmt::formatter< AttributeCollection >
)
The documentation for this class was generated from the following file include/uipc/geometry/attribute_collection.h