|
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. | |
| bool | is_bound () const |
| Tests whether an Attribute is bound. | |
| bool | existed_already () const |
| Tests whether the latest bound attribute existed already. | |
| void | unbind () |
| Unbinds this Attribute. | |
| void | bind (AttributesManager &manager, const std::string &name) |
| Binds this Attribute to an AttributesManager. | |
| bool | bind_if_is_defined (AttributesManager &manager, const std::string &name) |
| Binds this Attribute to an AttributesManager if it already exists in the AttributesManager. | |
| 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 types are compatible. | |
| void | create_vector_attribute (AttributesManager &manager, const std::string &name, index_t dimension) |
| Creates and binds a new vector attribute. | |
| void | destroy () |
| Destroys this attribute in the AttributesManager. | |
| void | redim (index_t new_dim) |
| Sets the dimension. | |
| ~AttributeBase () | |
| Attribute destructor. | |
| index_t | size () const |
| Gets the size. | |
| 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. | |
| vector< T > & | get_vector () |
| Gets a reference to the internal vector<T> used to store the attribute. | |
| const vector< T > & | get_vector () const |
| Gets a const reference to the internal vector<T> used to store the attribute. | |
| AttributesManager * | manager () const |
| Gets the AttributesManager this Attribute is bound to. | |
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. | |
| index_t | size () const |
| Gets the size. | |
| index_t | dimension () const |
| Gets the dimension. | |
| index_t | nb_elements () const |
| Gets the total number of elements. | |
| Memory::pointer | base_addr () const |
| Gets a pointer to the storage. | |
| void | register_me (AttributeStore *store) |
| Registers this observer to an AttributeStore. | |
| void | unregister_me (AttributeStore *store) |
| Unregisters this observer from an AttributeStore. | |
| void | disconnect () |
| Disconnects this AttributeStoreObserver from its AttributeStore. | |
| bool | disconnected () const |
| Tests whether this AttributeStoreObserver was disconnected. | |
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. | |
Protected Attributes | |
| AttributesManager * | manager_ |
| AttributeStore * | store_ |
| bool | existed_already_ |
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 1191 of file attributes.h.
|
inline |
Creates an uninitialized (unbound) Attribute.
Definition at line 1197 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 1212 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 1388 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 1265 of file attributes.h.
|
inline |
Binds this Attribute to an AttributesManager if it already exists in the AttributesManager and types 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 1313 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 1289 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 1440 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 1340 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 1359 of file attributes.h.
|
inline |
Tests whether the latest bound attribute existed already.
| true | if the latest bound attribute existed already in the AttributeManager |
| false | if the latest bound attribute was created in the AttributeManager when bound |
Definition at line 1235 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 1456 of file attributes.h.
|
inline |
Gets a const reference to the internal vector<T> used to store the attribute.
Definition at line 1469 of file attributes.h.
|
inline |
Tests whether an Attribute is bound.
| true | if this Attribute is bound |
| false | otherwise |
Definition at line 1224 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 1402 of file attributes.h.
|
inline |
Gets the AttributesManager this Attribute is bound to.
Definition at line 1480 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 1376 of file attributes.h.
|
inline |
Gets the size.
Definition at line 1418 of file attributes.h.
|
inline |
|
inline |
Sets all the elements of this Attribute to zero.
Definition at line 1426 of file attributes.h.
|
protected |
Definition at line 1487 of file attributes.h.
|
protected |
Definition at line 1485 of file attributes.h.
|
protected |
Definition at line 1486 of file attributes.h.