Project

General

Profile

Statistics
| Branch: | Revision:

root / src / sim / parsim / cfilecommbuffer.h @ 81ad8b66

History | View | Annotate | Download (4.48 KB)

1 01873262 Georg Kunz
//=========================================================================
2
//  CFILECOMMBUFFER.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-2008 Andras Varga
15
  Copyright (C) 2006-2008 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 __CFILECOMMBUFFER_H__
22
#define __CFILECOMMBUFFER_H__
23
24
#include "ccommbufferbase.h"
25
26
NAMESPACE_BEGIN
27
28
29
/**
30
 * Communication buffer that packs data in a text representation
31
 * into a memory buffer.
32
 *
33
 * @ingroup Parsim
34
 */
35
class SIM_API cFileCommBuffer : public cCommBufferBase
36
{
37
  public:
38
    /**
39
     * Constructor.
40
     */
41
    cFileCommBuffer();
42
43
    /**
44
     * Destructor.
45
     */
46
    virtual ~cFileCommBuffer();
47
48
    /**
49
     * Redefined because we need to NULL-terminate the buffer.
50
     */
51
    void setMessageSize(int size);
52
53
    /** @name Pack basic types */
54
    //@{
55
    virtual void pack(char d);
56
    virtual void pack(unsigned char d);
57
    virtual void pack(bool d);
58
    virtual void pack(short d);
59
    virtual void pack(unsigned short d);
60
    virtual void pack(int d);
61
    virtual void pack(unsigned int d);
62
    virtual void pack(long d);
63
    virtual void pack(unsigned long d);
64
    virtual void pack(opp_long_long d);
65
    virtual void pack(opp_unsigned_long_long d);
66
    virtual void pack(float d);
67
    virtual void pack(double d);
68
    virtual void pack(long double d);
69
    virtual void pack(const char *d);
70
    virtual void pack(const opp_string& d);
71
    virtual void pack(SimTime d);
72
    //@}
73
74
    /** @name Pack arrays of basic types */
75
    //@{
76
    virtual void pack(const char *d, int size);
77
    virtual void pack(const unsigned char *d, int size);
78
    virtual void pack(const bool *d, int size);
79
    virtual void pack(const short *d, int size);
80
    virtual void pack(const unsigned short *d, int size);
81
    virtual void pack(const int *d, int size);
82
    virtual void pack(const unsigned int *d, int size);
83
    virtual void pack(const long *d, int size);
84
    virtual void pack(const unsigned long *d, int size);
85
    virtual void pack(const opp_long_long *d, int size);
86
    virtual void pack(const opp_unsigned_long_long *d, int size);
87
    virtual void pack(const float *d, int size);
88
    virtual void pack(const double *d, int size);
89
    virtual void pack(const long double *d, int size);
90
    virtual void pack(const char **d, int size);
91
    virtual void pack(const opp_string *d, int size);
92
    virtual void pack(const SimTime *d, int size);
93
    //@}
94
95
    /** @name Unpack basic types */
96
    //@{
97
    virtual void unpack(char& d);
98
    virtual void unpack(unsigned char& d);
99
    virtual void unpack(bool& d);
100
    virtual void unpack(short& d);
101
    virtual void unpack(unsigned short& d);
102
    virtual void unpack(int& d);
103
    virtual void unpack(unsigned int& d);
104
    virtual void unpack(long& d);
105
    virtual void unpack(unsigned long& d);
106
    virtual void unpack(opp_long_long& d);
107
    virtual void unpack(opp_unsigned_long_long& d);
108
    virtual void unpack(float& d);
109
    virtual void unpack(double& d);
110
    virtual void unpack(long double& d);
111
    virtual void unpack(const char *&d);
112
    virtual void unpack(opp_string& d);
113
    virtual void unpack(SimTime& d);
114
    //@}
115
116
    /** @name Unpack arrays of basic types */
117
    //@{
118
    virtual void unpack(char *d, int size);
119
    virtual void unpack(unsigned char *d, int size);
120
    virtual void unpack(bool *d, int size);
121
    virtual void unpack(short *d, int size);
122
    virtual void unpack(unsigned short *d, int size);
123
    virtual void unpack(int *d, int size);
124
    virtual void unpack(unsigned int *d, int size);
125
    virtual void unpack(long *d, int size);
126
    virtual void unpack(unsigned long *d, int size);
127
    virtual void unpack(opp_long_long *d, int size);
128
    virtual void unpack(opp_unsigned_long_long *d, int size);
129
    virtual void unpack(float *d, int size);
130
    virtual void unpack(double *d, int size);
131
    virtual void unpack(long double *d, int size);
132
    virtual void unpack(const char **d, int size);
133
    virtual void unpack(opp_string *d, int size);
134
    virtual void unpack(SimTime *d, int size);
135
    //@}
136
};
137
138
NAMESPACE_END
139
140
141
#endif