MADNESS
0.10.1
|
Wraps an archive around a text filestream for input. More...
#include <text_fstream_archive.h>
Public Member Functions | |
TextFstreamInputArchive (const char *filename=nullptr, std::ios_base::openmode mode=std::ios_base::in) | |
Default constructor. More... | |
template<class T > | |
void | check_end_tag () const |
Read the closing "cookie" tag. More... | |
template<class T > | |
void | check_start_tag (bool end=false) const |
Check the "cookie" tag in the archive for runtime type-checking. More... | |
void | close () |
Close the filestream. More... | |
void | load (char *t, long n) const |
Load characters from the filestream, without converting escaped characters. More... | |
template<class T > | |
std::enable_if< madness::is_istreammable_v< T > >::type | load (T *t, long n) const |
Load from the filestream. More... | |
void | load (unsigned char *t, long n) const |
Load characters from the filestream, interpreting escaped characters along the way. More... | |
void | open (const char *filename, std::ios_base::openmode mode=std::ios_base::in) |
Open the filestream. More... | |
Public Member Functions inherited from madness::archive::BaseArchive | |
BaseArchive () | |
Private Member Functions | |
void | eat_eol () const |
Eat the EOL after each entry to enable a char -by-char read of strings. More... | |
Private Attributes | |
std::ifstream | is |
The filestream. More... | |
Additional Inherited Members | |
Public Types inherited from madness::archive::BaseInputArchive | |
using | is_loading = std::true_type |
Type used by Boost.Serialization to determine if this object is an input archive. More... | |
Public Types inherited from madness::archive::BaseArchive | |
using | is_loading = std::false_type |
Type used by Boost.Serialization to determine if this object is an input archive. More... | |
using | is_saving = std::false_type |
Type used by Boost.Serialization to determine if this object is an output archive. More... | |
Static Public Attributes inherited from madness::archive::BaseInputArchive | |
static constexpr bool | is_input_archive = true |
Flag to determine if this object is an input archive. More... | |
Static Public Attributes inherited from madness::archive::BaseArchive | |
static constexpr bool | is_archive = true |
Flag to determine if this object is an archive. More... | |
static constexpr bool | is_input_archive = false |
Flag to determine if this object is an input archive. More... | |
static constexpr bool | is_output_archive = false |
Flag to determine if this object is an output archive. More... | |
static constexpr bool | is_parallel_archive = false |
Flag to determine if this object is a parallel archive. More... | |
Wraps an archive around a text filestream for input.
|
inline |
Default constructor.
The filename and open modes are optional here; they can be specified later by calling open()
.
[in] | filename | Name of the file to read from. |
[in] | mode | I/O attributes for opening the file. |
References madness::filename, and open().
|
inline |
Read the closing "cookie" tag.
T | The expected data type between the tags. |
Referenced by madness::archive::ArchivePrePostImpl< TextFstreamInputArchive, T >::postamble_load().
|
inline |
Check the "cookie" tag in the archive for runtime type-checking.
T | The expected data type. |
MadnessException | if the tag does not match that of the expected type. |
References madness::archive::archive_type_names, bufsize, is, and MADNESS_EXCEPTION.
Referenced by madness::archive::ArchivePrePostImpl< TextFstreamInputArchive, T >::preamble_load().
|
inline |
|
private |
Eat the EOL after each entry to enable a char
-by-char
read of strings.
References is, and MADNESS_EXCEPTION.
Referenced by load().
void madness::archive::TextFstreamInputArchive::load | ( | char * | t, |
long | n | ||
) | const |
Load characters from the filestream, without converting escaped characters.
[out] | t | Where to put the loaded characters. |
[in] | n | The number of characters to be loaded. |
References eat_eol(), is, and MADNESS_EXCEPTION.
|
inline |
Load from the filestream.
The function only appears (due to enable_if
) if T
is serializable.
T | The type of data to be read. |
[out] | t | Where to put the loaded data. |
[in] | n | The number of data items to be loaded. |
References eat_eol().
void madness::archive::TextFstreamInputArchive::load | ( | unsigned char * | t, |
long | n | ||
) | const |
void madness::archive::TextFstreamInputArchive::open | ( | const char * | filename, |
std::ios_base::openmode | mode = std::ios_base::in |
||
) |
Open the filestream.
[in] | filename | The name of the file. |
[in] | mode | I/O attributes for opening the file. |
References ARCHIVE_MAJOR_VERSION, ARCHIVE_MINOR_VERSION, bufsize, madness::filename, is, and MADNESS_EXCEPTION.
Referenced by TextFstreamInputArchive().
|
mutableprivate |
The filestream.
Referenced by check_start_tag(), close(), eat_eol(), load(), and open().