MAK RTIspy API Documentation for HLA Evolved
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
libsrc
assistant
assistantTemplateMsg.h
Go to the documentation of this file.
1
/*********************************************************************
2
** Copyright (c) 2012 MaK Technologies, Inc.
3
** All rights reserved.
4
*********************************************************************/
5
8
9
#ifndef DtAssistantTemplateMsg_H_
10
#define DtAssistantTemplateMsg_H_
11
12
13
#include "
assistantMsg.h
"
14
#include <
rtiutil/rtiTemplateMsgParams.h
>
15
#include <vector>
16
17
class
DtRtiBaseMsgParam
;
18
class
DtNetAssistantMsgHeaderParam
;
19
46
class
DT_DLL_ASSISTANT
DtAssistantTemplateMsg
:
public
DtAssistantMsg
47
{
48
public
:
49
51
virtual
~
DtAssistantTemplateMsg
();
52
56
unsigned
addParameter(
DtRtiBaseMsgParam
* param);
57
59
virtual
void
printData
()
const
;
60
61
protected
:
62
64
DtAssistantTemplateMsg
(
DtAssistantMsgKind
msgKind);
65
67
virtual
DtAssistantMsgKind
internalMsgKind
();
68
71
virtual
int
minSize()
const
;
72
73
friend
class
DtNetAssistantMsgHeaderParam
;
74
75
protected
:
76
78
DtNetAssistantMsgHeaderParam
*
myHeaderParam
;
79
81
std::vector<DtRtiBaseMsgParam*>
myMsgParams
;
82
84
DtAssistantMsgKind
myMsgKind
;
85
87
int
myMinSize
;
88
89
};
90
91
93
class
DtNetAssistantMsgHeaderParam
:
public
DtRtiBaseMsgParam
94
{
95
public
:
96
97
static
const
char
*
headerName
()
98
{
99
static
const
char
theName[] =
"Header"
;
100
return
theName;
101
}
102
103
DtNetAssistantMsgHeaderParam
(
DtAssistantTemplateMsg
* msg)
104
:
DtRtiBaseMsgParam
(
headerName
())
105
,
myMsg
(msg) {}
106
~DtNetAssistantMsgHeaderParam
() {}
107
109
void
*
endPtr
() {
return
myMsg
->
netHeader
() + 1; }
110
const
void
*
endPtr
()
const
{
return
myMsg
->
netHeader
() + 1; };
111
113
unsigned
minSize
() {
return
sizeof
(
DtNetAssistantMsgHeader
); }
114
116
unsigned
elementSize
() {
return
sizeof
(MAKRti::DtNetU128); }
117
119
void
print
()
const
{}
120
124
void
setOctetBoundary
(
unsigned
prevBoundary)
125
{
126
myOctetBoundary
=
minSize
() % 8;
127
}
128
129
protected
:
130
DtNetAssistantMsgHeaderParam
(
const
DtNetAssistantMsgHeaderParam
&);
131
132
DtAssistantTemplateMsg
*
myMsg
;
133
};
134
135
136
// This macro will automatically declare all of the methods necessary to
137
// create a standard Assistant message with the exception of callback
138
// addition & removal functions and parameter accessors.
139
#define DtASTNT_DECLARE_STANDARD_MSG_METHODS(ClassName) \
140
public: \
141
typedef void (*ClassName##Cb)(const ClassName& msg, void* usr); \
142
ClassName(DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); \
143
ClassName(const DtNetAssistantMsgHeader* netHeader, \
144
DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); \
145
virtual ~ClassName(); \
146
void addAllParameters(); \
147
virtual DtAssistantMsg* clone(bool copy = true) const; \
148
static DtAssistantMsg* create(const DtNetAssistantMsgHeader* initial, \
149
DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); \
150
static DtAssistantMsg* create( \
151
DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); \
152
protected: \
153
ClassName* self() const
/* Casts away const-ness */
\
154
{ return const_cast<ClassName*>( this ); }
155
156
// This macro will automatically declare the methods for adding
157
// and removing callbacks for receipt of this message from a
158
// DtRtiAssistantPeer.
159
#define DtASTNT_DECLARE_PEER_CALLBACK_METHODS(ClassName) \
160
public: \
161
static void addCallback(DtRtiAssistantPeer* peer, \
162
ClassName##Cb cb, void* usr); \
163
static void removeCallback(DtRtiAssistantPeer* peer, \
164
ClassName##Cb cb, void* usr);
165
166
// This macro will automatically declare the methods for adding
167
// and removing callbacks for receipt of this message from a
168
// DtRtiAssistantServer.
169
#define DtASTNT_DECLARE_SERVER_CALLBACK_METHODS(ClassName) \
170
public: \
171
static void addCallback(DtRtiAssistantServer* srvr, \
172
ClassName##Cb cb, void* usr); \
173
static void removeCallback(DtRtiAssistantServer* srvr, \
174
ClassName##Cb cb, void* usr);
175
176
// This macro will automatically declare the methods for adding
177
// and removing callbacks for receipt of this message from a
178
// DtRtiAssistantClient.
179
#define DtASTNT_DECLARE_CLIENT_CALLBACK_METHODS(ClassName) \
180
public: \
181
static void addCallback(DtRtiAssistantClient* client, \
182
ClassName##Cb cb, void* usr); \
183
static void removeCallback(DtRtiAssistantClient* client, \
184
ClassName##Cb cb, void* usr);
185
186
// This macro will automatically declare the methods for adding
187
// and removing callbacks for receipt of this message from a
188
// DtAssistantMsgQueue.
189
#define DtASTNT_DECLARE_QUEUE_CALLBACK_METHODS(ClassName) \
190
public: \
191
static void addCallback(DtAssistantMsgQueue* qu, \
192
ClassName##Cb cb, void* usr); \
193
static void removeCallback(DtAssistantMsgQueue* qu, \
194
ClassName##Cb cb, void* usr);
195
196
// This macro will automatically define most of the methods declared by
197
// DtASTNT_DECLARE_STANDARD_MSG_METHODS, with the exception of addAllParameters().
198
#define DtASTNT_DEFINE_STANDARD_MSG_METHODS(ClassName) \
199
ClassName::ClassName(DtBufferPtr buffer) \
200
: DtAssistantTemplateMsg(ClassName##Kind) \
201
{ \
202
addAllParameters(); \
203
initAssistantMsg(minSize(), internalMsgKind(), buffer); \
204
} \
205
ClassName::ClassName(const DtNetAssistantMsgHeader* netHdr, \
206
DtBufferPtr buffer) \
207
: DtAssistantTemplateMsg(ClassName##Kind) \
208
{ \
209
addAllParameters(); \
210
initAssistantMsg(netHdr, buffer); \
211
} \
212
ClassName::~ClassName() {} \
213
DtAssistantMsg* ClassName::clone(bool copy) const \
214
{ \
215
if (copy) \
216
{ \
217
return new ClassName(this->netHeader()); \
218
} \
219
else \
220
{ \
221
return new ClassName(); \
222
} \
223
} \
224
DtAssistantMsg* ClassName::create(DtBufferPtr buffer) \
225
{ \
226
return new ClassName(buffer); \
227
} \
228
DtAssistantMsg* ClassName::create(const DtNetAssistantMsgHeader* initial,\
229
DtBufferPtr buffer) \
230
{ \
231
return new ClassName(initial, buffer); \
232
}
233
234
// This macro will automatically define the methods declared by
235
// DtASTNT_DECLARE_PEER_CALLBACK_METHODS.
236
#define DtASTNT_DEFINE_PEER_CALLBACK_METHODS(ClassName) \
237
void ClassName::addCallback(DtRtiAssistantPeer* conn, \
238
ClassName##Cb cb, void* usr) \
239
{ \
240
conn->addMsgCallback(ClassName##Kind, \
241
(DtAssistantMsgCbMgr::DtCallbackFcn) cb, usr); \
242
} \
243
void ClassName::removeCallback(DtRtiAssistantPeer* conn, \
244
ClassName##Cb cb, void* usr) \
245
{ \
246
conn->removeMsgCallback(ClassName##Kind, \
247
(DtAssistantMsgCbMgr::DtCallbackFcn) cb, usr); \
248
}
249
250
// This macro will automatically define the methods declared by
251
// DtASTNT_DECLARE_SERVER_CALLBACK_METHODS.
252
#define DtASTNT_DEFINE_SERVER_CALLBACK_METHODS(ClassName) \
253
void ClassName::addCallback(DtRtiAssistantServer* conn, \
254
ClassName##Cb cb, void* usr) \
255
{ \
256
conn->addMsgCallback(ClassName##Kind, \
257
(DtAssistantMsgCbMgr::DtCallbackFcn) cb, usr); \
258
} \
259
void ClassName::removeCallback(DtRtiAssistantServer* conn, \
260
ClassName##Cb cb, void* usr) \
261
{ \
262
conn->removeMsgCallback(ClassName##Kind, \
263
(DtAssistantMsgCbMgr::DtCallbackFcn) cb, usr); \
264
}
265
266
// This macro will automatically define the methods declared by
267
// DtASTNT_DECLARE_CLIENT_CALLBACK_METHODS.
268
#define DtASTNT_DEFINE_CLIENT_CALLBACK_METHODS(ClassName) \
269
void ClassName::addCallback(DtRtiAssistantClient* conn, \
270
ClassName##Cb cb, void* usr) \
271
{ \
272
conn->addMsgCallback(ClassName##Kind, \
273
(DtAssistantMsgCbMgr::DtCallbackFcn) cb, usr); \
274
} \
275
void ClassName::removeCallback(DtRtiAssistantClient* conn, \
276
ClassName##Cb cb, void* usr) \
277
{ \
278
conn->removeMsgCallback(ClassName##Kind, \
279
(DtAssistantMsgCbMgr::DtCallbackFcn) cb, usr); \
280
}
281
282
// This macro will automatically define the methods declared by
283
// DtASTNT_DECLARE_QUEUE_CALLBACK_METHODS.
284
#define DtASTNT_DEFINE_QUEUE_CALLBACK_METHODS(ClassName) \
285
void ClassName::addCallback(DtAssistantMsgQueue* conn, \
286
ClassName##Cb cb, void* usr) \
287
{ \
288
conn->addMsgCallback(ClassName##Kind, \
289
(DtAssistantMsgCbMgr::DtCallbackFcn) cb, usr); \
290
} \
291
void ClassName::removeCallback(DtAssistantMsgQueue* conn, \
292
ClassName##Cb cb, void* usr) \
293
{ \
294
conn->removeMsgCallback(ClassName##Kind, \
295
(DtAssistantMsgCbMgr::DtCallbackFcn) cb, usr); \
296
}
297
298
299
300
301
#endif
302
Document ID: Generated on Wed Mar 11 20:26:49 EDT 2015 from SVN revision 150939
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (
www.mak.com
)