Graphite
Version 3
An experimental 3D geometry processing program
|
Base class for Attributes, that manipulates an attribute stored in an AttributesManager. More...
#include <geogram/basic/attributes.h>
Public Member Functions | |
AttributeBase () | |
Creates an uninitialized (unbound) Attribute. | |
AttributeBase (AttributesManager &manager, const std::string &name) | |
Creates or retrieves a persistent attribute attached to a given AttributesManager. More... | |
bool | is_bound () const |
Tests whether an Attribute is bound. More... | |
void | unbind () |
Unbinds this Attribute. More... | |
void | bind (AttributesManager &manager, const std::string &name) |
Binds this Attribute to an AttributesManager. More... | |
bool | bind_if_is_defined (AttributesManager &manager, const std::string &name) |
Binds this Attribute to an AttributesManager if it already exists in the AttributesManager. More... | |
bool | bind_if_is_compatible (AttributesManager &manager, const std::string &name) |
Binds this Attribute to an AttributesManager if it already exists in the AttributesManager and tyopes are compatible. More... | |
void | create_vector_attribute (AttributesManager &manager, const std::string &name, index_t dimension) |
Creates and binds a new vector attribute. More... | |
void | destroy () |
Destroys this attribute in the AttributesManager. More... | |
void | redim (index_t new_dim) |
Sets the dimension. More... | |
~AttributeBase () | |
Attribute destructor. More... | |
index_t | size () const |
Gets the size. More... | |
void | zero () |
Sets all the elements of this Attribute to zero. | |
bool | can_get_vector () |
Tests whether get_vector() can be called on this Attribute. More... | |
vector< T > & | get_vector () |
Gets a reference to the internal vector<T> used to store the attribute. More... | |
const vector< T > & | get_vector () const |
Gets a const reference to the internal vector<T> used to store the attribute. More... | |
AttributesManager * | manager () const |
Gets the AttributesManager this Attribute is bound to. More... | |
Public Member Functions inherited from GEO::AttributeStoreObserver | |
AttributeStoreObserver () | |
Creates a new uninitialied AttributeStore. | |
void | notify (Memory::pointer base_addr, index_t size, index_t dim) |
Callback function, called by the AttributeStore whenever it is modified. More... | |
index_t | size () const |
Gets the size. More... | |
index_t | dimension () const |
Gets the dimension. More... | |
index_t | nb_elements () const |
Gets the total number of elements. More... | |
void | register_me (AttributeStore *store) |
Registers this observer to an AttributeStore. More... | |
void | unregister_me (AttributeStore *store) |
Unregisters this observer from an AttributeStore. More... | |
void | disconnect () |
Disconnects this AttributeStoreObserver from its AttributeStore. More... | |
Static Public Member Functions | |
static bool | is_defined (AttributesManager &manager, const std::string &name, index_t dim=0) |
Tests whether an attribute with the specified name and with corresponding type exists in an AttributesManager. More... | |
Protected Attributes | |
AttributesManager * | manager_ |
AttributeStore * | store_ |
Protected Attributes inherited from GEO::AttributeStoreObserver | |
Memory::pointer | base_addr_ |
index_t | size_ |
index_t | dimension_ |
bool | disconnected_ |
Base class for Attributes, that manipulates an attribute stored in an AttributesManager.
Definition at line 1108 of file attributes.h.
|
inline |
Creates or retrieves a persistent attribute attached to a given AttributesManager.
If the attribute already exists with the specified name in the AttributesManager then it is retrieved, else it is created and bound to the name.
[in] | manager | a reference to the AttributesManager |
[in] | name | name of the attribute |
Definition at line 1128 of file attributes.h.
|
inline |
Attribute destructor.
The attribute is not destroyed, it can be retrieved later by binding with the same name. To destroy the attribute, use destroy() instead.
Definition at line 1285 of file attributes.h.
|
inline |
Binds this Attribute to an AttributesManager.
If the attribute already exists with the specified name in the AttributesManager then it is retrieved, else it is created and bound to the name.
[in] | manager | a reference to the AttributesManager |
[in] | name | name of the attribute |
Definition at line 1168 of file attributes.h.
|
inline |
Binds this Attribute to an AttributesManager if it already exists in the AttributesManager and tyopes are compatible.
[in] | manager | a reference to the AttributesManager |
[in] | name | name of the attribute |
true
if this Attribute was successfully bound Definition at line 1212 of file attributes.h.
|
inline |
Binds this Attribute to an AttributesManager if it already exists in the AttributesManager.
[in] | manager | a reference to the AttributesManager |
[in] | name | name of the attribute |
true
if this Attribute was successfully bound Definition at line 1190 of file attributes.h.
|
inline |
Tests whether get_vector() can be called on this Attribute.
get_vector() can be called if this attribute is bound and if type T corresponds to the type used to create the attribute.
Definition at line 1337 of file attributes.h.
|
inline |
Creates and binds a new vector attribute.
[in] | manager | the attribute manager |
[in] | name | the name of the attribute |
[in] | dimension | the number of elements per item |
Definition at line 1237 of file attributes.h.
|
inline |
Destroys this attribute in the AttributesManager.
On exit, the attribute is no-longer accessible in the AttributesManager, its name is available again, and this attribute is in the unbound state.
Definition at line 1256 of file attributes.h.
|
inline |
Gets a reference to the internal vector<T> used to store the attribute.
It is forbidden to modify the size of the returned vector.
Definition at line 1353 of file attributes.h.
|
inline |
Gets a const reference to the internal vector<T> used to store the attribute.
Definition at line 1366 of file attributes.h.
|
inline |
Tests whether an Attribute is bound.
true | if this Attribute is bound |
false | otherwise |
Definition at line 1139 of file attributes.h.
|
inlinestatic |
Tests whether an attribute with the specified name and with corresponding type exists in an AttributesManager.
[in] | manager | a reference to the AttributesManager |
[in] | name | the name of the attribute |
[in] | dim | dimension, or 0 if any dimension can match |
Definition at line 1299 of file attributes.h.
|
inline |
Gets the AttributesManager this Attribute is bound to.
Definition at line 1377 of file attributes.h.
|
inline |
Sets the dimension.
The dimension is 1 for standard attributes and can be greater for vector attributes. The existing fields are kept. If the new dimension is greater than the old one, then new fields are initialized to the default value for the attribute type.
[in] | new_dim | the new dimension |
Definition at line 1273 of file attributes.h.
|
inline |
Gets the size.
Definition at line 1315 of file attributes.h.
|
inline |