20 #ifndef ANTKEEPER_GEOM_BREP_ATTRIBUTE_HPP
21 #define ANTKEEPER_GEOM_BREP_ATTRIBUTE_HPP
56 virtual void erase(std::size_t i) = 0;
61 virtual void emplace_back() = 0;
64 [[nodiscard]]
virtual std::unique_ptr<brep_attribute_base>
clone()
const = 0;
83 using iterator = std::vector<value_type>::iterator;
96 m_values(element_count)
124 return m_values.front();
128 return m_values.front();
136 return m_values.back();
140 return m_values.back();
148 return m_values.data();
152 return m_values.data();
164 return m_values.begin();
168 return m_values.begin();
172 return m_values.begin();
180 return m_values.end();
184 return m_values.end();
188 return m_values.end();
196 return m_values.rbegin();
200 return m_values.rbegin();
204 return m_values.rbegin();
212 return m_values.rend();
216 return m_values.rend();
220 return m_values.rend();
229 [[nodiscard]]
inline constexpr
bool empty() const noexcept
231 return m_values.empty();
235 [[nodiscard]]
inline constexpr std::size_t
size() const noexcept
237 return m_values.size();
243 void erase(std::size_t i)
override
245 m_values[i] = std::move(m_values.back());
249 void emplace_back()
override
251 m_values.emplace_back();
254 [[nodiscard]] std::unique_ptr<brep_attribute_base> clone()
const override
256 auto copy = std::make_unique<brep_attribute<T>>(
name(), 0);
257 copy->m_values = m_values;
261 std::vector<value_type> m_values;
Abstract base class for B-rep element attributes.
constexpr brep_attribute_base(hash::fnv1a32_t name) noexcept
constexpr hash::fnv1a32_t name() const noexcept
Returns the name of the attribute.
Maps names to B-rep attributes.
constexpr const_reverse_iterator rend() const noexcept
Returns a reverse iterator to the attribute value of the element following the last element of the re...
constexpr reverse_iterator rbegin() noexcept
Returns a reverse iterator to the attribute value of the first element of the reversed container.
std::vector< value_type >::reverse_iterator reverse_iterator
constexpr iterator begin() noexcept
Returns an iterator to the attribute value of the first element.
constexpr const_iterator cend() const noexcept
Returns an iterator to the attribute value of the element following the last element.
constexpr iterator end() noexcept
Returns an iterator to the attribute value of the element following the last element.
std::vector< value_type >::const_iterator const_iterator
const value_type * const_pointer
constexpr const_iterator end() const noexcept
Returns an iterator to the attribute value of the element following the last element.
constexpr const_reference back() const
Returns a reference to the attribute value of the last element.
constexpr const_reference front() const
Returns a reference to the attribute value of the first element.
const value_type & const_reference
constexpr const_reverse_iterator rbegin() const noexcept
Returns a reverse iterator to the attribute value of the first element of the reversed container.
brep_attribute(hash::fnv1a32_t name, std::size_t element_count)
Constructs an attribute.
constexpr const_reference operator[](std::size_t i) const
Returns a reference to the attribute value of an element.
constexpr reverse_iterator rend() noexcept
Returns a reverse iterator to the attribute value of the element following the last element of the re...
std::vector< value_type >::iterator iterator
constexpr bool empty() const noexcept
Returns true if the container is empty, false otherwise.
constexpr reference operator[](std::size_t i)
Returns a reference to the attribute value of an element.
constexpr const_iterator begin() const noexcept
Returns an iterator to the attribute value of the first element.
constexpr std::size_t size() const noexcept
Returns the number of attribute values in the container.
constexpr const value_type * data() const noexcept
Returns a pointer to the underlying array serving as attribute value storage.
std::vector< value_type >::const_reverse_iterator const_reverse_iterator
constexpr value_type * data() noexcept
Returns a pointer to the underlying array serving as attribute value storage.
constexpr const_reverse_iterator crbegin() const noexcept
Returns a reverse iterator to the attribute value of the first element of the reversed container.
constexpr reference back()
Returns a reference to the attribute value of the last element.
constexpr reference front()
Returns a reference to the attribute value of the first element.
constexpr const_iterator cbegin() const noexcept
Returns an iterator to the attribute value of the first element.
constexpr const_reverse_iterator crend() const noexcept
Returns a reverse iterator to the attribute value of the element following the last element of the re...
Container for B-rep elements.
void clone(entity::registry ®istry, entity::id source, entity::id destination)
Clones all the components of an entity.
32-bit FNV-1a hash value.