Ocean
Ocean::Subset::InternalSubset< TIndex > Class Template Reference

This helper class implements a subset functions. More...

Public Member Functions

std::vector< T > subset (const std::vector< T > &objects, const std::vector< uint8_t > &indices)
 
std::vector< T > subset (const T *objects, const size_t numberObjects, const uint8_t *indices, const size_t numberIndices)
 

Static Public Member Functions

template<typename T >
static std::vector< T > subset (const std::vector< T > &objects, const std::vector< TIndex > &indices)
 Extracts a subset of a given set of objects by usage of an index vector holding the indices of all objects to be used. More...
 
template<typename T >
static std::vector< T > subset (const std::vector< T > &objects, const std::set< TIndex > &indices)
 Extracts a subset of a given set of objects by usage of a set of indices of all objects to be used. More...
 
template<typename T >
static std::vector< T > invertedSubset (const std::vector< T > &objects, const std::unordered_set< TIndex > &indices)
 Extracts a subset of a given set of objects by usage of a set of indices of all objects to be not used. More...
 
template<typename T >
static std::vector< T > invertedSubset (const std::vector< T > &objects, const std::set< TIndex > &indices)
 Extracts a subset of a given set of objects by usage of a set of indices of all objects to be not used. More...
 
template<typename T >
static std::vector< T > subset (const T *objects, const size_t numberObjects, const TIndex *indices, const size_t numberIndices)
 Extracts a subset of a given set of objects by usage of a set of indices of all objects to be used. More...
 
template<typename T >
static std::vector< T > subset (const T *objects, const size_t numberObjects, const std::vector< TIndex > &indices)
 Extracts a subset of a given set of objects by usage of a set of indices of all objects to be used. More...
 
template<typename T >
static std::vector< T > subset (const T *objects, const size_t numberObjects, const std::set< TIndex > &indices)
 Extracts a subset of a given set of objects by usage of a set of indices of all objects to be used. More...
 
template<typename T >
static std::vector< T > invertedSubset (const T *objects, const size_t numberObjects, const std::unordered_set< TIndex > &indices)
 Extracts a subset of a given set of objects by usage of a set of indices of all objects to be not used. More...
 
template<typename T >
static std::vector< T > invertedSubset (const T *objects, const size_t numberObjects, const std::set< TIndex > &indices)
 Extracts a subset of a given set of objects by usage of a set of indices of all objects to be not used. More...
 
template<typename TContainer , uint8_t tValue>
static std::vector< uint8_t > indices2statements (const TContainer &indices, const size_t numberObjects)
 Converts object indices to an uint8_t vector holding statements for each object. More...
 
template<uint8_t tValue>
static std::vector< uint8_t > indices2statements (const TIndex *indices, const size_t numberIndices, const size_t numberObjects)
 Converts object indices to an uint8_t vector holding statements for each object. More...
 
template<uint8_t tValue>
static std::vector< TIndex > statements2indices (const std::vector< uint8_t > &statements)
 Converts an uint8_t vector holding statements for each object into object indices. More...
 
template<uint8_t tValue>
static std::vector< TIndex > statements2indices (const uint8_t *statements, const size_t numberStatements)
 Converts an uint8_t vector holding statements for each object into object indices. More...
 

Detailed Description

template<typename TIndex>
class Ocean::Subset::InternalSubset< TIndex >

This helper class implements a subset functions.

Template Parameters
TIndexData type of the index elements

Member Function Documentation

◆ indices2statements() [1/2]

template<typename TIndex >
template<typename TContainer , uint8_t tValue>
std::vector< uint8_t > Ocean::Subset::InternalSubset< TIndex >::indices2statements ( const TContainer &  indices,
const size_t  numberObjects 
)
inlinestatic

Converts object indices to an uint8_t vector holding statements for each object.

Parameters
indicesIndices defining the subset of the objects, with range [0, numberObjects)
numberObjectsNumber of objects that can be addressed by the indices
Returns
Resulting (boolean != 0u) statements
Template Parameters
TContainerThe container to be used, e.g., std::vector, std::set, std::unordred_set
tValueValue for objects that are defined in the indices, the inverse value is applied otherwise

◆ indices2statements() [2/2]

template<typename TIndex >
template<uint8_t tValue>
std::vector< uint8_t > Ocean::Subset::InternalSubset< TIndex >::indices2statements ( const TIndex *  indices,
const size_t  numberIndices,
const size_t  numberObjects 
)
inlinestatic

Converts object indices to an uint8_t vector holding statements for each object.

Parameters
indicesIndices defining the subset of the objects, with range [0, numberObjects)
numberIndicesNumber of provided indices
numberObjectsNumber of objects that can be addressed by the indices
Returns
Resulting boolean statements
Template Parameters
tValueValue for objects that are defined in the indices, the inverse value is applied otherwise

◆ invertedSubset() [1/4]

template<typename TIndex >
template<typename T >
std::vector< T > Ocean::Subset::InternalSubset< TIndex >::invertedSubset ( const std::vector< T > &  objects,
const std::set< TIndex > &  indices 
)
inlinestatic

Extracts a subset of a given set of objects by usage of a set of indices of all objects to be not used.

Beware: No range check is done! Thus, each index must not exceed the number of given objects.

Parameters
objectsEntire set of objects from that a subset will be extracted
indicesIndices defining the inverted subset to be extracted
Returns
Resulting subset of the given objects
Template Parameters
TData type of the objects

◆ invertedSubset() [2/4]

template<typename TIndex >
template<typename T >
std::vector< T > Ocean::Subset::InternalSubset< TIndex >::invertedSubset ( const std::vector< T > &  objects,
const std::unordered_set< TIndex > &  indices 
)
inlinestatic

Extracts a subset of a given set of objects by usage of a set of indices of all objects to be not used.

Beware: No range check is done! Thus, each index must not exceed the number of given objects.

Parameters
objectsEntire set of objects from that a subset will be extracted
indicesIndices defining the inverted subset to be extracted
Returns
Resulting subset of the given objects
Template Parameters
TData type of the objects

◆ invertedSubset() [3/4]

template<typename TIndex >
template<typename T >
std::vector< T > Ocean::Subset::InternalSubset< TIndex >::invertedSubset ( const T *  objects,
const size_t  numberObjects,
const std::set< TIndex > &  indices 
)
inlinestatic

Extracts a subset of a given set of objects by usage of a set of indices of all objects to be not used.

Beware: No range check is done! Thus, each index must not exceed the number of given objects.

Parameters
objectsEntire set of objects from that a subset will be extracted
numberObjectsNumber of given objects
indicesIndices defining the inverted subset to be extracted
Returns
Resulting subset of the given objects
Template Parameters
TData type of the objects

◆ invertedSubset() [4/4]

template<typename TIndex >
template<typename T >
std::vector< T > Ocean::Subset::InternalSubset< TIndex >::invertedSubset ( const T *  objects,
const size_t  numberObjects,
const std::unordered_set< TIndex > &  indices 
)
inlinestatic

Extracts a subset of a given set of objects by usage of a set of indices of all objects to be not used.

Beware: No range check is done! Thus, each index must not exceed the number of given objects.

Parameters
objectsEntire set of objects from that a subset will be extracted
numberObjectsNumber of given objects
indicesIndices defining the inverted subset to be extracted
Returns
Resulting subset of the given objects
Template Parameters
TData type of the objects

◆ statements2indices() [1/2]

template<typename TIndex >
template<uint8_t tValue>
std::vector< TIndex > Ocean::Subset::InternalSubset< TIndex >::statements2indices ( const std::vector< uint8_t > &  statements)
inlinestatic

Converts an uint8_t vector holding statements for each object into object indices.

Parameters
statementsBoolean statement for each object
Returns
Resulting object indices
Template Parameters
tValueValue for objects that will be defined in the indices

◆ statements2indices() [2/2]

template<typename TIndex >
template<uint8_t tValue>
std::vector< TIndex > Ocean::Subset::InternalSubset< TIndex >::statements2indices ( const uint8_t *  statements,
const size_t  numberStatements 
)
inlinestatic

Converts an uint8_t vector holding statements for each object into object indices.

Parameters
statementsBoolean statement for each object
numberStatementsNumber of statements
Returns
Resulting object indices
Template Parameters
tValueValue for objects that will be defined in the indices

◆ subset() [1/7]

template<typename TIndex >
template<typename T >
std::vector< T > Ocean::Subset::InternalSubset< TIndex >::subset ( const std::vector< T > &  objects,
const std::set< TIndex > &  indices 
)
inlinestatic

Extracts a subset of a given set of objects by usage of a set of indices of all objects to be used.

Beware: No range check is done! Thus, each index must not exceed the number of given objects.

Parameters
objectsEntire set of objects from that a subset will be extracted
indicesIndices defining the subset to be extracted
Returns
Resulting subset of the given objects
Template Parameters
TData type of the objects

◆ subset() [2/7]

template<typename TIndex >
template<typename T >
std::vector< T > Ocean::Subset::InternalSubset< TIndex >::subset ( const std::vector< T > &  objects,
const std::vector< TIndex > &  indices 
)
inlinestatic

Extracts a subset of a given set of objects by usage of an index vector holding the indices of all objects to be used.

If the index data type is an uint8_t, than the (boolean != 0u) statement is used to use the corresponding object or not.
Beware: No range check is done! Thus, each index must not exceed the number of given objects.

Parameters
objectsEntire set of objects from that a subset will be extracted
indicesIndices defining the subset to be extracted
Returns
Resulting subset of the given objects
Template Parameters
TData type of the objects

◆ subset() [3/7]

std::vector< T > Ocean::Subset::InternalSubset< uint8_t >::subset ( const std::vector< T > &  objects,
const std::vector< uint8_t > &  indices 
)
inline

◆ subset() [4/7]

template<typename TIndex >
template<typename T >
std::vector< T > Ocean::Subset::InternalSubset< TIndex >::subset ( const T *  objects,
const size_t  numberObjects,
const std::set< TIndex > &  indices 
)
inlinestatic

Extracts a subset of a given set of objects by usage of a set of indices of all objects to be used.

Beware: No range check is done! Thus, each index must not exceed the number of given objects.

Parameters
objectsEntire set of objects from that a subset will be extracted
numberObjectsNumber of given objects
indicesIndices defining the subset to be extracted
Returns
Resulting subset of the given objects
Template Parameters
TData type of the objects

◆ subset() [5/7]

template<typename TIndex >
template<typename T >
std::vector< T > Ocean::Subset::InternalSubset< TIndex >::subset ( const T *  objects,
const size_t  numberObjects,
const std::vector< TIndex > &  indices 
)
inlinestatic

Extracts a subset of a given set of objects by usage of a set of indices of all objects to be used.

If the index data type is an uint8_t, than the (boolean != 0u) statement is used to use the corresponding object or not.
Beware: No range check is done! Thus, each index must not exceed the number of given objects.

Parameters
objectsEntire set of objects from that a subset will be extracted
numberObjectsNumber of given objects
indicesIndices defining the subset to be extracted
Returns
Resulting subset of the given objects
Template Parameters
TData type of the objects

◆ subset() [6/7]

template<typename TIndex >
template<typename T >
std::vector< T > Ocean::Subset::InternalSubset< TIndex >::subset ( const T *  objects,
const size_t  numberObjects,
const TIndex *  indices,
const size_t  numberIndices 
)
inlinestatic

Extracts a subset of a given set of objects by usage of a set of indices of all objects to be used.

If the index data type is an uint8_t, than the (boolean != 0u) statement is used to use the corresponding object or not.
Beware: No range check is done! Thus, each index must not exceed the number of given objects.

Parameters
objectsEntire set of objects from that a subset will be extracted
numberObjectsNumber of given objects
indicesIndices defining the subset to be extracted
numberIndicesNumber of given indices
Returns
Resulting subset of the given objects
Template Parameters
TData type of the objects

◆ subset() [7/7]

std::vector< T > Ocean::Subset::InternalSubset< uint8_t >::subset ( const T *  objects,
const size_t  numberObjects,
const uint8_t *  indices,
const size_t  numberIndices 
)
inline

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