tfel
Loading...
Searching...
No Matches
Data.ixx File Reference
#include "TFEL/Raise.hxx"

Classes

struct  tfel::utilities::internals::DataConvertorImpl< T, true >
struct  tfel::utilities::internals::DataConvertor< T >
 an helper class (in C++-11, no if constexpr, so we rely on template specialisation) More...
struct  tfel::utilities::internals::DataConvertor< double >
 an helper class (in C++-11, no if constexpr, so we rely on template specialisation) More...
struct  tfel::utilities::internals::DataConvertor< std::vector< T > >
 partial specialisation for std::vector More...
struct  tfel::utilities::internals::DataConvertor< std::map< std::string, T > >
 partial specialisation for std::map More...

Namespaces

namespace  tfel
 the namespace tfel encloses all the TFEL project. This namespace is empty.

Functions

template<typename T>
T tfel::utilities::convert (const Data &)
 extract a value of the given type from a Data structure
template<typename T>
bool tfel::utilities::is_convertible (const Data &)
template<typename ResultType>
bool tfel::utilities::is (const DataMap &, std::string_view)
template<typename ResultType>
const ResultType & tfel::utilities::get (const DataMap &, std::string_view)
template<typename ResultType>
ResultType tfel::utilities::get_if (const DataMap &, std::string_view, const ResultType &)

Detailed Description

Author
Thomas Helfer
Date
25 oct. 2017

Function Documentation

◆ convert()

template<typename T>
T tfel::utilities::convert ( const Data & d)

extract a value of the given type from a Data structure

Parameters
[in]ddata
Returns
the extracted value

◆ get()

template<typename ResultType>
const ResultType & tfel::utilities::get ( const DataMap & m,
std::string_view n )
Returns
value of the data
Template Parameters
ResultTypeexpected type of the data
Parameters
[in]mdata map
[in]nname
Exceptions
ifthe data does not exists or does not have the good type.

◆ get_if()

template<typename ResultType>
ResultType tfel::utilities::get_if ( const DataMap & m,
std::string_view n,
const ResultType & v )
Returns
value of the data if present, a default value otherwise
Template Parameters
ResultTypeexpected type of the data
Parameters
[in]mdata map
[in]nname
[in]vdefault value
Exceptions
ifthe data exists but does not have the good type.

◆ is()

template<typename ResultType>
bool tfel::utilities::is ( const DataMap & m,
std::string_view n )
Returns
true if the given data has the given type
Parameters
[in]mdata map
[in]nname
Exceptions
ifthe data does not exists

◆ is_convertible()

template<typename T>
bool tfel::utilities::is_convertible ( const Data & d)
Parameters
[in]ddata
Returns
true if the Data can be converted to the given type