MADNESS 0.10.1
BinaryFstreamOutputArchive Class Reference

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

#include <binary_fstream_archive.h>

Inheritance diagram for BinaryFstreamOutputArchive:
Collaboration diagram for BinaryFstreamOutputArchive:

Public Member Functions

 BinaryFstreamOutputArchive (const char *filename=nullptr, std::ios_base::openmode mode=std::ios_base::binary|std::ios_base::out|std::ios_base::trunc)
 Default constructor.
 BinaryFstreamOutputArchive (const std::string name, std::ios_base::openmode mode=std::ios_base::binary|std::ios_base::out|std::ios_base::trunc)
void close ()
 Close the filestream.
void flush ()
 Flush the filestream.
void open (const char *filename, std::ios_base::openmode mode=std::ios_base::binary|std::ios_base::out|std::ios_base::trunc)
 Open the filestream.
template<class T>
std::enable_if< is_trivially_serializable< T >::value, void >::type store (const T *t, long n) const
 Write to the filestream.
Public Member Functions inherited from madness::archive::BaseArchive
 BaseArchive ()

Private Attributes

std::shared_ptr< char > iobuf
 Buffer.
std::ofstream os
 The filestream.

Static Private Attributes

static const std::size_t IOBUFSIZE = 4*1024*1024
 Buffer size.

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 binary filestream for output.

Constructor & Destructor Documentation

◆ BinaryFstreamOutputArchive() [1/2]

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

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.

◆ BinaryFstreamOutputArchive() [2/2]

madness::archive::BinaryFstreamOutputArchive::BinaryFstreamOutputArchive ( const std::string name,
std::ios_base::openmode mode = std::ios_base::binary | std::ios_base::out | std::ios_base::trunc )
inline

Member Function Documentation

◆ close()

◆ flush()

◆ open()

void madness::archive::BinaryFstreamOutputArchive::open ( const char * filename,
std::ios_base::openmode mode = std::ios_base::binary | 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()

template<class T>
std::enable_if< is_trivially_serializable< T >::value, void >::type madness::archive::BinaryFstreamOutputArchive::store ( const T * t,
long n ) const
inline

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

Member Data Documentation

◆ iobuf

Buffer.

◆ IOBUFSIZE

const std::size_t madness::archive::BinaryFstreamOutputArchive::IOBUFSIZE = 4*1024*1024
staticprivate

Buffer size.

◆ os

The filestream.


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