EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dfe::Variable Exception Referencefinal

Variable-type value object a.k.a. a poor mans std::variant. More...

#include <acts/blob/sPHENIX/thirdparty/dfelibs/dfe/dfe_dispatcher.hpp>

+ Collaboration diagram for dfe::Variable:

Classes

struct  Converter< bool >
 
struct  Converter< double >
 
struct  Converter< float >
 
struct  Converter< int16_t >
 
struct  Converter< int32_t >
 
struct  Converter< int64_t >
 
struct  Converter< int8_t >
 
struct  Converter< std::string >
 
struct  Converter< uint16_t >
 
struct  Converter< uint32_t >
 
struct  Converter< uint64_t >
 
struct  Converter< uint8_t >
 
struct  IntegerConverter
 

Public Types

enum  Type
 Supported value types. More...
 

Public Member Functions

 Variable ()
 
 Variable (Variable &&v)
 
 Variable (const Variable &v)
 
 Variable (std::string &&s)
 
 Variable (const std::string &s)
 
 Variable (const char *s)
 
template<typename I , typename = std::enable_if_t<std::is_integral<I>::value>>
 Variable (I integer)
 
 Variable (double d)
 
 Variable (float f)
 
 Variable (bool b)
 
 ~Variable ()=default
 
Variableoperator= (Variable &&v)
 
Variableoperator= (const Variable &v)
 
constexpr bool operator! () const
 
constexpr operator bool () const
 
constexpr Type type () const
 The type of the currently stored value.
 
template<typename T >
auto as () const
 

Static Public Member Functions

static Variable parse_as (const std::string &str, Type type)
 Parse a string into a value of the requested type.
 

Private Attributes

union {
   int64_t   m_integer
 
   double   m_float
 
   bool   m_boolean
 
}; 
 
std::string m_string
 
Type m_type
 

Friends

std::ostream & operator<< (std::ostream &os, const Variable &v)
 

Detailed Description

Variable-type value object a.k.a. a poor mans std::variant.

Definition at line 43 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 43 of file dfe_dispatcher.hpp

Member Enumeration Documentation

Supported value types.

Definition at line 46 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 46 of file dfe_dispatcher.hpp

Constructor & Destructor Documentation

dfe::Variable::Variable ( )
inline

Definition at line 48 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 48 of file dfe_dispatcher.hpp

Referenced by parse_as().

+ Here is the caller graph for this function:

dfe::Variable::Variable ( Variable &&  v)
inline

Definition at line 49 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 49 of file dfe_dispatcher.hpp

References v.

dfe::Variable::Variable ( const Variable v)
inline

Definition at line 50 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 50 of file dfe_dispatcher.hpp

References v.

dfe::Variable::Variable ( std::string &&  s)
inlineexplicit

Definition at line 51 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 51 of file dfe_dispatcher.hpp

dfe::Variable::Variable ( const std::string &  s)
inlineexplicit

Definition at line 53 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 53 of file dfe_dispatcher.hpp

dfe::Variable::Variable ( const char *  s)
inlineexplicit

Definition at line 54 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 54 of file dfe_dispatcher.hpp

template<typename I , typename = std::enable_if_t<std::is_integral<I>::value>>
dfe::Variable::Variable ( I  integer)
inlineexplicit

Definition at line 57 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 57 of file dfe_dispatcher.hpp

dfe::Variable::Variable ( double  d)
inlineexplicit

Definition at line 59 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 59 of file dfe_dispatcher.hpp

dfe::Variable::Variable ( float  f)
inlineexplicit

Definition at line 60 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 60 of file dfe_dispatcher.hpp

dfe::Variable::Variable ( bool  b)
inlineexplicit

Definition at line 61 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 61 of file dfe_dispatcher.hpp

dfe::Variable::~Variable ( )
default

Member Function Documentation

template<typename T >
auto dfe::Variable::as ( ) const
inline

Get value of the variable as a specific type.

Exceptions
std::invalid_argumentif the requested type is incompatible

Definition at line 274 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 274 of file dfe_dispatcher.hpp

References m_type.

Referenced by conkin(), grv94di(), grv94ho(), grv94lo(), parton(), pepsimainerhic(), pycjdc(), pygdir(), pyglui(), pygrvd(), pygrvl(), pygrvm(), pyhisigh(), pyhiwidt(), pymrun(), pynjdc(), pyrnmq(), pysfdc(), pysgex(), pysghf(), pysghg(), pysgqc(), pysgsu(), pysgtc(), pysgwz(), pysigh(), pystbh(), pywidt(), pywidx(), pyxued(), and tails().

+ Here is the caller graph for this function:

constexpr dfe::Variable::operator bool ( ) const
inlineexplicit
See Also
operator!()

Definition at line 75 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 75 of file dfe_dispatcher.hpp

constexpr bool dfe::Variable::operator! ( ) const
inline

In a boolean context a variable is false if it does not contain a value.

Warning
This is not the value of the stored boolean.

Definition at line 73 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 73 of file dfe_dispatcher.hpp

References m_type.

Variable & dfe::Variable::operator= ( Variable &&  v)
inline

Definition at line 191 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 191 of file dfe_dispatcher.hpp

References m_boolean, m_float, m_integer, m_string, m_type, and v.

Variable & dfe::Variable::operator= ( const Variable v)
inline

Definition at line 210 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 210 of file dfe_dispatcher.hpp

References m_boolean, m_float, m_integer, m_string, and m_type.

Variable dfe::Variable::parse_as ( const std::string &  str,
Type  type 
)
inlinestatic

Parse a string into a value of the requested type.

Definition at line 162 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 162 of file dfe_dispatcher.hpp

References Variable().

+ Here is the call graph for this function:

constexpr Type dfe::Variable::type ( ) const
inline

The type of the currently stored value.

Definition at line 77 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 77 of file dfe_dispatcher.hpp

References m_type.

Referenced by dfe::operator<<().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Variable v 
)
friend

Definition at line 177 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 177 of file dfe_dispatcher.hpp

Member Data Documentation

union { ... }
bool dfe::Variable::m_boolean

Definition at line 93 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 93 of file dfe_dispatcher.hpp

Referenced by dfe::Variable::Converter< bool >::as_t(), dfe::operator<<(), and operator=().

double dfe::Variable::m_float

Definition at line 92 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 92 of file dfe_dispatcher.hpp

Referenced by dfe::Variable::Converter< float >::as_t(), dfe::Variable::Converter< double >::as_t(), dfe::operator<<(), and operator=().

int64_t dfe::Variable::m_integer

Definition at line 91 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 91 of file dfe_dispatcher.hpp

Referenced by dfe::Variable::IntegerConverter< uint64_t >::as_t(), dfe::operator<<(), and operator=().

std::string dfe::Variable::m_string
private

Definition at line 97 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 97 of file dfe_dispatcher.hpp

Referenced by dfe::Variable::Converter< std::string >::as_t(), dfe::operator<<(), and operator=().

Type dfe::Variable::m_type
private

Definition at line 98 of file dfe_dispatcher.hpp.

View newest version in sPHENIX GitHub at line 98 of file dfe_dispatcher.hpp

Referenced by as(), operator!(), dfe::operator<<(), operator=(), and type().


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