ccommbufferbase.h

00001 //=========================================================================
00002 //  CCOMMBUFFERBASE.H - part of
00003 //
00004 //                  OMNeT++/OMNEST
00005 //           Discrete System Simulation in C++
00006 //
00007 //   Written by:  Andras Varga, 2003
00008 //
00009 //
00010 //=========================================================================
00011 
00012 /*--------------------------------------------------------------*
00013   Copyright (C) 2003-2005 Andras Varga
00014   Monash University, Dept. of Electrical and Computer Systems Eng.
00015   Melbourne, Australia
00016 
00017   This file is distributed WITHOUT ANY WARRANTY. See the file
00018   `license' for details on this and other legal matters.
00019 *--------------------------------------------------------------*/
00020 
00021 #ifndef __CCOMMBUFFERBASE_H__
00022 #define __CCOMMBUFFERBASE_H__
00023 
00024 #include "ccommbuffer.h"
00025 
00030 class cCommBufferBase : public cCommBuffer
00031 {
00032   protected:
00033     char *mBuffer;    // the buffer
00034     int mBufferSize;  // size of buffer allocated
00035     int mMsgSize;     // current msg size (incremented by pack() functions)
00036     int mPosition;    // current position in buffer for unpacking
00037 
00038   protected:
00039     void extendBufferFor(int dataSize);
00040 
00041   public:
00045     cCommBufferBase();
00046 
00050     virtual ~cCommBufferBase();
00051 
00057     char *getBuffer();
00058 
00062     int getBufferLength();
00063 
00068     void allocateAtLeast(int size);
00069 
00074     void setMessageSize(int size);
00075 
00079     int getMessageSize();
00080 
00084     void reset();
00085 
00091     virtual bool isBufferEmpty();
00092 
00098     virtual void assertBufferEmpty();
00100 };
00101 
00102 #endif

Generated on Sat Oct 21 17:48:01 2006 for OMNeT++ Parallel Simulation Support by  doxygen 1.4.6