Ponca  fd5150bf9079aabdb82a6f05e419b76111c1f788
Point Cloud Analysis library
Loading...
Searching...
No Matches
Ponca::internal::ComputeObjectList< _FactoryEntries > Struct Template Reference

List of compute object that can be iterated over. More...

#include <factory.h>

+ Collaboration diagram for Ponca::internal::ComputeObjectList< _FactoryEntries >:

Public Types

using FactoryEntries = _FactoryEntries
 

Public Member Functions

template<typename Func >
void foreach (Func &&fun)
 Applies a function to each entry of the list.
 
template<typename Func >
void ApplyAt (size_t index, Func &&fun)
 
template<typename Func >
void ApplyAt (const char *name, Func &&fun)
 

Static Public Member Functions

template<template< typename > class... Preds>
static decltype(auto) Filter ()
 Returns a new object that is a filtered version of the current one.
 
template<StringLiteral... Names>
static decltype(auto) Filter ()
 Returns a new object that is a filtered version of the current one.
 
template<StringLiteral Name>
static decltype(auto) GetMethod ()
 Return an object by it's id.
 
static constexpr size_t size ()
 Return the number of object held within the object.
 
static constexpr decltype(auto) GetNames ()
 Return the names of the currently held objects.
 

Static Public Attributes

static constexpr size_t N = std::tuple_size_v<FactoryEntries>
 

Detailed Description

template<typename _FactoryEntries>
struct Ponca::internal::ComputeObjectList< _FactoryEntries >

List of compute object that can be iterated over.

Unlike a Factory, this object has non static methods and stores a copy of object.

Template Parameters
_FactoryEntriesA std::tuple of FactoryEntry

Definition at line 24 of file factory.h.

Member Typedef Documentation

◆ FactoryEntries

template<typename _FactoryEntries >
using Ponca::internal::ComputeObjectList< _FactoryEntries >::FactoryEntries = _FactoryEntries

Definition at line 26 of file factory.h.

Constructor & Destructor Documentation

◆ ComputeObjectList()

template<typename _FactoryEntries >
constexpr Ponca::internal::ComputeObjectList< _FactoryEntries >::ComputeObjectList ( )
inlineconstexpr

Definition at line 29 of file factory.h.

Member Function Documentation

◆ ApplyAt() [1/2]

template<typename _FactoryEntries >
template<typename Func >
void Ponca::internal::ComputeObjectList< _FactoryEntries >::ApplyAt ( const char *  name,
Func &&  fun 
)
inline

Definition at line 117 of file factory.h.

◆ ApplyAt() [2/2]

template<typename _FactoryEntries >
template<typename Func >
void Ponca::internal::ComputeObjectList< _FactoryEntries >::ApplyAt ( size_t  index,
Func &&  fun 
)
inline

Definition at line 105 of file factory.h.

◆ Filter() [1/2]

template<typename _FactoryEntries >
template<template< typename > class... Preds>
static decltype(auto) Ponca::internal::ComputeObjectList< _FactoryEntries >::Filter ( )
inlinestatic

Returns a new object that is a filtered version of the current one.

Template Parameters
PredsList of predicate to filter by

Definition at line 42 of file factory.h.

◆ Filter() [2/2]

template<typename _FactoryEntries >
template<StringLiteral... Names>
static decltype(auto) Ponca::internal::ComputeObjectList< _FactoryEntries >::Filter ( )
inlinestatic

Returns a new object that is a filtered version of the current one.

Template Parameters
MethodIdsList of ids to filter by methods

Definition at line 54 of file factory.h.

◆ foreach()

template<typename _FactoryEntries >
template<typename Func >
void Ponca::internal::ComputeObjectList< _FactoryEntries >::foreach ( Func &&  fun)
inline

Applies a function to each entry of the list.

This is expected to be a template function. Example usage is: ComputeObjectList.foreach([&](auto& x) { // Code here should be valid for all possible // types !

// If you know the type, you may run specialized code using CurrentType = std::decay_t<decltype(x)>; if constexpr (std::is_same_v<CurrentType, TheExpectedType>) { // The code goes here. } });

Template Parameters
FuncThe function to apply to each element

Definition at line 99 of file factory.h.

◆ GetMethod()

template<typename _FactoryEntries >
template<StringLiteral Name>
static decltype(auto) Ponca::internal::ComputeObjectList< _FactoryEntries >::GetMethod ( )
inlinestatic

Return an object by it's id.

In order for this method to work, it is expected that only one method has the specified id !

This method returns the ComputeObject, not a ComputeObjectList !

Template Parameters
idThe id of the method

Definition at line 70 of file factory.h.

◆ GetNames()

template<typename _FactoryEntries >
static constexpr decltype(auto) Ponca::internal::ComputeObjectList< _FactoryEntries >::GetNames ( )
inlinestaticconstexpr

Return the names of the currently held objects.

Definition at line 136 of file factory.h.

◆ size()

template<typename _FactoryEntries >
static constexpr size_t Ponca::internal::ComputeObjectList< _FactoryEntries >::size ( )
inlinestaticconstexpr

Return the number of object held within the object.

Definition at line 131 of file factory.h.

Member Data Documentation

◆ N

template<typename _FactoryEntries >
constexpr size_t Ponca::internal::ComputeObjectList< _FactoryEntries >::N = std::tuple_size_v<FactoryEntries>
staticconstexpr

Definition at line 27 of file factory.h.