All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
util::fhicl::SequenceWrapper< SeqValueType > Struct Template Reference

Helper to return a converted sequence from FHiCL configuration. More...

#include <FHiCLutils.h>

Public Member Functions

 SequenceWrapper (SeqValueType seqValue)
 
template<typename T >
 operator std::vector< T > () const
 

Public Attributes

SeqValueType seqValue
 

Detailed Description

template<typename SeqValueType>
struct util::fhicl::SequenceWrapper< SeqValueType >

Helper to return a converted sequence from FHiCL configuration.

Template Parameters
SeqValueTypetype of the sequence value being extracted

This class can be used to apply implicit conversion of a fhicl::Sequence of objects into a std::vector of another type, as sometimes fhicl::Sequence does not support the desired type directly. For example:

struct MyData {
int fValue;
MyData(int value): fValue(value) {}
};
struct Config {
fhicl::Sequence<int> Data {
fhicl::Name("Data"),
fhicl::Comment("The data"),
{ 0, 1, 2 }
};
};
std::vector<MyData> fData;
MyClass(Config const& config)
: fData(util::FHiCLsequenceWrapper(config.Data()))
{}

Definition at line 67 of file FHiCLutils.h.

Constructor & Destructor Documentation

template<typename SeqValueType >
util::fhicl::SequenceWrapper< SeqValueType >::SequenceWrapper ( SeqValueType  seqValue)
inline

Definition at line 176 of file FHiCLutils.h.

176 : seqValue(seqValue) {}

Member Function Documentation

template<typename SeqValueType >
template<typename T >
util::fhicl::SequenceWrapper< SeqValueType >::operator std::vector< T > ( ) const
inline

Definition at line 179 of file FHiCLutils.h.

180  { return { seqValue.cbegin(), seqValue.cend() }; }

Member Data Documentation

template<typename SeqValueType >
SeqValueType util::fhicl::SequenceWrapper< SeqValueType >::seqValue

Definition at line 174 of file FHiCLutils.h.


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