https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
TableValue< T > Class Template Reference

#include <FormattedTable.h>

Inheritance diagram for TableValue< T >:
[legend]

Public Member Functions

 TableValue (const T &value)
 
const T & get () const
 
T & set ()
 
virtual void print (std::ostream &os) const override
 
virtual void store (std::ostream &stream, void *context) override
 
template<>
void print (std::ostream &os) const
 

Static Public Member Functions

static void load (std::istream &stream, std::shared_ptr< TableValueBase > &value_base, void *context)
 
template<typename T >
static constexpr bool isSupportedType ()
 

Private Attributes

_value
 

Detailed Description

template<typename T>
class TableValue< T >

Definition at line 57 of file FormattedTable.h.

Constructor & Destructor Documentation

◆ TableValue()

template<typename T >
TableValue< T >::TableValue ( const T &  value)
inline

Definition at line 60 of file FormattedTable.h.

60  : _value(value)
61  {
62  if (!this->isSupportedType<T>())
63  mooseError("Unsupported type ", MooseUtils::prettyCppType<T>(), " for FormattedTable.");
64  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302

Member Function Documentation

◆ get()

template<typename T >
const T& TableValue< T >::get ( ) const
inline

Definition at line 66 of file FormattedTable.h.

66 { return _value; }

◆ isSupportedType()

template<typename T >
static constexpr bool TableValueBase::isSupportedType ( )
inlinestaticinherited

Definition at line 44 of file FormattedTable.h.

45  {
46  return std::is_fundamental<T>::value || std::is_same<T, std::string>::value;
47  }

◆ load()

template<typename T >
void TableValue< T >::load ( std::istream &  stream,
std::shared_ptr< TableValueBase > &  value_base,
void context 
)
static

Definition at line 97 of file FormattedTable.h.

Referenced by dataLoad().

100 {
101  T value;
102  ::dataLoad(stream, value, context);
103  value_base = std::dynamic_pointer_cast<TableValueBase>(std::make_shared<TableValue<T>>(value));
104 }
void dataLoad(std::istream &stream, FormattedTable &v, void *context)
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)

◆ print() [1/2]

template<typename T >
virtual void TableValue< T >::print ( std::ostream &  os) const
inlineoverridevirtual

Implements TableValueBase.

Definition at line 69 of file FormattedTable.h.

69 { os << this->_value; };
std::basic_ostream< charT, traits > * os
Definition: InfixIterator.h:33

◆ print() [2/2]

template<>
void TableValue< bool >::print ( std::ostream &  os) const
inlinevirtual

Implements TableValueBase.

Definition at line 81 of file FormattedTable.h.

82 {
83  os << (this->_value ? "True" : "False");
84 }
std::basic_ostream< charT, traits > * os
Definition: InfixIterator.h:33

◆ set()

template<typename T >
T& TableValue< T >::set ( )
inline

Definition at line 67 of file FormattedTable.h.

67 { return _value; }

◆ store()

template<typename T >
void TableValue< T >::store ( std::ostream &  stream,
void context 
)
overridevirtual

Implements TableValueBase.

Definition at line 88 of file FormattedTable.h.

89 {
90  std::string type = typeid(T).name();
91  ::dataStore(stream, type, context);
92  ::dataStore(stream, _value, context);
93 }
std::string name(const ElemQuality q)
void dataStore(std::ostream &stream, FormattedTable &table, void *context)

Member Data Documentation

◆ _value

template<typename T >
T TableValue< T >::_value
private

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