CGAL 5.3.2 - Classification
|
#include <CGAL/Classification/Feature_set.h>
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. | |
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.