arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

KokoBuffer Class Reference

#include <KokoBuffer.h>

List of all members.

Public Member Functions

 KokoBuffer (void)
 KokoBuffer (unsigned int size)
 KokoBuffer (unsigned char *buf, unsigned int size, bool pad=false)
 KokoBuffer (const KokoBuffer &kbuf)
 ~KokoBuffer (void)
unsigned char * GetData (void)
unsigned char * GetBuffer (void)
 operator unsigned char * (void)
 operator void * (void)
bool SetCurSize (unsigned int csize)
void Memcopy (unsigned char *bufp, unsigned int size)
 ================================================================ Copy the given buffer into the KokoBuffer.

void Pack (void)
 ================================================================ Pack the given data to end of the current buffer.

bool Pack (unsigned char *bufp, unsigned int size)
void Unpack (void)
 ================================================================ Unpack/extract chunks of data from the buffer.

bool Unpack (unsigned char *dest, unsigned int size)
unsigned int Size (void)
 ================================================================ What size is the buffer (available and total).

unsigned int TotalSize (void)
void Resize (unsigned int size)
bool Locked (void)
 ================================================================= Simple buffer locking -- not thread safe...

void Lock (void)
void Unlock (void)
void SetTag (KokoTag &tag)
 ================================================================= Tag handling routines.

KokoTag GetTag (void)

Protected Member Functions

unsigned int bytes_free (void)
 ================================================================= How many bytes free to have to work with in this buffer?

unsigned int bytes_remain (unsigned char *ucp)
void grow (unsigned int new_size)
 ================================================================= Grow the buffer to accomodate the given new size.


Constructor & Destructor Documentation

KokoBuffer::KokoBuffer void   ) 
 

Definition at line 42 of file KokoBuffer.cpp.

References KOKOBUF_GROWTH_FACTOR.

KokoBuffer::KokoBuffer unsigned int  size  ) 
 

Definition at line 59 of file KokoBuffer.cpp.

References KOKOBUF_GROWTH_FACTOR, KokoTag, and size.

KokoBuffer::KokoBuffer unsigned char *  buf,
unsigned int  size,
bool  pad = false
 

Definition at line 76 of file KokoBuffer.cpp.

References KOKOBUF_GROWTH_FACTOR, KokoTag, and size.

KokoBuffer::KokoBuffer const KokoBuffer kbuf  ) 
 

Definition at line 98 of file KokoBuffer.cpp.

References _aptr, _buf, _cursize, _eptr, _growfact, _size, and KokoTag.

KokoBuffer::~KokoBuffer void   )  [inline]
 

Definition at line 35 of file KokoBuffer.h.


Member Function Documentation

unsigned int KokoBuffer::bytes_free void   )  [inline, protected]
 

================================================================= How many bytes free to have to work with in this buffer?

Definition at line 136 of file KokoBuffer.h.

Referenced by Pack().

unsigned int KokoBuffer::bytes_remain unsigned char *  ucp  )  [inline, protected]
 

Definition at line 139 of file KokoBuffer.h.

unsigned char* KokoBuffer::GetBuffer void   )  [inline]
 

Definition at line 47 of file KokoBuffer.h.

Referenced by MPICommunicator::Broadcast().

unsigned char* KokoBuffer::GetData void   )  [inline]
 

Definition at line 44 of file KokoBuffer.h.

KokoTag KokoBuffer::GetTag void   ) 
 

Definition at line 242 of file KokoBuffer.cpp.

References KOKO_ANY_TAG, and KokoTag.

Referenced by MPICommunicator::Broadcast().

void KokoBuffer::grow unsigned int  new_size  )  [protected]
 

================================================================= Grow the buffer to accomodate the given new size.

This keeps the current buffer data.

Definition at line 261 of file KokoBuffer.cpp.

Referenced by Pack(), and Resize().

void KokoBuffer::Lock void   )  [inline]
 

Definition at line 114 of file KokoBuffer.h.

Referenced by MPICommunicator::ARecv(), and MPICommunicator::ASend().

bool KokoBuffer::Locked void   )  [inline]
 

================================================================= Simple buffer locking -- not thread safe...

Warning! For the most part the Lock() and Unlock methods are intended to be used by code that knows the buffer is not safe for use yet (in this case the Comminicator class in the Koko Library). Be extremely careful with these two routines if you are not implementing a feature inside a communicator.

Definition at line 111 of file KokoBuffer.h.

Referenced by MPICommunicator::ARecv(), MPICommunicator::ASend(), MPICommunicator::Broadcast(), MPICommunicator::Recv(), MPICommunicator::Send(), and MPICommunicator::SendRecv().

void KokoBuffer::Memcopy unsigned char *  bufp,
unsigned int  size
 

================================================================ Copy the given buffer into the KokoBuffer.

This completely replaces any data in the buffer.

Definition at line 118 of file KokoBuffer.cpp.

References KokoTag, and size.

KokoBuffer::operator unsigned char * void   )  [inline]
 

Definition at line 50 of file KokoBuffer.h.

KokoBuffer::operator void * void   )  [inline]
 

Definition at line 53 of file KokoBuffer.h.

bool KokoBuffer::Pack unsigned char *  bufp,
unsigned int  size
 

Definition at line 150 of file KokoBuffer.cpp.

References bytes_free(), grow(), and size.

void KokoBuffer::Pack void   )  [inline]
 

================================================================ Pack the given data to end of the current buffer.

If you want to force the packing operation to start at the begining of the buffer call Pack() with no arguments.

Definition at line 76 of file KokoBuffer.h.

void KokoBuffer::Resize unsigned int  size  )  [inline]
 

Definition at line 101 of file KokoBuffer.h.

References grow(), and size.

Referenced by Messenger::ResizeBuffer().

bool KokoBuffer::SetCurSize unsigned int  csize  )  [inline]
 

Definition at line 56 of file KokoBuffer.h.

References KokoTag.

Referenced by MPICommunicator::Broadcast(), and MPICommunicator::Recv().

void KokoBuffer::SetTag KokoTag tag  ) 
 

================================================================= Tag handling routines.

This routines are here as one possible work-around of some message passing libraries not formally supporting tagged messages.

Definition at line 229 of file KokoBuffer.cpp.

References KokoTag.

Referenced by MPICommunicator::Broadcast().

unsigned int KokoBuffer::Size void   )  [inline]
 

================================================================ What size is the buffer (available and total).

Definition at line 95 of file KokoBuffer.h.

Referenced by MPICommunicator::ARecv(), MPICommunicator::ASend(), MPICommunicator::Send(), and MPICommunicator::SendRecv().

unsigned int KokoBuffer::TotalSize void   )  [inline]
 

Definition at line 98 of file KokoBuffer.h.

References KokoTag.

Referenced by MPICommunicator::Broadcast(), Messenger::BufferSize(), and MPICommunicator::Recv().

void KokoBuffer::Unlock void   )  [inline]
 

Definition at line 119 of file KokoBuffer.h.

bool KokoBuffer::Unpack unsigned char *  dest,
unsigned int  size
 

Definition at line 178 of file KokoBuffer.cpp.

References size.

void KokoBuffer::Unpack void   )  [inline]
 

================================================================ Unpack/extract chunks of data from the buffer.

If you want to force the packing operations to start at the begining of the buffer call Unpack() with no arguments.

Definition at line 88 of file KokoBuffer.h.


The documentation for this class was generated from the following files:
Send questions, comments, and bug reports to:
jmk