OMNeT++ Simulation Library  6.0.3
packing.h
1 //==========================================================================
2 // PACKING.H - part of
3 // OMNeT++/OMNEST
4 // Discrete System Simulation in C++
5 //
6 //==========================================================================
7 
8 /*--------------------------------------------------------------*
9  Copyright (C) 1992-2017 Andras Varga
10  Copyright (C) 2006-2017 OpenSim Ltd.
11 
12  This file is distributed WITHOUT ANY WARRANTY. See the file
13  `license' for details on this and other legal matters.
14 *--------------------------------------------------------------*/
15 
16 #ifndef __OMNETPP_PACKING_H
17 #define __OMNETPP_PACKING_H
18 
19 #include "ccommbuffer.h"
20 
21 namespace omnetpp {
22 
23 //
24 // pack/unpack functions for primitive types
25 //
26 #define DOPACKING(T,R) \
27  inline void doParsimPacking(omnetpp::cCommBuffer *b, const T R a) {b->pack(a);} \
28  inline void doParsimPacking(omnetpp::cCommBuffer *b, const T *a, int n) {b->pack(a,n);} \
29  inline void doParsimUnpacking(omnetpp::cCommBuffer *b, T& a) {b->unpack(a);} \
30  inline void doParsimUnpacking(omnetpp::cCommBuffer *b, T *a, int n) {b->unpack(a,n);}
31 #define _
32 DOPACKING(char,_)
33 DOPACKING(unsigned char,_)
34 DOPACKING(bool,_)
35 DOPACKING(short,_)
36 DOPACKING(unsigned short,_)
37 DOPACKING(int,_)
38 DOPACKING(unsigned int,_)
39 DOPACKING(long,_)
40 DOPACKING(unsigned long,_)
41 DOPACKING(float,_)
42 DOPACKING(double,_)
43 DOPACKING(long double,_)
44 DOPACKING(char *,_)
45 DOPACKING(SimTime,&)
46 DOPACKING(opp_string,&)
47 #undef _
48 #undef DOPACKING
49 
50 } // namespace omnetpp
51 
52 #endif
53