Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SAMRAI::tbox::MessageStream Class Reference

#include <source/toolbox/stream/MessageStream.h>

Inheritance diagram for SAMRAI::tbox::MessageStream:

Inheritance graph
[legend]
List of all members.

Public Types

enum  StreamMode { Read, Write }

Public Member Functions

 MessageStream (const int bytes, const StreamMode mode)
 MessageStream (const int bytes, const StreamMode mode, const bool use_xdr)
virtual ~MessageStream ()
void * getBufferStart ()
int getCurrentSize () const
int getCurrentIndex () const
void setCurrentIndex (const int index)
void resetIndex ()
virtual void printClassData (ostream &os) const
Boolean Stream Primitives
Pack and unpack booleans into and out of the message stream.

virtual AbstractStreamoperator<< (const bool &data)
 Pack a single bool into the message stream.
virtual AbstractStreamoperator>> (bool &data)
 Remove a single bool from the message stream.
virtual void pack (const bool *data, const int n=1)
 Pack an array of bools into the message stream.
virtual void unpack (bool *data, const int n=1)
 Remove an array of bools from the message stream.
Character Stream Primitives
Pack and unpack chars into and out of the message stream.

virtual AbstractStreamoperator<< (const char &data)
 Pack a single char into the message stream.
virtual AbstractStreamoperator>> (char &data)
 Remove a single char from the message stream.
virtual void pack (const char *data, const int n=1)
 Pack an array of chars into the message stream.
virtual void unpack (char *data, const int n=1)
 Remove an array of chars from the message stream.
Double Complex Stream Primitives
Pack and unpack double complex into and out of the message stream.

virtual AbstractStreamoperator<< (const dcomplex &data)
 Pack a single double complex into the message stream.
virtual AbstractStreamoperator>> (dcomplex &data)
 Remove a single double complex from the message stream.
virtual void pack (const dcomplex *data, const int n=1)
 Pack an array of double complex into the message stream.
virtual void unpack (dcomplex *data, const int n=1)
 Remove an array of double complex from the message stream.
Double Stream Primitives
Pack and unpack doubles into and out of the message stream.

virtual AbstractStreamoperator<< (const double &data)
 Pack a single double into the message stream.
virtual AbstractStreamoperator>> (double &data)
 Remove a single double from the message stream.
virtual void pack (const double *data, const int n=1)
 Pack an array of doubles into the message stream.
virtual void unpack (double *data, const int n=1)
 Remove an array of doubles from the message stream.
Float Stream Primitives
Pack and unpack floats into and out of the message stream.

virtual AbstractStreamoperator<< (const float &data)
 Pack a single float into the message stream.
virtual AbstractStreamoperator>> (float &data)
 Remove a single float from the message stream.
virtual void pack (const float *data, const int n=1)
 Pack an array of floats into the message stream.
virtual void unpack (float *data, const int n=1)
 Remove an array of floats from the message stream.
Integer Stream Primitives
Pack and unpack integers into and out of the message stream.

virtual AbstractStreamoperator<< (const int &data)
 Pack a single integer into the message stream.
virtual AbstractStreamoperator>> (int &data)
 Remove a single integer from the message stream.
virtual void pack (const int *data, const int n=1)
 Pack an array of integers into the message stream.
virtual void unpack (int *data, const int n=1)
 Remove an array of integers from the message stream.

Static Public Member Functions

static void useXDR (const bool flag)

Detailed Description

Class MessageStream implements a message buffer of fixed size used by the communication routines. It is a subclass of AbstractStream. Class MessageStream defines two mechanisms can be used to pack or unpack a message stream: (1) XDR and (2) a straight-forward byte copy. XDR has the advantage of machine independence for heterogenous networks but is much slower than a simple copy.

See also:
tbox::AbstractStream

tbox::XDRStream


Member Enumeration Documentation

enum SAMRAI::tbox::MessageStream::StreamMode
 

Enumeration values:
Read 
Write 


Constructor & Destructor Documentation

SAMRAI::tbox::MessageStream::MessageStream const int  bytes,
const StreamMode  mode
 

Create a message stream of the specified size in bytes and the stream mode (one of MessageStream::Read or MessageStream::Write). The choice of XDR translation is based on the current value of the class-wide useXDR() flag.

SAMRAI::tbox::MessageStream::MessageStream const int  bytes,
const StreamMode  mode,
const bool  use_xdr
 

Create a message stream of the specified size in bytes and the stream mode (either MessageStream::Read or MessageStream::Write). The choice of XDR translation is based on the argument to the constructor, which is independent of the class-wide XDR flag.

SAMRAI::tbox::MessageStream::~MessageStream  )  [virtual]
 

Virtual destructor for a message stream.


Member Function Documentation

void SAMRAI::tbox::MessageStream::useXDR const bool  flag  )  [inline, static]
 

Whether to use XDR translation when communicating via message streams. XDR translation is slower but provides portability across heterogenous machine networks. By default, XDR translation is turned on.

void * SAMRAI::tbox::MessageStream::getBufferStart  )  [inline]
 

Return a pointer to the start of the message buffer.

int SAMRAI::tbox::MessageStream::getCurrentSize  )  const [inline]
 

Return the current size of the buffer in bytes.

int SAMRAI::tbox::MessageStream::getCurrentIndex  )  const [inline]
 

Return the current index into the buffer.

void SAMRAI::tbox::MessageStream::setCurrentIndex const int  index  )  [inline]
 

Set the current index into the buffer. Further packing/unpacking will begin at this new location.

void SAMRAI::tbox::MessageStream::resetIndex  )  [inline]
 

Reset the index to the beginning of the buffer. This is the same as setting the buffer index to zero via setCurrentIndex().

AbstractStream & SAMRAI::tbox::MessageStream::operator<< const bool &  data  )  [virtual]
 

Pack a single bool into the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator>> bool &  data  )  [virtual]
 

Remove a single bool from the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::pack const bool *  data,
const int  n = 1
[virtual]
 

Pack an array of bools into the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::unpack bool *  data,
const int  n = 1
[virtual]
 

Remove an array of bools from the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator<< const char &  data  )  [virtual]
 

Pack a single char into the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator>> char &  data  )  [virtual]
 

Remove a single char from the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::pack const char *  data,
const int  n = 1
[virtual]
 

Pack an array of chars into the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::unpack char *  data,
const int  n = 1
[virtual]
 

Remove an array of chars from the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator<< const dcomplex data  )  [virtual]
 

Pack a single double complex into the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator>> dcomplex data  )  [virtual]
 

Remove a single double complex from the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::pack const dcomplex data,
const int  n = 1
[virtual]
 

Pack an array of double complex into the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::unpack dcomplex data,
const int  n = 1
[virtual]
 

Remove an array of double complex from the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator<< const double &  data  )  [virtual]
 

Pack a single double into the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator>> double &  data  )  [virtual]
 

Remove a single double from the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::pack const double *  data,
const int  n = 1
[virtual]
 

Pack an array of doubles into the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::unpack double *  data,
const int  n = 1
[virtual]
 

Remove an array of doubles from the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator<< const float &  data  )  [virtual]
 

Pack a single float into the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator>> float &  data  )  [virtual]
 

Remove a single float from the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::pack const float *  data,
const int  n = 1
[virtual]
 

Pack an array of floats into the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::unpack float *  data,
const int  n = 1
[virtual]
 

Remove an array of floats from the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator<< const int &  data  )  [virtual]
 

Pack a single integer into the message stream.

Implements SAMRAI::tbox::AbstractStream.

AbstractStream & SAMRAI::tbox::MessageStream::operator>> int &  data  )  [virtual]
 

Remove a single integer from the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::pack const int *  data,
const int  n = 1
[virtual]
 

Pack an array of integers into the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::unpack int *  data,
const int  n = 1
[virtual]
 

Remove an array of integers from the message stream.

Implements SAMRAI::tbox::AbstractStream.

void SAMRAI::tbox::MessageStream::printClassData ostream &  os  )  const [virtual]
 

Print out internal class data for debugging.


The documentation for this class was generated from the following files:
Generated on Fri Dec 2 11:33:35 2005 for SAMRAI by  doxygen 1.4.2