Geogram Version 1.10.2
A programming library of geometric algorithms
Loading...
Searching...
No Matches
GEO::ReadOnlyScalarAttributeAdapter Class Reference

Readonly access to an attribute as a double regardless its type. More...

#include <geogram/basic/attributes.h>

Inheritance diagram for GEO::ReadOnlyScalarAttributeAdapter:
GEO::ScalarAttributeAdapterBase GEO::AttributeStoreObserver

Public Member Functions

 ReadOnlyScalarAttributeAdapter (const AttributesManager &manager, const std::string &name)
double operator[] (index_t i)
 Gets a property value.
Public Member Functions inherited from GEO::ScalarAttributeAdapterBase
 ScalarAttributeAdapterBase ()
 ScalarAttributeAdapterBase constructor.
 ScalarAttributeAdapterBase (const AttributesManager &manager, const std::string &name)
 ScalarAttributeAdapterBase constructor.
bool is_bound () const
 Tests whether an Attribute is bound.
void unbind ()
 Unbinds this Attribute.
void bind_if_is_defined (const AttributesManager &manager, const std::string &name)
 Binds this Attribute to an AttributesManager if it already exists in the AttributesManager.
 ~ScalarAttributeAdapterBase ()
 ReadonlyScalarAttributeAdapterBase destructor.
index_t size () const
 Gets the size.
ElementType element_type () const
 Gets the internal representation of the elements.
index_t element_index () const
 Gets the element index.
const AttributeStore * attribute_store () const
 Gets the AttributeStore.
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.

Additional Inherited Members

Public Types inherited from GEO::ScalarAttributeAdapterBase
enum  ElementType {
  ET_NONE =0 , ET_UINT8 =1 , ET_INT8 =2 , ET_UINT32 =3 ,
  ET_INT32 =4 , ET_FLOAT32 =5 , ET_FLOAT64 =6 , ET_VEC2 =7 ,
  ET_VEC3 =8
}
 Internal representation of the attribute. More...
Static Public Member Functions inherited from GEO::ScalarAttributeAdapterBase
static bool is_defined (const AttributesManager &manager, const std::string &name)
 Tests whether an attribute with the specified name and with a type that can be converted to double exists in an AttributesManager.
static bool can_be_bound_to (const AttributeStore *store)
 Tests whether a ScalarAttributeAdapterBase can be bound to a given attribute store.
static index_t nb_scalar_elements_per_item (const AttributeStore *store)
 Gets the number of scalar components per item in an AttributeStore.
Protected Member Functions inherited from GEO::ScalarAttributeAdapterBase
double get_element_as_double (index_t i) const
 Gets an attribute value.
template<class T>
T get_element (index_t i, index_t multiplier=1) const
 Gets an element.
double set_element_as_double (index_t i, double value)
 Sets an attribute value.
template<class T>
void set_element (T value, index_t i, index_t multiplier=1) const
 Sets an element.
Static Protected Member Functions inherited from GEO::ScalarAttributeAdapterBase
static std::string attribute_base_name (const std::string &name)
 Gets the base attribute name from a compound name.
static index_t attribute_element_index (const std::string &name)
 Gets the base attribute name from a compound name.
static ElementType element_type (const AttributeStore *store)
 Gets the element type stored in an AttributeStore.
Protected Attributes inherited from GEO::ScalarAttributeAdapterBase
const AttributesManager * manager_
const AttributeStore * store_
ElementType element_type_
index_t element_index_
Protected Attributes inherited from GEO::AttributeStoreObserver
Memory::pointer base_addr_
index_t size_
index_t dimension_
bool disconnected_

Detailed Description

Readonly access to an attribute as a double regardless its type.

The attribute can be an element of a vector attribute.

Definition at line 2244 of file attributes.h.

Constructor & Destructor Documentation

◆ ReadOnlyScalarAttributeAdapter() [1/2]

GEO::ReadOnlyScalarAttributeAdapter::ReadOnlyScalarAttributeAdapter ( )
inline

Definition at line 2246 of file attributes.h.

◆ ReadOnlyScalarAttributeAdapter() [2/2]

GEO::ReadOnlyScalarAttributeAdapter::ReadOnlyScalarAttributeAdapter ( const AttributesManager & manager,
const std::string & name )
inline

Definition at line 2249 of file attributes.h.

Member Function Documentation

◆ operator[]()

double GEO::ReadOnlyScalarAttributeAdapter::operator[] ( index_t i)
inline

Gets a property value.

Parameters
[in]ithe index of the item
Returns
the value of the property, convertex into a double
Precondition
is_bound() && i < size()

Definition at line 2261 of file attributes.h.


The documentation for this class was generated from the following file: