CGAL 5.1.2 - Classification
|
#include <CGAL/Classification/Feature_set.h>
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. | |
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.).
Feature | type of the feature, inherited from Feature_base . |
T | types of the parameters of the feature's constructor. |
t | parameters of the feature's constructor. |
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.
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.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()
.
begin_parallel_additions()
bool CGAL::Classification::Feature_set::remove | ( | Feature_handle | feature | ) |
Removes a feature.
feature | the handle to feature type that must be removed. |
true
if the feature was correctly removed, false
if its handle was not found.