CGAL 5.1.2 - Classification
CGAL::Classification::Feature_set Class Reference

#include <CGAL/Classification/Feature_set.h>

Definition

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

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

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

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
This function requires Intel TBB.
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
This function requires Intel TBB.
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.