Antkeeper  0.0.1
Classes | Public Types | Public Member Functions | Friends | List of all members
geom::brep_attribute_map Class Reference

Maps names to B-rep attributes. More...

#include <brep-attribute-map.hpp>

Classes

class  iterator_template
 

Public Types

using iterator = iterator_template< std::unordered_map< hash::fnv1a32_t, std::unique_ptr< brep_attribute_base > >::iterator, false >
 
using const_iterator = iterator_template< std::unordered_map< hash::fnv1a32_t, std::unique_ptr< brep_attribute_base > >::const_iterator, true >
 

Public Member Functions

bool contains (hash::fnv1a32_t name) const
 Checks if there is an attribute with a given name in the container. More...
 
Iterators
const_iterator begin () const noexcept
 Returns an iterator to the first attribute. More...
 
iterator begin () noexcept
 Returns an iterator to the first attribute. More...
 
const_iterator cbegin () const noexcept
 Returns an iterator to the first attribute. More...
 
const_iterator end () const noexcept
 Returns an iterator to the attribute following the last attribute. More...
 
iterator end () noexcept
 Returns an iterator to the attribute following the last attribute. More...
 
const_iterator cend () const noexcept
 Returns an iterator to the attribute following the last attribute. More...
 
Capacity
bool empty () const noexcept
 Returns true if the container is empty, false otherwise. More...
 
std::size_t size () const noexcept
 Returns the number of attributes in the container. More...
 
Modifiers
void clear () noexcept
 Removes all attributes from the container. More...
 
template<class T >
iterator emplace (hash::fnv1a32_t name)
 Constructs a new attribute. More...
 
iterator erase (iterator pos)
 Removes an attribute from the container. More...
 
std::size_t erase (hash::fnv1a32_t name)
 Removes an attribute from the container. More...
 
template<class T >
std::pair< iterator, bool > try_emplace (hash::fnv1a32_t name)
 Constructs a new attribute if an attribute with the given name does not exist. More...
 
Lookup
template<class T >
const brep_attribute< T > & at (hash::fnv1a32_t name) const
 Returns a reference to the attribute with the given name. More...
 
template<class T >
brep_attribute< T > & at (hash::fnv1a32_t name)
 Returns a reference to the attribute with the given name. More...
 
const_iterator find (hash::fnv1a32_t name) const
 Finds an attribute with the given name. More...
 
iterator find (hash::fnv1a32_t name)
 Finds an attribute with the given name. More...
 

Friends

template<class T >
class brep_element_container
 
class brep_mesh
 

Detailed Description

Maps names to B-rep attributes.

Definition at line 37 of file brep-attribute-map.hpp.

Member Typedef Documentation

◆ const_iterator

Definition at line 147 of file brep-attribute-map.hpp.

◆ iterator

using geom::brep_attribute_map::iterator = iterator_template<std::unordered_map<hash::fnv1a32_t, std::unique_ptr<brep_attribute_base> >::iterator, false>

Definition at line 146 of file brep-attribute-map.hpp.

Member Function Documentation

◆ at() [1/2]

template<class T >
brep_attribute<T>& geom::brep_attribute_map::at ( hash::fnv1a32_t  name)
inline

Returns a reference to the attribute with the given name.

If no such attribute exists, an exception of type std::out_of_range is thrown.

Template Parameters
TAttribute data type.
Returns
Reference to the attribute with the given name.

@except std::out_of_range B-rep attribute not found.

Definition at line 324 of file brep-attribute-map.hpp.

◆ at() [2/2]

template<class T >
const brep_attribute<T>& geom::brep_attribute_map::at ( hash::fnv1a32_t  name) const
inline

Returns a reference to the attribute with the given name.

If no such attribute exists, an exception of type std::out_of_range is thrown.

Template Parameters
TAttribute data type.
Returns
Reference to the attribute with the given name.

@except std::out_of_range B-rep attribute not found.

Definition at line 313 of file brep-attribute-map.hpp.

◆ begin() [1/2]

const_iterator geom::brep_attribute_map::begin ( ) const
inlinenoexcept

Returns an iterator to the first attribute.

Definition at line 154 of file brep-attribute-map.hpp.

◆ begin() [2/2]

iterator geom::brep_attribute_map::begin ( )
inlinenoexcept

Returns an iterator to the first attribute.

Definition at line 160 of file brep-attribute-map.hpp.

◆ cbegin()

const_iterator geom::brep_attribute_map::cbegin ( ) const
inlinenoexcept

Returns an iterator to the first attribute.

Definition at line 166 of file brep-attribute-map.hpp.

◆ cend()

const_iterator geom::brep_attribute_map::cend ( ) const
inlinenoexcept

Returns an iterator to the attribute following the last attribute.

Definition at line 186 of file brep-attribute-map.hpp.

◆ clear()

void geom::brep_attribute_map::clear ( )
inlinenoexcept

Removes all attributes from the container.

Definition at line 215 of file brep-attribute-map.hpp.

◆ contains()

bool geom::brep_attribute_map::contains ( hash::fnv1a32_t  name) const
inline

Checks if there is an attribute with a given name in the container.

Parameters
nameAttribute name.
Returns
true if an attribute with the given name was found, false otherwise.

Definition at line 365 of file brep-attribute-map.hpp.

◆ emplace()

template<class T >
iterator geom::brep_attribute_map::emplace ( hash::fnv1a32_t  name)
inline

Constructs a new attribute.

If an attribute with the given name exists, it will be replaced.

Template Parameters
TAttribute data type.
Parameters
nameName of the new attribute.
Returns
Iterator to the new attribute.

Definition at line 230 of file brep-attribute-map.hpp.

◆ empty()

bool geom::brep_attribute_map::empty ( ) const
inlinenoexcept

Returns true if the container is empty, false otherwise.

Definition at line 197 of file brep-attribute-map.hpp.

◆ end() [1/2]

const_iterator geom::brep_attribute_map::end ( ) const
inlinenoexcept

Returns an iterator to the attribute following the last attribute.

Definition at line 174 of file brep-attribute-map.hpp.

◆ end() [2/2]

iterator geom::brep_attribute_map::end ( )
inlinenoexcept

Returns an iterator to the attribute following the last attribute.

Definition at line 180 of file brep-attribute-map.hpp.

◆ erase() [1/2]

std::size_t geom::brep_attribute_map::erase ( hash::fnv1a32_t  name)
inline

Removes an attribute from the container.

Parameters
nameName of the attribute to remove.
Returns
Number of attributes removed (0 or 1).

Definition at line 268 of file brep-attribute-map.hpp.

◆ erase() [2/2]

iterator geom::brep_attribute_map::erase ( iterator  pos)
inline

Removes an attribute from the container.

Parameters
posIterator to the attribute to remove.
Returns
Iterator following the erased attribute.

Definition at line 254 of file brep-attribute-map.hpp.

◆ find() [1/2]

iterator geom::brep_attribute_map::find ( hash::fnv1a32_t  name)
inline

Finds an attribute with the given name.

Parameters
nameName of an attribute.
Returns
Iterator to the attribute with the given name. If no such attribute is found, an end iterator is returned.

Definition at line 350 of file brep-attribute-map.hpp.

◆ find() [2/2]

const_iterator geom::brep_attribute_map::find ( hash::fnv1a32_t  name) const
inline

Finds an attribute with the given name.

Parameters
nameName of an attribute.
Returns
Iterator to the attribute with the given name. If no such attribute is found, an end iterator is returned.

Definition at line 344 of file brep-attribute-map.hpp.

◆ size()

std::size_t geom::brep_attribute_map::size ( ) const
inlinenoexcept

Returns the number of attributes in the container.

Definition at line 203 of file brep-attribute-map.hpp.

◆ try_emplace()

template<class T >
std::pair<iterator, bool> geom::brep_attribute_map::try_emplace ( hash::fnv1a32_t  name)
inline

Constructs a new attribute if an attribute with the given name does not exist.

Template Parameters
TAttribute data type.
Parameters
nameName of the new attribute.
Returns
Pair consisting of an iterator to the new or pre-existing attribute, and a Boolean value that's true if the new attribute was constructed, or false if an attribute with the given name pre-existed.

Definition at line 283 of file brep-attribute-map.hpp.

Friends And Related Function Documentation

◆ brep_element_container

template<class T >
friend class brep_element_container
friend

Definition at line 374 of file brep-attribute-map.hpp.

◆ brep_mesh

friend class brep_mesh
friend

Definition at line 375 of file brep-attribute-map.hpp.


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