Shared implementation of the Savepoint. More...
#include <SavepointImpl.h>
Public Member Functions | |
template<class StringType , class = typename std::enable_if<!std::is_same<StringType, json::json>::value>::type> | |
SavepointImpl (const StringType &name) | |
Construct an empty savepoint (wihtout metaInfo i.e this->empty() == true) | |
template<class StringType , class MetainfoType > | |
SavepointImpl (StringType &&name, MetainfoType &&metaInfo) | |
Construct savepoint with name and metaInfo | |
SavepointImpl (const SavepointImpl &other) | |
Copy constructor. | |
SavepointImpl (SavepointImpl &&)=default | |
Move constructor. | |
SavepointImpl (const json::json &jsonNode) | |
Construct from JSON. | |
SavepointImpl & | operator= (const SavepointImpl &other) |
Copy assignment. | |
SavepointImpl & | operator= (SavepointImpl &&)=default |
Move assignment. | |
template<class StringType , class ValueType > | |
void | addMetainfo (StringType &&key, ValueType &&value) |
Add a new key = value pair to the metaInfo of the Savepoint. More... | |
template<class T , class StringType > | |
T | getMetainfoAs (StringType &&key) const |
Query metaInfo for key key and retrieve value as type T More... | |
bool | operator== (const SavepointImpl &right) const |
Test for equality. | |
bool | operator!= (const SavepointImpl &right) const |
Test for inequality. | |
void | swap (SavepointImpl &other) noexcept |
Swap with other. | |
const std::string & | name () const noexcept |
Access name. | |
MetainfoMapImpl & | metaInfo () noexcept |
Access meta-info. | |
const MetainfoMapImpl & | metaInfo () const noexcept |
bool | empty () const noexcept |
Returns a bool value indicating whether the savepoint is empty (i.e has no meta-information attached) | |
json::json | toJSON () const |
Convert to JSON. | |
void | fromJSON (const json::json &jsonNode) |
Construct from JSON node. More... | |
std::string | toString () const |
Convert savepoint to string. | |
std::shared_ptr< MetainfoMapImpl > & | metaInfoPtr () noexcept |
Get meta-info pointer. | |
const std::shared_ptr< MetainfoMapImpl > & | metaInfoPtr () const noexcept |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const SavepointImpl &s) |
Convert to stream. | |
Shared implementation of the Savepoint.
Savepoints have a specialization of std::hash and can thus be used in hash-maps such as std::unordered_map.
Direct usage of this class is discouraged, use the Savepoint classes provided by the Frontends instead.
Definition at line 38 of file SavepointImpl.h.
|
inline |
Add a new key = value
pair to the metaInfo
of the Savepoint.
key | Key of the new element |
value | Object to be copied to (or moved as) the value of the new element |
Exception | Value cannot be inserted as it already exists |
Definition at line 74 of file SavepointImpl.h.
void serialbox::SavepointImpl::fromJSON | ( | const json::json & | jsonNode | ) |
Construct from JSON node.
Exception | JSON node is ill-formed |
Definition at line 34 of file SavepointImpl.cpp.
|
inline |
Query metaInfo
for key key
and retrieve value as type T
key | Key of the requested element |
Exception | Key key does not exist in the metaInfo map or value cannot be converted to type T |
Definition at line 86 of file SavepointImpl.h.