Abstract definition of a RestartableData value. More...
#include <RestartableData.h>
Classes | |
class | SetDeclaredKey |
Helper that protects access to setDeclared() to only MooseApp. More... | |
class | SetNotLoadedKey |
Helper that protects access to setNotLoaded() to only RestartableDataReader. More... | |
class | SetNotStoredKey |
Helper that protects access to setNotStored() to only RestartableDataWriter. More... | |
struct | StoreJSONParams |
Struct that represents parameters for how to store the JSON value via store . More... | |
Public Member Functions | |
RestartableDataValue (const std::string &name, void *const context) | |
Constructor. More... | |
virtual | ~RestartableDataValue ()=default |
Destructor. More... | |
virtual std::string | type () const =0 |
String identifying the type of parameter stored. More... | |
virtual const std::type_info & | typeId () const =0 |
The type ID of the underlying data. More... | |
const std::string & | name () const |
The full (unique) name of this particular piece of data. More... | |
void * | context () |
A context pointer for helping with load / store. More... | |
bool | hasContext () const |
bool | declared () const |
Whether or not this data has been declared. More... | |
void | setDeclared (const SetDeclaredKey) |
Sets that this restartable value has been declared. More... | |
bool | loaded () const |
Whether or not this data has been loaded. More... | |
void | setNotLoaded (const SetNotLoadedKey) |
Sets that this restartable value has been loaded. More... | |
bool | stored () const |
Whether or not this data has been loaded. More... | |
void | setNotStored (const SetNotStoredKey) |
Sets that this restartable value has been loaded. More... | |
void | store (std::ostream &stream) |
Stores the value into the stream stream and sets it as stored. More... | |
void | load (std::istream &stream) |
Loads the value from the stream stream and sets it as loaded. More... | |
virtual void | storeInternal (std::ostream &stream)=0 |
Internal method that stores the value into the stream stream in the specialized class. More... | |
virtual void | loadInternal (std::istream &stream)=0 |
Internal method that loads the value from the stream stream in the specialized class. More... | |
virtual bool | hasStoreJSON () const =0 |
void | store (nlohmann::json &json, const StoreJSONParams ¶ms=StoreJSONParams{}) const |
Stores this restartable data in the JSON entry json , with the options set by params (optional; defaults to just the type and underlying value) More... | |
Protected Member Functions | |
virtual void | storeJSONValue (nlohmann::json &json) const =0 |
Internal method for storing the underlying JSON value. More... | |
Protected Attributes | |
const std::string | _name |
The full (unique) name of this particular piece of data. More... | |
void *const | _context |
A context pointer for helping with load and store. More... | |
Private Attributes | |
bool | _declared |
Whether or not this data has been declared (true) or only retreived (false) More... | |
bool | _loaded |
Whether or not this has value has been loaded. More... | |
bool | _stored |
Whether or not this has value has been stored. More... | |
Abstract definition of a RestartableData value.
Definition at line 31 of file RestartableData.h.
RestartableDataValue::RestartableDataValue | ( | const std::string & | name, |
void *const | context | ||
) |
Constructor.
name | The full (unique) name for this piece of data. |
context | 'typeless' pointer to user-specific data. |
Definition at line 12 of file RestartableData.C.
|
virtualdefault |
Destructor.
|
inline |
A context pointer for helping with load / store.
Definition at line 65 of file RestartableData.h.
|
inline |
Whether or not this data has been declared.
Definition at line 85 of file RestartableData.h.
Referenced by store().
|
inline |
Definition at line 70 of file RestartableData.h.
Referenced by store().
|
pure virtual |
store
Implemented in RestartableData< T >, RestartableData< RestartableEquationSystems >, RestartableData< std::list< std::vector< T > > >, and RestartableData< std::list< T > >.
Referenced by store().
void RestartableDataValue::load | ( | std::istream & | stream | ) |
Loads the value from the stream stream
and sets it as loaded.
Definition at line 32 of file RestartableData.C.
|
inline |
Whether or not this data has been loaded.
This is typically reset on a call to RestartableDataReader::restore()
Definition at line 98 of file RestartableData.h.
Referenced by store().
|
pure virtual |
Internal method that loads the value from the stream stream
in the specialized class.
Implemented in RestartableData< T >, RestartableData< RestartableEquationSystems >, RestartableData< std::list< std::vector< T > > >, RestartableData< std::list< T > >, ReporterState< T >, and ReporterState< std::vector< T > >.
Referenced by load().
|
inline |
The full (unique) name of this particular piece of data.
Definition at line 60 of file RestartableData.h.
Referenced by RestartableDataMap::addData(), RestartableDataMap::findData(), and store().
void RestartableDataValue::setDeclared | ( | const SetDeclaredKey | ) |
Sets that this restartable value has been declared.
Definition at line 18 of file RestartableData.C.
Referenced by MooseApp::registerRestartableData().
|
inline |
Sets that this restartable value has been loaded.
Definition at line 113 of file RestartableData.h.
|
inline |
Sets that this restartable value has been loaded.
Definition at line 136 of file RestartableData.h.
void RestartableDataValue::store | ( | std::ostream & | stream | ) |
Stores the value into the stream stream
and sets it as stored.
Definition at line 25 of file RestartableData.C.
void RestartableDataValue::store | ( | nlohmann::json & | json, |
const StoreJSONParams & | params = StoreJSONParams{} |
||
) | const |
Stores this restartable data in the JSON entry json
, with the options set by params
(optional; defaults to just the type and underlying value)
If the underlying type is not supported for JSON output (if hasStoreJSON() == false), and the parameters have the value output as enabled, this will error.
Definition at line 39 of file RestartableData.C.
|
inline |
Whether or not this data has been loaded.
This is typically reset on a call to RestartableDataWriter::write()
Definition at line 121 of file RestartableData.h.
Referenced by store().
|
pure virtual |
Internal method that stores the value into the stream stream
in the specialized class.
Implemented in RestartableData< T >, RestartableData< RestartableEquationSystems >, RestartableData< std::list< std::vector< T > > >, RestartableData< std::list< T > >, ReporterState< T >, and ReporterState< std::vector< T > >.
Referenced by store().
|
protectedpure virtual |
Internal method for storing the underlying JSON value.
Implemented in RestartableData< T >, RestartableData< RestartableEquationSystems >, RestartableData< std::list< std::vector< T > > >, and RestartableData< std::list< T > >.
Referenced by store().
|
pure virtual |
String identifying the type of parameter stored.
Must be reimplemented in derived classes.
Implemented in RestartableData< T >, RestartableData< RestartableEquationSystems >, RestartableData< std::list< std::vector< T > > >, and RestartableData< std::list< T > >.
Referenced by MeshGenerator::declareMeshProperty(), MooseApp::registerRestartableData(), and store().
|
pure virtual |
The type ID of the underlying data.
Implemented in RestartableData< T >, RestartableData< RestartableEquationSystems >, RestartableData< std::list< std::vector< T > > >, and RestartableData< std::list< T > >.
Referenced by MooseApp::registerRestartableData().
|
protected |
A context pointer for helping with load and store.
Definition at line 197 of file RestartableData.h.
Referenced by context(), and hasContext().
|
private |
Whether or not this data has been declared (true) or only retreived (false)
Definition at line 201 of file RestartableData.h.
Referenced by declared(), and setDeclared().
|
private |
Whether or not this has value has been loaded.
Definition at line 204 of file RestartableData.h.
Referenced by load(), loaded(), and setNotLoaded().
|
protected |
The full (unique) name of this particular piece of data.
Definition at line 194 of file RestartableData.h.
Referenced by name().
|
private |
Whether or not this has value has been stored.
Definition at line 207 of file RestartableData.h.
Referenced by setNotStored(), store(), and stored().