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

Wraps an archive around an STL vector for input. More...

#include <vector_archive.h>

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

Public Member Functions

 VectorInputArchive (std::vector< unsigned char > &v)
 Create a buffer to wrap the specified vector.
 
void close ()
 Close the archive.
 
template<class T >
std::enable_if< madness::is_trivially_serializable< T >::value, void >::type load (T *t, long n) const
 Load data from the vector.
 
std::size_t nbyte_avail () const
 Get the amount of space left to be read from the vector.
 
void open ()
 Open the archive.
 
void rewind () const
 Reset the read location to the beginning of the vector.
 
- Public Member Functions inherited from madness::archive::BaseArchive
 BaseArchive ()
 

Private Attributes

std::size_t i
 Current input location.
 
std::vector< unsigned char > * v
 The STL vector being wrapped.
 

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.
 
- 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::BaseInputArchive
static constexpr bool is_input_archive = true
 Flag to determine if this object is an input 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 an STL vector for input.

Constructor & Destructor Documentation

◆ VectorInputArchive()

madness::archive::VectorInputArchive::VectorInputArchive ( std::vector< unsigned char > &  v)
inline

Create a buffer to wrap the specified vector.

Parameters
[in]vThe vector.

Member Function Documentation

◆ close()

void madness::archive::VectorInputArchive::close ( )
inline

Close the archive.

Referenced by main().

◆ load()

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

Load data from the vector.

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

Template Parameters
TThe type of data to be loaded.
Parameters
[out]tWhere to store the loaded data.
[in]nThe number of data items to be loaded.

References i, m, MADNESS_EXCEPTION, T(), and v.

Referenced by madness::archive::MPIInputArchive::load(), and madness::archive::ContainerRecordInputArchive::load().

◆ nbyte_avail()

std::size_t madness::archive::VectorInputArchive::nbyte_avail ( ) const
inline

Get the amount of space left to be read from the vector.

Returns
The amount of space left to be read from the vector.

References i, and v.

Referenced by madness::archive::MPIInputArchive::load().

◆ open()

void madness::archive::VectorInputArchive::open ( )
inline

Open the archive.

◆ rewind()

void madness::archive::VectorInputArchive::rewind ( ) const
inline

Reset the read location to the beginning of the vector.

References i.

Referenced by madness::archive::MPIInputArchive::load().

Member Data Documentation

◆ i

std::size_t madness::archive::VectorInputArchive::i
mutableprivate

Current input location.

Referenced by load(), nbyte_avail(), and rewind().

◆ v

std::vector<unsigned char>* madness::archive::VectorInputArchive::v
mutableprivate

The STL vector being wrapped.

Referenced by load(), and nbyte_avail().


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