MADNESS 0.10.1
Public Member Functions | Private Attributes | List of all members
madness::archive::TextFstreamOutputArchive Class Reference

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

#include <text_fstream_archive.h>

Inheritance diagram for madness::archive::TextFstreamOutputArchive:
Inheritance graph
[legend]
Collaboration diagram for madness::archive::TextFstreamOutputArchive:
Collaboration graph
[legend]

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.

References madness::filename, and open().

◆ ~TextFstreamOutputArchive()

madness::archive::TextFstreamOutputArchive::~TextFstreamOutputArchive ( )
inline

Destructor.

References close().

Member Function Documentation

◆ close()

void madness::archive::TextFstreamOutputArchive::close ( )

Close the filestream.

References os.

Referenced by ~TextFstreamOutputArchive(), and main().

◆ flush()

void madness::archive::TextFstreamOutputArchive::flush ( )
inline

Flush the filestream.

References os.

◆ 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.

References ARCHIVE_MAJOR_VERSION, ARCHIVE_MINOR_VERSION, madness::archive::archive_type_names, bufsize, madness::filename, os, and store().

Referenced by TextFstreamOutputArchive().

◆ 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.

References c, and os.

◆ 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.

References os.

Referenced by open().

◆ 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.

References os.

◆ 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.

References bufsize, and os.

Referenced by madness::archive::ArchivePrePostImpl< TextFstreamOutputArchive, T >::postamble_store().

◆ 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.

References bufsize, MAD_ARCHIVE_DEBUG, and os.

Referenced by madness::archive::ArchivePrePostImpl< TextFstreamOutputArchive, T >::preamble_store().

Member Data Documentation

◆ os

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

The filestream.

Referenced by close(), flush(), open(), store(), store(), store(), store_end_tag(), and store_start_tag().


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