Public Member Functions | Private Member Functions | Private Attributes | List of all members
fhicl::OptionalTableAs< T, Config > Class Template Reference

#include <type_traits.h>

Public Member Functions

 OptionalTableAs (Name &&name)
 
 OptionalTableAs (Name &&name, Comment &&comment)
 
 OptionalTableAs (Name &&name, Comment &&comment, std::function< bool()> maybeUse)
 
std::optional< T > operator() () const
 
bool operator() (T &result) const
 
bool hasValue () const
 

Private Member Functions

Comment conversion_comment (Comment &&comment) const
 

Private Attributes

OptionalTable< ConfigtableObj_
 

Detailed Description

template<typename T, typename Config>
class fhicl::OptionalTableAs< T, Config >

Definition at line 55 of file type_traits.h.

Constructor & Destructor Documentation

template<typename T , typename Config >
fhicl::OptionalTableAs< T, Config >::OptionalTableAs ( Name &&  name)
explicit

Definition at line 78 of file OptionalTableAs.h.

80  {}
static QCString name
Definition: declinfo.cpp:673
OptionalTableAs(Name &&name)
def move(depos, offset)
Definition: depos.py:107
#define Comment
template<typename T , typename Config >
fhicl::OptionalTableAs< T, Config >::OptionalTableAs ( Name &&  name,
Comment &&  comment 
)
explicit

Definition at line 83 of file OptionalTableAs.h.

85  {}
static QCString name
Definition: declinfo.cpp:673
Comment conversion_comment(Comment &&comment) const
int comment
OptionalTable< Config > tableObj_
def move(depos, offset)
Definition: depos.py:107
template<typename T , typename Config >
fhicl::OptionalTableAs< T, Config >::OptionalTableAs ( Name &&  name,
Comment &&  comment,
std::function< bool()>  maybeUse 
)
explicit

Definition at line 88 of file OptionalTableAs.h.

93  maybeUse}
94  {}
static QCString name
Definition: declinfo.cpp:673
Comment conversion_comment(Comment &&comment) const
int comment
OptionalTable< Config > tableObj_
def move(depos, offset)
Definition: depos.py:107

Member Function Documentation

template<typename T , typename Config >
Comment fhicl::OptionalTableAs< T, Config >::conversion_comment ( Comment &&  comment) const
inlineprivate

Definition at line 58 of file OptionalTableAs.h.

59  {
60  std::string const preface =
61  "N.B. The following table is converted to type:";
62  std::string const name =
63  " '" + cet::demangle_symbol(typeid(T).name()) + "'";
64  std::string const user_comment =
65  comment.value.empty() ? "" : "\n\n" + comment.value;
66 
67  std::ostringstream oss;
68  oss << preface << '\n' << name << user_comment;
69 
70  return Comment{oss.str().c_str()};
71  }
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
int comment
#define Comment
template<typename T , typename Config >
bool fhicl::OptionalTableAs< T, Config >::hasValue ( ) const
inline

Definition at line 49 of file OptionalTableAs.h.

50  {
51  return tableObj_.hasValue();
52  }
OptionalTable< Config > tableObj_
bool hasValue() const
Definition: OptionalTable.h:62
template<typename T , typename Config >
std::optional<T> fhicl::OptionalTableAs< T, Config >::operator() ( ) const
inline

Definition at line 29 of file OptionalTableAs.h.

30  {
31  if (auto via = tableObj_()) {
32  return std::make_optional(convert(*via));
33  }
34  return std::nullopt;
35  }
OptionalTable< Config > tableObj_
def convert(inputfile, outputfile="wire-cell-garfield-fine-response.json.bz2", average=False, shaped=False)
Definition: garfield.py:262
template<typename T , typename Config >
bool fhicl::OptionalTableAs< T, Config >::operator() ( T &  result) const
inline

Definition at line 39 of file OptionalTableAs.h.

40  {
41  auto t = operator()();
42  if (t) {
43  result = *t;
44  }
45  return t.has_value();
46  }
static QCString result
std::optional< T > operator()() const

Member Data Documentation

template<typename T , typename Config >
OptionalTable<Config> fhicl::OptionalTableAs< T, Config >::tableObj_
private

Definition at line 55 of file OptionalTableAs.h.


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