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 76 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 84 of file RestartableData.h.

85  {
86  _value_ptr = libmesh_make_unique<T>();
87  }

Member Function Documentation

◆ context()

void* RestartableDataValue::context ( )
inlineinherited

A context pointer for helping with load / store.

Definition at line 55 of file RestartableData.h.

55 { return _context; }

◆ get()

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

Definition at line 92 of file RestartableData.h.

92 { return *_value_ptr; }

Referenced by MeshGenerator::declareMeshProperty(), Restartable::declareRestartableDataWithContext(), and MeshMetaDataInterface::getMeshProperty().

◆ load()

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

Load the RestartableData from a binary stream.

Implements RestartableDataValue.

Definition at line 151 of file RestartableData.h.

152 {
153  loadHelper(stream, *_value_ptr, _context);
154 }

◆ name()

std::string RestartableDataValue::name ( )
inlineinherited

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

Definition at line 50 of file RestartableData.h.

50 { return _name; }

◆ set()

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

Definition at line 97 of file RestartableData.h.

97 { return *_value_ptr; }

Referenced by Restartable::declareRestartableDataWithContext().

◆ store()

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

Store the RestartableData into a binary stream.

Implements RestartableDataValue.

Definition at line 143 of file RestartableData.h.

144 {
145  T & tmp = *_value_ptr;
146  storeHelper(stream, tmp, _context);
147 }

◆ swap()

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

Swap.

Implements RestartableDataValue.

Definition at line 135 of file RestartableData.h.

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

◆ type()

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

String identifying the type of parameter stored.

Implements RestartableDataValue.

Definition at line 128 of file RestartableData.h.

129 {
130  return typeid(T).name();
131 }

Member Data Documentation

◆ _context

void* RestartableDataValue::_context
protectedinherited

A context pointer for helping with load and store.

Definition at line 68 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 65 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:
RestartableData::_value_ptr
std::unique_ptr< T > _value_ptr
Stored value.
Definition: RestartableData.h:121
loadHelper
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:798
RestartableDataValue::context
void * context()
A context pointer for helping with load / store.
Definition: RestartableData.h:55
RestartableDataValue::name
std::string name()
The full (unique) name of this particular piece of data.
Definition: RestartableData.h:50
RestartableDataValue::RestartableDataValue
RestartableDataValue(std::string name, void *context)
Constructor.
Definition: RestartableData.h:34
RestartableDataValue::_name
std::string _name
The full (unique) name of this particular piece of data.
Definition: RestartableData.h:65
RestartableDataValue::_context
void * _context
A context pointer for helping with load and store.
Definition: RestartableData.h:68
storeHelper
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:734