OMNeT++ Parallel Simulation Support
6.1
Discrete Event Simulation Library
ccommbufferbase.h
1
//=========================================================================
2
// CCOMMBUFFERBASE.H - part of
3
//
4
// OMNeT++/OMNEST
5
// Discrete System Simulation in C++
6
//
7
//=========================================================================
8
9
/*--------------------------------------------------------------*
10
Copyright (C) 1992-2017 Andras Varga
11
Copyright (C) 2006-2017 OpenSim Ltd.
12
13
This file is distributed WITHOUT ANY WARRANTY. See the file
14
`license' for details on this and other legal matters.
15
*--------------------------------------------------------------*/
16
17
#ifndef __OMNETPP_CCOMMBUFFERBASE_H
18
#define __OMNETPP_CCOMMBUFFERBASE_H
19
20
#include "omnetpp/ccommbuffer.h"
21
22
namespace
omnetpp {
23
28
class
SIM_API
cCommBufferBase
:
public
cCommBuffer
29
{
30
protected
:
31
char
*mBuffer =
nullptr
;
// the buffer
32
int
mBufferSize = 0;
// size of buffer allocated
33
int
mMsgSize = 0;
// current msg size (incremented by pack() functions)
34
int
mPosition = 0;
// current position in buffer for unpacking
35
36
protected
:
37
void
extendBufferFor(
int
dataSize);
38
39
public
:
43
cCommBufferBase
() {}
44
48
virtual
~
cCommBufferBase
();
49
55
char
*getBuffer()
const
;
56
60
int
getBufferLength()
const
;
61
66
void
allocateAtLeast(
int
size);
67
72
void
setMessageSize(
int
size);
73
77
int
getMessageSize()
const
;
78
82
void
reset();
83
89
virtual
bool
isBufferEmpty()
const override
;
90
96
virtual
void
assertBufferEmpty()
override
;
97
101
virtual
void
swap(
cCommBufferBase
*other);
102
104
};
105
106
}
// namespace omnetpp
107
108
109
#endif
omnetpp::cCommBufferBase
Adds buffer (re)allocation functions to cCommBuffer. This functionality is not always needed,...
Definition:
ccommbufferbase.h:28
omnetpp::cCommBufferBase::cCommBufferBase
cCommBufferBase()
Definition:
ccommbufferbase.h:43
src
sim
parsim
ccommbufferbase.h
Generated by
1.8.17