CGAL 5.4 - Classification
CGAL::Classification::Feature_set Class Reference

#include <CGAL/Classification/Feature_set.h>

Definition

sets of features (see Feature_base) used as input by classification algorithms.

This class handles both the instantiation, the addition and the deletion of features.

Public Types

using const_iterator = unspecified_type
 A random access constant iterator with value type Feature_handle.
 
using iterator = unspecified_type
 A random access iterator with value type Feature_handle.
 

Constructor

 Feature_set ()
 creates an empty feature set.
 

Modifications

template<typename Feature , typename ... T>
Feature_handle add (T &&... t)
 instantiates a new feature and adds it to the set. More...
 
bool remove (Feature_handle feature)
 removes a feature. More...
 
void clear ()
 removes all features.
 

Parallel Processing

void begin_parallel_additions ()
 initializes structures to compute features in parallel. More...
 
void end_parallel_additions ()
 waits for the end of parallel feature computation and clears dedicated data structures afterwards. More...
 

Access

const_iterator begin () const
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 
std::size_t size () const
 returns how many features are defined.
 
Feature_handle operator[] (std::size_t i) const
 returns the \(i^{th}\) feature.
 

Member Function Documentation

◆ add()

template<typename Feature , typename ... T>
Feature_handle CGAL::Classification::Feature_set::add ( T &&...  t)

instantiates a new feature and adds it to the set.

If several calls of add() are surrounded by begin_parallel_additions() and end_parallel_additions(), they are computed in parallel. They are still inserted in the specified order in the feature set (the first call of add() creates a feature at index 0, the second at index 1, etc.).

See also
begin_parallel_additions()
end_parallel_additions()
Template Parameters
Featuretype of the feature, inherited from Feature_base.
Ttypes of the parameters of the feature's constructor.
Parameters
tparameters of the feature's constructor.
Returns
a handle to the newly added feature.

◆ begin_parallel_additions()

void CGAL::Classification::Feature_set::begin_parallel_additions ( )

initializes structures to compute features in parallel.

If the user wants to add features in parallel, this function should be called before making several calls of add(). After the calls of add(), end_parallel_additions() should be called.

Note
If Intel TBB is not available, this function does nothing.
Warning
As arguments of add() are passed by reference and that new threads are started if begin_parallel_additions() is used, it is highly recommended to always call begin_parallel_additions(), add() and end_parallel_additions() within the same scope, to avoid keeping references to temporary objects that might be deleted before the thread has terminated.
See also
end_parallel_additions()

◆ end_parallel_additions()

void CGAL::Classification::Feature_set::end_parallel_additions ( )

waits for the end of parallel feature computation and clears dedicated data structures afterwards.

If the user wants to add features in parallel, this function should be called after begin_parallel_additions() and several calls of add().

Note
If Intel TBB is not available, this function does nothing.
See also
begin_parallel_additions()

◆ remove()

bool CGAL::Classification::Feature_set::remove ( Feature_handle  feature)

removes a feature.

Parameters
featurethe handle to feature type that must be removed.
Returns
true if the feature was correctly removed, false if its handle was not found.