Project

General

Profile

Statistics
| Branch: | Revision:

root / src / sim / parsim / cmpicommbuffer.h @ 3e29b8a0

History | View | Annotate | Download (4.38 KB)

1
//=========================================================================
2
//  CMPICOMMBUFFER.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
#ifdef WITH_MPI
22

    
23
#ifndef __CMPICOMMBUFFER_H__
24
#define __CMPICOMMBUFFER_H__
25

    
26
#include "ccommbufferbase.h"
27

    
28
NAMESPACE_BEGIN
29

    
30

    
31
/**
32
 * Communication buffer that wraps MPI_Pack() and MPI_Unpack() functions.
33
 *
34
 * @ingroup Parsim
35
 */
36
class SIM_API cMPICommBuffer : public cCommBufferBase
37
{
38
  public:
39
    /**
40
     * Constructor.
41
     */
42
    cMPICommBuffer();
43

    
44
    /**
45
     * Destructor.
46
     */
47
    virtual ~cMPICommBuffer();
48

    
49
    /** @name Pack basic types */
50
    //@{
51
    virtual void pack(char d);
52
    virtual void pack(unsigned char d);
53
    virtual void pack(bool d);
54
    virtual void pack(short d);
55
    virtual void pack(unsigned short d);
56
    virtual void pack(int d);
57
    virtual void pack(unsigned int d);
58
    virtual void pack(long d);
59
    virtual void pack(unsigned long d);
60
    virtual void pack(opp_long_long d);
61
    virtual void pack(opp_unsigned_long_long d);
62
    virtual void pack(float d);
63
    virtual void pack(double d);
64
    virtual void pack(long double d);
65
    virtual void pack(const char *d);
66
    virtual void pack(const opp_string& d);
67
    virtual void pack(SimTime d);
68
    //@}
69

    
70
    /** @name Pack arrays of basic types */
71
    //@{
72
    virtual void pack(const char *d, int size);
73
    virtual void pack(const unsigned char *d, int size);
74
    virtual void pack(const bool *d, int size);
75
    virtual void pack(const short *d, int size);
76
    virtual void pack(const unsigned short *d, int size);
77
    virtual void pack(const int *d, int size);
78
    virtual void pack(const unsigned int *d, int size);
79
    virtual void pack(const long *d, int size);
80
    virtual void pack(const unsigned long *d, int size);
81
    virtual void pack(const opp_long_long *d, int size);
82
    virtual void pack(const opp_unsigned_long_long *d, int size);
83
    virtual void pack(const float *d, int size);
84
    virtual void pack(const double *d, int size);
85
    virtual void pack(const long double *d, int size);
86
    virtual void pack(const char **d, int size);
87
    virtual void pack(const opp_string *d, int size);
88
    virtual void pack(const SimTime *d, int size);
89
    //@}
90

    
91
    /** @name Unpack basic types */
92
    //@{
93
    virtual void unpack(char& d);
94
    virtual void unpack(unsigned char& d);
95
    virtual void unpack(bool& d);
96
    virtual void unpack(short& d);
97
    virtual void unpack(unsigned short& d);
98
    virtual void unpack(int& d);
99
    virtual void unpack(unsigned int& d);
100
    virtual void unpack(long& d);
101
    virtual void unpack(unsigned long& d);
102
    virtual void unpack(opp_long_long& d);
103
    virtual void unpack(opp_unsigned_long_long& d);
104
    virtual void unpack(float& d);
105
    virtual void unpack(double& d);
106
    virtual void unpack(long double& d);
107
    virtual void unpack(const char *&d);
108
    virtual void unpack(opp_string& d);
109
    virtual void unpack(SimTime& d);
110
    //@}
111

    
112
    /** @name Unpack arrays of basic types */
113
    //@{
114
    virtual void unpack(char *d, int size);
115
    virtual void unpack(unsigned char *d, int size);
116
    virtual void unpack(bool *d, int size);
117
    virtual void unpack(short *d, int size);
118
    virtual void unpack(unsigned short *d, int size);
119
    virtual void unpack(int *d, int size);
120
    virtual void unpack(unsigned int *d, int size);
121
    virtual void unpack(long *d, int size);
122
    virtual void unpack(unsigned long *d, int size);
123
    virtual void unpack(opp_long_long *d, int size);
124
    virtual void unpack(opp_unsigned_long_long *d, int size);
125
    virtual void unpack(float *d, int size);
126
    virtual void unpack(double *d, int size);
127
    virtual void unpack(long double *d, int size);
128
    virtual void unpack(const char **d, int size);
129
    virtual void unpack(opp_string *d, int size);
130
    virtual void unpack(SimTime *d, int size);
131
    //@}
132
};
133

    
134
NAMESPACE_END
135

    
136

    
137
#endif
138

    
139
#endif // WITH_MPI