www.mooseframework.org
Public Member Functions | Protected Attributes | Private Attributes | List of all members
RestartableData< T > Class Template Reference

Concrete definition of a parameter value for a specified type. More...

#include <RestartableData.h>

Inheritance diagram for RestartableData< T >:
[legend]

Public Member Functions

 RestartableData (std::string name, void *context)
 Constructor. More...
 
T & get ()
 
T & set ()
 
virtual std::string type () override
 String identifying the type of parameter stored. More...
 
virtual void swap (RestartableDataValue *rhs) override
 Swap. More...
 
virtual void store (std::ostream &stream) override
 Store the RestartableData into a binary stream. More...
 
virtual void load (std::istream &stream) override
 Load the RestartableData from a binary stream. More...
 
std::string name ()
 The full (unique) name of this particular piece of data. More...
 
void * context ()
 A context pointer for helping with load / store. More...
 

Protected Attributes

std::string _name
 The full (unique) name of this particular piece of data. More...
 
void * _context
 A context pointer for helping with load and store. More...
 

Private Attributes

std::unique_ptr< T > _value_ptr
 Stored value. More...
 

Detailed Description

template<typename T>
class RestartableData< T >

Concrete definition of a parameter value for a specified type.

Definition at line 75 of file RestartableData.h.

Constructor & Destructor Documentation

◆ RestartableData()

template<typename T >
RestartableData< T >::RestartableData ( std::string  name,
void *  context 
)
inline

Constructor.

Parameters
nameThe full (unique) name for this piece of data.
context'typeless' pointer to user-specific data.

Definition at line 83 of file RestartableData.h.

84  {
85  _value_ptr = libmesh_make_unique<T>();
86  }
RestartableDataValue(std::string name, void *context)
Constructor.
std::unique_ptr< T > _value_ptr
Stored value.
void * context()
A context pointer for helping with load / store.
std::string name()
The full (unique) name of this particular piece of data.

Member Function Documentation

◆ context()

void* RestartableDataValue::context ( )
inlineinherited

A context pointer for helping with load / store.

Definition at line 54 of file RestartableData.h.

54 { return _context; }
void * _context
A context pointer for helping with load and store.

◆ get()

template<typename T >
T& RestartableData< T >::get ( )
inline
Returns
a read-only reference to the parameter value.

Definition at line 91 of file RestartableData.h.

91 { return *_value_ptr; }
std::unique_ptr< T > _value_ptr
Stored value.

◆ load()

template<typename T >
void RestartableData< T >::load ( std::istream &  stream)
inlineoverridevirtual

Load the RestartableData from a binary stream.

Implements RestartableDataValue.

Definition at line 150 of file RestartableData.h.

151 {
152  loadHelper(stream, *_value_ptr, _context);
153 }
void * _context
A context pointer for helping with load and store.
std::unique_ptr< T > _value_ptr
Stored value.
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:731

◆ name()

std::string RestartableDataValue::name ( )
inlineinherited

The full (unique) name of this particular piece of data.

Definition at line 49 of file RestartableData.h.

49 { return _name; }
std::string _name
The full (unique) name of this particular piece of data.

◆ set()

template<typename T >
T& RestartableData< T >::set ( )
inline
Returns
a writable reference to the parameter value.

Definition at line 96 of file RestartableData.h.

96 { return *_value_ptr; }
std::unique_ptr< T > _value_ptr
Stored value.

◆ store()

template<typename T >
void RestartableData< T >::store ( std::ostream &  stream)
inlineoverridevirtual

Store the RestartableData into a binary stream.

Implements RestartableDataValue.

Definition at line 142 of file RestartableData.h.

143 {
144  T & tmp = *_value_ptr;
145  storeHelper(stream, tmp, _context);
146 }
void * _context
A context pointer for helping with load and store.
std::unique_ptr< T > _value_ptr
Stored value.
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:667

◆ swap()

template<typename T >
void RestartableData< T >::swap ( RestartableDataValue rhs)
inlineoverridevirtual

Swap.

Implements RestartableDataValue.

Definition at line 134 of file RestartableData.h.

135 {
136  mooseAssert(rhs, "Assigning NULL?");
137  // _value.swap(cast_ptr<RestartableData<T>*>(rhs)->_value);
138 }

◆ type()

template<typename T >
std::string RestartableData< T >::type ( )
inlineoverridevirtual

String identifying the type of parameter stored.

Implements RestartableDataValue.

Definition at line 127 of file RestartableData.h.

128 {
129  return typeid(T).name();
130 }
std::string name()
The full (unique) name of this particular piece of data.

Member Data Documentation

◆ _context

void* RestartableDataValue::_context
protectedinherited

A context pointer for helping with load and store.

Definition at line 67 of file RestartableData.h.

Referenced by RestartableDataValue::context().

◆ _name

std::string RestartableDataValue::_name
protectedinherited

The full (unique) name of this particular piece of data.

Definition at line 64 of file RestartableData.h.

Referenced by RestartableDataValue::name().

◆ _value_ptr

template<typename T >
std::unique_ptr<T> RestartableData< T >::_value_ptr
private

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