Geogram  Version 1.9.1
A programming library of geometric algorithms
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. More...
 
- Public Member Functions inherited from GEO::ScalarAttributeAdapterBase
 ScalarAttributeAdapterBase ()
 ScalarAttributeAdapterBase constructor.
 
 ScalarAttributeAdapterBase (const AttributesManager &manager, const std::string &name)
 ScalarAttributeAdapterBase constructor. More...
 
bool is_bound () const
 Tests whether an Attribute is bound. More...
 
void unbind ()
 Unbinds this Attribute. More...
 
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. More...
 
 ~ScalarAttributeAdapterBase ()
 ReadonlyScalarAttributeAdapterBase destructor. More...
 
index_t size () const
 Gets the size. More...
 
ElementType element_type () const
 Gets the internal representation of the elements. More...
 
index_t element_index () const
 Gets the element index. More...
 
const AttributeStoreattribute_store () const
 Gets the AttributeStore. 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...
 

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.
 
- 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. More...
 
static bool can_be_bound_to (const AttributeStore *store)
 Tests whether a ScalarAttributeAdapterBase can be bound to a given attribute store. More...
 
static index_t nb_scalar_elements_per_item (const AttributeStore *store)
 Gets the number of scalar components per item in an AttributeStore. More...
 
- Protected Member Functions inherited from GEO::ScalarAttributeAdapterBase
double get_element_as_double (index_t i) const
 Gets an attribute value. More...
 
template<class T >
get_element (index_t i, index_t multiplier=1) const
 Gets an element. More...
 
double set_element_as_double (index_t i, double value)
 Sets an attribute value. More...
 
template<class T >
void set_element (T value, index_t i, index_t multiplier=1) const
 Sets an element. More...
 
- 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. More...
 
static index_t attribute_element_index (const std::string &name)
 Gets the base attribute name from a compound name. More...
 
static ElementType element_type (const AttributeStore *store)
 Gets the element type stored in an AttributeStore. More...
 
- Protected Attributes inherited from GEO::ScalarAttributeAdapterBase
const AttributesManagermanager_
 
const AttributeStorestore_
 
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 2080 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 2097 of file attributes.h.


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