OMNeT++ Parallel Simulation Support  5.4.1
ccommbufferbase.h
1 //=========================================================================
2 // CCOMMBUFFERBASE.H - part of
3 //
4 // OMNeT++/OMNEST
5 // Discrete System Simulation in C++
6 //
7 // Author: Andras Varga, 2003
8 // Dept. of Electrical and Computer Systems Engineering,
9 // Monash University, Melbourne, Australia
10 //
11 //=========================================================================
12 
13 /*--------------------------------------------------------------*
14  Copyright (C) 2003-2017 Andras Varga
15  Copyright (C) 2006-2017 OpenSim Ltd.
16 
17  This file is distributed WITHOUT ANY WARRANTY. See the file
18  `license' for details on this and other legal matters.
19 *--------------------------------------------------------------*/
20 
21 #ifndef __OMNETPP_CCOMMBUFFERBASE_H
22 #define __OMNETPP_CCOMMBUFFERBASE_H
23 
24 #include "omnetpp/ccommbuffer.h"
25 
26 namespace omnetpp {
27 
32 class SIM_API cCommBufferBase : public cCommBuffer
33 {
34  protected:
35  char *mBuffer; // the buffer
36  int mBufferSize; // size of buffer allocated
37  int mMsgSize; // current msg size (incremented by pack() functions)
38  int mPosition; // current position in buffer for unpacking
39 
40  protected:
41  void extendBufferFor(int dataSize);
42 
43  public:
48 
52  virtual ~cCommBufferBase();
53 
59  char *getBuffer() const;
60 
64  int getBufferLength() const;
65 
70  void allocateAtLeast(int size);
71 
76  void setMessageSize(int size);
77 
81  int getMessageSize() const;
82 
86  void reset();
87 
93  virtual bool isBufferEmpty() const override;
94 
100  virtual void assertBufferEmpty() override;
102 };
103 
104 } // namespace omnetpp
105 
106 
107 #endif
Adds buffer (re)allocation functions to cCommBuffer. This functionality is not always needed...
Definition: ccommbufferbase.h:32
Definition: cadvlinkdelaylookahead.h:26