Project OpenGeode
class AttributeManager
This class manages all its associated Attributes. Each Attribute is registered and can be retrieved by a given name.
Functions
AttributeManager
public void AttributeManager(const AttributeManager & )
public void AttributeManager(const AttributeManager & )
operator=
public AttributeManager & operator=(const AttributeManager & )
public AttributeManager & operator=(const AttributeManager & )
AttributeManager
public void AttributeManager()
public void AttributeManager()
AttributeManager
public void AttributeManager(AttributeManager && other)
public void AttributeManager(AttributeManager && other)
~AttributeManager
public void ~AttributeManager()
public void ~AttributeManager()
find_generic_attribute
public shared_ptr find_generic_attribute(basic_string_view name)
public shared_ptr find_generic_attribute(basic_string_view name)
Recover the non-typed/generic Attribute from the attribute name. This can be used when attribute type is not known in a context.
name [in] The associated attribute name to look for.
return nullptr if no attribute matches the given name.
find_attribute
public std::shared_ptr<ReadOnlyAttribute<T> > find_attribute(basic_string_view name)
public std::shared_ptr<ReadOnlyAttribute<T> > find_attribute(basic_string_view name)
Recover the typed Attribute from the attribute name
name [in] The associated attribute name to look for
T The type to of the ReadOnlyAttribute element
exceptionif no Attribute found
find_or_create_attribute
public std::shared_ptr<Attribute<T> > find_or_create_attribute(basic_string_view name, T default_value, AttributeProperties properties)
public std::shared_ptr<Attribute<T> > find_or_create_attribute(basic_string_view name, T default_value, AttributeProperties properties)
Recover or create the attribute from the manager and the attribute name. If the recovered Attribute is not a of the same type than the attribute, it replaces it by the Attribute corresponding to the attribute.
name [in] The associated attribute name to look for
default_value [in] The default value to use when new attribute element are created
properties [in] The AttributeProperties to set the attribute flags for future modifications
Attribute The attribute type to look for, such as ConstantAttribute
T The type of the Attribute element
exceptionif the Attribute replacement failed
find_or_create_attribute
public std::shared_ptr<Attribute<T> > find_or_create_attribute(basic_string_view name, T default_value)
public std::shared_ptr<Attribute<T> > find_or_create_attribute(basic_string_view name, T default_value)
resize
public void resize(index_t size)
public void resize(index_t size)
Resize all the attributes to the given size
size [in] The new attribute size
reserve
public void reserve(index_t capacity)
public void reserve(index_t capacity)
Reserve all the attributes to the given capacity
size [in] The new attribute capacity
assign_attribute_value
public void assign_attribute_value(index_t from_element, index_t to_element)
public void assign_attribute_value(index_t from_element, index_t to_element)
Assign attribute value from other value in the same attribute
from_element [in] Attribute value to assign
to_element [in] Where the value is assign
warning Only affect Attributes created with its AttributeProperties assignable flag set to true
copy_attribute_value
public void copy_attribute_value(index_t from_element, index_t to_element)
public void copy_attribute_value(index_t from_element, index_t to_element)
Copy attribute value from other value in the same attribute
from_element [in] Attribute value to assign
to_element [in] Where the value is assigned
interpolate_attribute_value
public void interpolate_attribute_value(const AttributeLinearInterpolation & interpolation, index_t to_element)
public void interpolate_attribute_value(const AttributeLinearInterpolation & interpolation, index_t to_element)
Interpolate attribute value from other values in the same attribute
interpolation [in] Attribute interpolator
to_element [in] Where the value is assign
warning Only affect Attributes created with its AttributeProperties interpolable flag set to true
has_assignable_attributes
public bool has_assignable_attributes()
public bool has_assignable_attributes()
has_interpolable_attributes
public bool has_interpolable_attributes()
public bool has_interpolable_attributes()
attribute_names
public absl::FixedArray<std::string_view> attribute_names()
public absl::FixedArray<std::string_view> attribute_names()
Get all the associated attribute names
attribute_exists
public bool attribute_exists(basic_string_view name)
public bool attribute_exists(basic_string_view name)
Return true if an attribute matching the given name.
name [in] The attribute name to use
delete_attribute
public void delete_attribute(basic_string_view name)
public void delete_attribute(basic_string_view name)
Delete the attribute matching the given name. Do nothing if the name does not exist.
name [in] The attribute name to delete
attribute_type
public basic_string_view attribute_type(basic_string_view name)
public basic_string_view attribute_type(basic_string_view name)
Get the typeid name of the attribute type
name [in] The attribute name to use
rename_attribute
public void rename_attribute(basic_string_view old_name, basic_string_view new_name)
public void rename_attribute(basic_string_view old_name, basic_string_view new_name)
set_attribute_properties
public void set_attribute_properties(basic_string_view attribute_name, const AttributeProperties & new_properties)
public void set_attribute_properties(basic_string_view attribute_name, const AttributeProperties & new_properties)
clear
public void clear()
public void clear()
Remove all the attributes in the manager
clear_attributes
public void clear_attributes()
public void clear_attributes()
Clear all the attribute content. This is equivalent to calling resize( 0 ).
delete_elements
public void delete_elements(const std::vector<bool> & to_delete)
public void delete_elements(const std::vector<bool> & to_delete)
Delete a set of attribute elements.
to_delete [in] a vector of size
nb_elements().
If to_delete[e] is true, then the element e will be destroyed.
permute_elements
public void permute_elements(Span permutation)
public void permute_elements(Span permutation)
Permute attribute elements.
permutation [in] Vector of size
nb_elements().
Each value correponds to the destination index.
nb_elements
public index_t nb_elements()
public index_t nb_elements()
Get the number of elements in each attribute
copy
public void copy(const AttributeManager & attribute_manager)
public void copy(const AttributeManager & attribute_manager)
import
public void import(const AttributeManager & attribute_manager, Span old2new)
public void import(const AttributeManager & attribute_manager, Span old2new)
import
public void import(const AttributeManager & attribute_manager, const GenericMapping<index_t> & old2new_mapping)
public void import(const AttributeManager & attribute_manager, const GenericMapping<index_t> & old2new_mapping)
register_attribute_type
public void register_attribute_type(PContext & context, basic_string_view name)
public void register_attribute_type(PContext & context, basic_string_view name)