Graphite  Version 3
An experimental 3D geometry processing program
GEO::Attribute< bool > Class Reference

Specialization of Attribute for booleans. More...

#include <geogram/basic/attributes.h>

Inheritance diagram for GEO::Attribute< bool >:
GEO::AttributeBase< Numeric::uint8 > GEO::AttributeStoreObserver

Classes

class  BoolAttributeAccessor
 Accessor class for adapting Attribute<bool> indexing. More...
 
class  ConstBoolAttributeAccessor
 Accessor class for adapting Attribute<bool> indexing. More...
 

Public Types

typedef AttributeBase< Numeric::uint8superclass
 

Public Member Functions

 Attribute (AttributesManager &manager, const std::string &name)
 
BoolAttributeAccessor operator[] (index_t i)
 
ConstBoolAttributeAccessor operator[] (index_t i) const
 
void fill (bool val)
 Sets all the elements in this attribute to a specified value. More...
 
- Public Member Functions inherited from GEO::AttributeBase< Numeric::uint8 >
 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< Numeric::uint8 > & get_vector ()
 Gets a reference to the internal vector<T> used to store the attribute. More...
 
const vector< Numeric::uint8 > & get_vector () const
 Gets a const reference to the internal vector<T> used to store the attribute. More...
 
AttributesManagermanager () 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...
 

Protected Member Functions

Numeric::uint8element (index_t i)
 Gets a modifiable element by index. More...
 
const Numeric::uint8element (index_t i) const
 Gets an element by index. More...
 

Friends

class BoolAttributeAccessor
 
class ConstBoolAttributeAccessor
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::AttributeBase< Numeric::uint8 >
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 inherited from GEO::AttributeBase< Numeric::uint8 >
AttributesManagermanager_
 
AttributeStorestore_
 
- Protected Attributes inherited from GEO::AttributeStoreObserver
Memory::pointer base_addr_
 
index_t size_
 
index_t dimension_
 
bool disconnected_
 

Detailed Description

Specialization of Attribute for booleans.

Attribute needs a specialization for bool, since vector<bool> uses compressed storage (1 bit per boolean), that is not compatible with the attribute management mechanism. This wrapper class uses an Attribute<Numeric::uint8> and does the appropriate conversions, using an accessor class.

Definition at line 1524 of file attributes.h.

Member Function Documentation

◆ element() [1/2]

Numeric::uint8& GEO::Attribute< bool >::element ( index_t  i)
inlineprotected

Gets a modifiable element by index.

Parameters
[in]iindex of the element
Returns
a modifiable reference to the ith element

Definition at line 1677 of file attributes.h.

◆ element() [2/2]

const Numeric::uint8& GEO::Attribute< bool >::element ( index_t  i) const
inlineprotected

Gets an element by index.

Parameters
[in]iindex of the element
Returns
a const reference to the ith element

Definition at line 1687 of file attributes.h.

◆ fill()

void GEO::Attribute< bool >::fill ( bool  val)
inline

Sets all the elements in this attribute to a specified value.

Parameters
[in]valthe value

Definition at line 1661 of file attributes.h.


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