ccommbufferbase.h

00001 //=========================================================================
00002 //  CCOMMBUFFERBASE.H - part of
00003 //
00004 //                  OMNeT++/OMNEST
00005 //           Discrete System Simulation in C++
00006 //
00007 //  Author: Andras Varga, 2003
00008 //          Dept. of Electrical and Computer Systems Engineering,
00009 //          Monash University, Melbourne, Australia
00010 //
00011 //=========================================================================
00012 
00013 /*--------------------------------------------------------------*
00014   Copyright (C) 2003-2008 Andras Varga
00015   Copyright (C) 2006-2008 OpenSim Ltd.
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 
00026 NAMESPACE_BEGIN
00027 
00032 class SIM_API cCommBufferBase : public cCommBuffer
00033 {
00034   protected:
00035     char *mBuffer;    // the buffer
00036     int mBufferSize;  // size of buffer allocated
00037     int mMsgSize;     // current msg size (incremented by pack() functions)
00038     int mPosition;    // current position in buffer for unpacking
00039 
00040   protected:
00041     void extendBufferFor(int dataSize);
00042 
00043   public:
00047     cCommBufferBase();
00048 
00052     virtual ~cCommBufferBase();
00053 
00059     char *getBuffer() const;
00060 
00064     int getBufferLength() const;
00065 
00070     void allocateAtLeast(int size);
00071 
00076     void setMessageSize(int size);
00077 
00081     int getMessageSize() const;
00082 
00086     void reset();
00087 
00093     virtual bool isBufferEmpty() const;
00094 
00100     virtual void assertBufferEmpty();
00102 };
00103 
00104 NAMESPACE_END
00105 
00106 
00107 #endif
Generated on Tue Dec 2 11:16:32 2014 for OMNeT++ Parallel Simulation Support by  doxygen 1.6.3