Reader for the PLUMED checkpoint file written by CheckpointWriter. More...
#include <Checkpoint.h>
Classes | |
| struct | Entry |
Public Types | |
| enum class | Type { Int , Double , String } |
Public Member Functions | |
| CheckpointReader (const std::string &content) | |
| Parse the content of a checkpoint file. Throws on any inconsistency. | |
| void | beginSection (const std::string &name) |
| void | endSection () |
| template<typename T> | |
| T | get (const std::string &name) const |
| const Entry & | getEntry (const std::string &fullName) const |
| const std::vector< std::string > & | getEntryNames () const |
| Full names of all entries, in file order (for inspection tools). | |
| unsigned | getFormatVersion () const |
| const std::string & | getPlumedVersion () const |
| const std::vector< std::string > & | getSections () const |
| Full names of all sections, in file order (for inspection tools). | |
| std::vector< unsigned long long > | getShape (const std::string &name) const |
| Shape of a stored array. | |
| bool | has (const std::string &name) const |
| True if an entry with this name exists in the current section. | |
| bool | hasSection (const std::string &name) const |
| True if a section with this name exists inside the current section. | |
| void | read (const std::string &name, double &value) const |
| void | read (const std::string &name, long long &value) const |
| void | read (const std::string &name, std::string &value) const |
| template<typename T> | |
| void | read (const std::string &name, std::vector< T > &value) const |
| Read an array; value is resized to the stored number of elements. | |
| template<typename T> | |
| std::enable_if< std::is_integral< T >::value &&!std::is_same< T, longlong >::value >::type | read (const std::string &name, T &value) const |
| template<typename T> | |
| std::enable_if< std::is_floating_point< T >::value &&!std::is_same< T, double >::value >::type | read (const std::string &name, T &value) const |
Static Public Member Functions | |
| static unsigned | checksum (const std::string &data) |
| CRC32 of a string, the checksum used in the checkpoint file. | |
| static std::string | readFile (const std::string &path) |
| Read a file and parse it. | |
Private Member Functions | |
| std::string | currentPath () const |
| const Entry & | find (const std::string &name, Type type, bool scalar) const |
Private Attributes | |
| std::map< std::string, Entry > | entries |
| unsigned | formatVersion =0 |
| std::vector< std::string > | order |
| std::string | plumedVersion |
| std::vector< std::string > | sectionList |
| std::vector< std::string > | sections |
Reader for the PLUMED checkpoint file written by CheckpointWriter.
The whole content is parsed on construction, which detects truncated or corrupted files. Entries are then accessed by name, relative to the current section; unknown entries and sections are ignored, so that newer files can be read by older code as long as the entries they need are present.
|
strong |
|
explicit |
Parse the content of a checkpoint file. Throws on any inconsistency.
| void PLMD::CheckpointReader::beginSection | ( | const std::string & | name | ) |
|
static |
CRC32 of a string, the checksum used in the checkpoint file.
|
private |
| void PLMD::CheckpointReader::endSection | ( | ) |
|
private |
|
inline |
| const CheckpointReader::Entry & PLMD::CheckpointReader::getEntry | ( | const std::string & | fullName | ) | const |
|
inline |
Full names of all entries, in file order (for inspection tools).
|
inline |
|
inline |
|
inline |
Full names of all sections, in file order (for inspection tools).
| std::vector< unsigned long long > PLMD::CheckpointReader::getShape | ( | const std::string & | name | ) | const |
Shape of a stored array.
| bool PLMD::CheckpointReader::has | ( | const std::string & | name | ) | const |
True if an entry with this name exists in the current section.
| bool PLMD::CheckpointReader::hasSection | ( | const std::string & | name | ) | const |
True if a section with this name exists inside the current section.
| void PLMD::CheckpointReader::read | ( | const std::string & | name, |
| double & | value ) const |
| void PLMD::CheckpointReader::read | ( | const std::string & | name, |
| long long & | value ) const |
| void PLMD::CheckpointReader::read | ( | const std::string & | name, |
| std::string & | value ) const |
|
inline |
Read an array; value is resized to the stored number of elements.
|
inline |
|
inline |
|
static |
Read a file and parse it.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Hosted by GitHub
|
1.13.2
|