utilities  0.0
Classes | Public Member Functions | List of all members
molpro::bytestream Class Reference

The bytestream class provides a container for data to be serialised, and subsequently unpacked. More...

#include <bytestreamC.h>

Public Member Functions

 bytestream ()
 Construct an empty bytestream object. More...
 
 bytestream (const char *buffer)
 Construct a bytestream object to contain the raw data of a previous bytestream construction. More...
 
 ~bytestream ()
 
molpro::array< double > doubles ()
 Interpret the next array in the object as an array of doubles, advance the pointer to the following object, and return the array. More...
 
molpro::array< fintints ()
 Interpret the next array in the object as an array of integers, advance the pointer to the following object, and return the array. More...
 
molpro::array< char > chars ()
 Interpret the next array in the object as an array of characters, advance the pointer to the following object, and return the array. More...
 
bytestream byteStream ()
 Interpret the next item in the object as a bytestream, advance the pointer to the following object, and return the item. More...
 
void reset ()
 Reset the pointer to the beginning of the buffer. More...
 
void append (const double *array, size_t length=1)
 Add a double array to the bytestream. More...
 
void append (const fint *array, size_t length=1)
 Add an integer array to the bytestream. More...
 
void append (const char *array, size_t length=1)
 Add a char array to the bytestream. More...
 
void append (const bytestream &bs)
 
void append (size_t i)
 
template<class T >
void append (const T *array, size_t length=1)
 
template<class T >
void append (const std::vector< T > array)
 
size_t size () const
 The size of the bytestream data. More...
 
size_t position () const
 The current position in the bytestream data during unpacking through successive calls to doubles(), ints() or chars(). More...
 
const std::vector< char > & data () const
 The raw data of the object. More...
 
void dump ()
 
size_t hash () const
 
size_t position ()
 

Detailed Description

The bytestream class provides a container for data to be serialised, and subsequently unpacked.

Constructor & Destructor Documentation

◆ bytestream() [1/2]

bytestream::bytestream ( )

Construct an empty bytestream object.

◆ bytestream() [2/2]

bytestream::bytestream ( const char *  buffer)

Construct a bytestream object to contain the raw data of a previous bytestream construction.

Parameters
bufferThe data obtained from a previous construction of a bytestream.

◆ ~bytestream()

bytestream::~bytestream ( )

Member Function Documentation

◆ append() [1/7]

void bytestream::append ( const bytestream bs)

◆ append() [2/7]

void bytestream::append ( const char *  array,
size_t  length = 1 
)

Add a char array to the bytestream.

Parameters
arraySource of data.
lengthLength of data.

◆ append() [3/7]

void bytestream::append ( const double *  array,
size_t  length = 1 
)

Add a double array to the bytestream.

Parameters
arraySource of data.
lengthLength of data.

◆ append() [4/7]

void bytestream::append ( const fint array,
size_t  length = 1 
)

Add an integer array to the bytestream.

Parameters
arraySource of data. The integers should be of type fint; however, there is also a template function that copies to fint from other integer types, and then calls this function.
lengthLength of data.

◆ append() [5/7]

template<class T >
void molpro::bytestream::append ( const std::vector< T >  array)
inline

◆ append() [6/7]

template<class T >
void molpro::bytestream::append ( const T *  array,
size_t  length = 1 
)
inline

◆ append() [7/7]

void molpro::bytestream::append ( size_t  i)
inline

◆ byteStream()

bytestream bytestream::byteStream ( )

Interpret the next item in the object as a bytestream, advance the pointer to the following object, and return the item.

Returns

◆ chars()

molpro::array< char > bytestream::chars ( )

Interpret the next array in the object as an array of characters, advance the pointer to the following object, and return the array.

Returns

◆ data()

const std::vector<char>& molpro::bytestream::data ( ) const
inline

The raw data of the object.

Returns

◆ doubles()

molpro::array< double > bytestream::doubles ( )

Interpret the next array in the object as an array of doubles, advance the pointer to the following object, and return the array.

Returns

◆ dump()

void bytestream::dump ( )

◆ hash()

size_t bytestream::hash ( ) const

◆ ints()

molpro::array< fint > bytestream::ints ( )

Interpret the next array in the object as an array of integers, advance the pointer to the following object, and return the array.

Returns

◆ position() [1/2]

size_t molpro::bytestream::position ( )
inline

◆ position() [2/2]

size_t bytestream::position ( ) const

The current position in the bytestream data during unpacking through successive calls to doubles(), ints() or chars().

Returns

◆ reset()

void bytestream::reset ( )

Reset the pointer to the beginning of the buffer.

◆ size()

size_t bytestream::size ( ) const

The size of the bytestream data.

Returns

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