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...
 
virtual ~RestartableData ()
 
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

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

Constructor & Destructor Documentation

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

89  {
90  _value_ptr = new T;
91  }
RestartableDataValue(std::string name, void *context)
Constructor.
void * context()
A context pointer for helping with load / store.
T * _value_ptr
Stored value.
std::string name()
The full (unique) name of this particular piece of data.
template<typename T>
virtual RestartableData< T >::~RestartableData ( )
inlinevirtual

Definition at line 93 of file RestartableData.h.

93 { delete _value_ptr; }
T * _value_ptr
Stored value.

Member Function Documentation

void* RestartableDataValue::context ( )
inlineinherited

A context pointer for helping with load / store.

Definition at line 59 of file RestartableData.h.

59 { return _context; }
void * _context
A context pointer for helping with load and store.
template<typename T>
T& RestartableData< T >::get ( )
inline
Returns
a read-only reference to the parameter value.

Definition at line 98 of file RestartableData.h.

Referenced by Restartable::declareRestartableDataWithContext().

98 { return *_value_ptr; }
T * _value_ptr
Stored value.
template<typename T >
void RestartableData< T >::load ( std::istream &  stream)
inlineoverridevirtual

Load the RestartableData from a binary stream.

Implements RestartableDataValue.

Definition at line 157 of file RestartableData.h.

158 {
159  loadHelper(stream, *_value_ptr, _context);
160 }
void * _context
A context pointer for helping with load and store.
T * _value_ptr
Stored value.
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:592
std::string RestartableDataValue::name ( )
inlineinherited

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

Definition at line 54 of file RestartableData.h.

Referenced by RestartableData< T >::type().

54 { return _name; }
std::string _name
The full (unique) name of this particular piece of data.
template<typename T>
T& RestartableData< T >::set ( )
inline
Returns
a writable reference to the parameter value.

Definition at line 103 of file RestartableData.h.

Referenced by Restartable::declareRestartableDataWithContext().

103 { return *_value_ptr; }
T * _value_ptr
Stored value.
template<typename T >
void RestartableData< T >::store ( std::ostream &  stream)
inlineoverridevirtual

Store the RestartableData into a binary stream.

Implements RestartableDataValue.

Definition at line 149 of file RestartableData.h.

150 {
151  T & tmp = *_value_ptr;
152  storeHelper(stream, tmp, _context);
153 }
void * _context
A context pointer for helping with load and store.
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:528
T * _value_ptr
Stored value.
template<typename T>
void RestartableData< T >::swap ( RestartableDataValue rhs)
inlineoverridevirtual

Swap.

Implements RestartableDataValue.

Definition at line 141 of file RestartableData.h.

142 {
143  mooseAssert(rhs != NULL, "Assigning NULL?");
144  // _value.swap(cast_ptr<RestartableData<T>*>(rhs)->_value);
145 }
template<typename T >
std::string RestartableData< T >::type ( )
inlineoverridevirtual

String identifying the type of parameter stored.

Implements RestartableDataValue.

Definition at line 134 of file RestartableData.h.

135 {
136  return typeid(T).name();
137 }
std::string name()
The full (unique) name of this particular piece of data.

Member Data Documentation

void* RestartableDataValue::_context
protectedinherited

A context pointer for helping with load and store.

Definition at line 72 of file RestartableData.h.

Referenced by RestartableDataValue::context(), RestartableData< T >::load(), and RestartableData< T >::store().

std::string RestartableDataValue::_name
protectedinherited

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

Definition at line 69 of file RestartableData.h.

Referenced by RestartableDataValue::name().

template<typename T>
T* RestartableData< T >::_value_ptr
private

Stored value.

Definition at line 127 of file RestartableData.h.


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