41#ifndef GEOGRAM_BASIC_VECTOR_ATTRIBUTE
42#define GEOGRAM_BASIC_VECTOR_ATTRIBUTE
57 static constexpr index_t vec_dim = DIM;
80 if(store ==
nullptr) {
96 if(store_ ==
nullptr) {
101 store_observer_.register_me(store_);
109 if(!store_observer_.disconnected()) {
110 store_observer_.unregister_me(store_);
128 return (store_ !=
nullptr && !store_observer_.disconnected());
132 return store_observer_.size();
155 store_observer_.unregister_me(store_);
176 if(store_ !=
nullptr) {
182 store_observer_.register_me(store_);
215#ifdef GEO_COMPILER_CLANG
216#pragma clang diagnostic push
217#pragma clang diagnostic ignored "-Wcast-align"
221 return ((vec_type*)store_observer_.base_addr())[i];
226 return ((vec_type*)store_observer_.base_addr())[i];
229#ifdef GEO_COMPILER_CLANG
230#pragma clang diagnostic pop
235 AttributesManager* manager_;
236 AttributeStore* store_;
#define geo_assert(x)
Verifies that a condition is met.
#define geo_debug_assert(x)
Verifies that a condition is met.
Generic mechanism for attributes.
AttributesManager * manager() const
Gets the AttributesManager this Attribute is bound to.
index_t size() const
Gets the size.
bool is_bound() const
Tests whether an Attribute is bound.
void unbind()
Unbinds this Attribute.
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 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.
AttributeStoreObserver()
Creates a new uninitialied AttributeStore.
index_t nb_elements() const
Gets the total number of elements.
index_t dimension() const
Gets the dimension.
Notifies a set of AttributeStoreObservers each time the stored array changes size and/or base address...
index_t dimension() const
Gets the dimension.
virtual bool elements_type_matches(const std::string &type_name) const =0
Tests whether this AttributeStore stores elements of a given type.
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 ...
void destroy()
Destroys this attribute in the AttributesManager.
void fill(const vec_type &val)
Sets all the elements in this attribute to a specified value.
void copy(const Attribute< vec_type > &rhs)
Copies all the values from another attribute.
Manages an attribute attached to a set of object.
Attribute()
Creates an uninitialized (unbound) Attribute.
T & operator[](index_t i)
Gets a modifiable element by index.
Managers a set of attributes attached to an object.
AttributeStore * find_attribute_store(const std::string &name)
Finds an AttributeStore by name.
void bind_attribute_store(const std::string &name, AttributeStore *as)
Binds an AttributeStore with the specified name. Ownership of this AttributeStore is transferred to t...
void delete_attribute_store(const std::string &name)
Deletes an AttributeStore by name.
Stores an array of elements of a given type, and notifies a set of AttributeStoreObservers each time ...
Common include file, providing basic definitions. Should be included before anything else by all head...
Geometric functions in 2d and 3d.
Global Vorpaline namespace.
geo_index_t index_t
The type for storing and manipulating indices.