MADNESS 0.10.1
TextFstreamOutputArchive Class Reference

Wraps an archive around a text filestream for output. More...

#include <text_fstream_archive.h>

Inheritance diagram for TextFstreamOutputArchive:
Collaboration diagram for TextFstreamOutputArchive:

Public Member Functions

 TextFstreamOutputArchive (const char *filename=nullptr, std::ios_base::openmode mode=std::ios_base::binary|std::ios_base::out|std::ios_base::trunc)
 Default constructor.
 ~TextFstreamOutputArchive ()
 Destructor.
void close ()
 Close the filestream.
void flush ()
 Flush the filestream.
void open (const char *filename, std::ios_base::openmode mode=std::ios_base::out|std::ios_base::trunc)
 Open the filestream.
void store (const char *t, long) const
 Store a character string, escaping '&', '<' and '> along the way.
template<class T>
std::enable_if< madness::is_ostreammable_v< T > >::type store (const T *t, long n) const
 Store data to the filestream.
void store (const unsigned char *t, long n) const
 Store a character string, without escaping characters.
template<class T>
void store_end_tag () const
 Closes the "cookie" tag for runtime type-checking.
template<class T>
void store_start_tag () const
 Stores the cookie for runtime type-checking into the archive as a tag.
Public Member Functions inherited from madness::archive::BaseArchive
 BaseArchive ()

Private Attributes

std::ofstream os
 The filestream.

Additional Inherited Members

Public Types inherited from madness::archive::BaseOutputArchive
using is_saving = std::true_type
 Type used by Boost.Serialization to determine if this object is an output archive.
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.
using is_saving = std::false_type
 Type used by Boost.Serialization to determine if this object is an output archive.
Static Public Attributes inherited from madness::archive::BaseOutputArchive
static constexpr bool is_output_archive = true
 Flag to determine if this object is an output archive.
Static Public Attributes inherited from madness::archive::BaseArchive
static constexpr bool is_archive = true
 Flag to determine if this object is an archive.
static constexpr bool is_input_archive = false
 Flag to determine if this object is an input archive.
static constexpr bool is_output_archive = false
 Flag to determine if this object is an output archive.
static constexpr bool is_parallel_archive = false
 Flag to determine if this object is a parallel archive.

Detailed Description

Wraps an archive around a text filestream for output.

Constructor & Destructor Documentation

◆ TextFstreamOutputArchive()

madness::archive::TextFstreamOutputArchive::TextFstreamOutputArchive ( const char * filename = nullptr,
std::ios_base::openmode mode = std::ios_base::binary | std::ios_base::out | std::ios_base::trunc )
inline

Default constructor.

The filename and open modes are optional here; they can be specified later by calling open().

Parameters
[in]filenameName of the file to write to.
[in]modeI/O attributes for opening the file.

◆ ~TextFstreamOutputArchive()

Member Function Documentation

◆ close()

Close the filestream.

◆ flush()

Flush the filestream.

◆ open()

void madness::archive::TextFstreamOutputArchive::open ( const char * filename,
std::ios_base::openmode mode = std::ios_base::out | std::ios_base::trunc )

Open the filestream.

Parameters
[in]filenameThe name of the file.
[in]modeI/O attributes for opening the file.

◆ store() [1/3]

void madness::archive::TextFstreamOutputArchive::store ( const char * t,
long  ) const

Store a character string, escaping '&', '<' and '> along the way.

Parameters
[in]tThe character string.

◆ store() [2/3]

template<class T>
std::enable_if< madness::is_ostreammable_v< T > >::type madness::archive::TextFstreamOutputArchive::store ( const T * t,
long n ) const
inline

Store data to the filestream.

The function only appears (due to enable_if) if T is serializable.

Template Parameters
TThe type of data to be written.
Parameters
[in]tLocation of the data to be written.
[in]nThe number of data items to be written.

◆ store() [3/3]

void madness::archive::TextFstreamOutputArchive::store ( const unsigned char * t,
long n ) const
inline

Store a character string, without escaping characters.

Parameters
[in]tThe character string.
[in]nThe number of characters to store.

◆ store_end_tag()

template<class T>
void madness::archive::TextFstreamOutputArchive::store_end_tag ( ) const
inline

Closes the "cookie" tag for runtime type-checking.

Template Parameters
TThe type of data to be stored between the tags.

◆ store_start_tag()

template<class T>
void madness::archive::TextFstreamOutputArchive::store_start_tag ( ) const
inline

Stores the cookie for runtime type-checking into the archive as a tag.

Template Parameters
TThe type of data to be stored between the tags.

Member Data Documentation

◆ os

std::ofstream madness::archive::TextFstreamOutputArchive::os
mutableprivate

The filestream.


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