RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_RedundantTransmission.h
1#ifndef VRPN_REDUNDANT_TRANSMISSION_H
2#define VRPN_REDUNDANT_TRANSMISSION_H
3
9
10#include <stddef.h> // for NULL
11
12#include "vrpn_BaseClass.h" // for vrpn_BaseClass
13#include "vrpn_Configure.h" // for VRPN_API, VRPN_CALLBACK
14#include "vrpn_Connection.h" // for vrpn_Connection (ptr only), etc
15#include "vrpn_Shared.h" // for timeval
16#include "vrpn_Types.h" // for vrpn_uint32, vrpn_bool, etc
17
18struct timeval;
19
21
22public:
24 virtual ~vrpn_RedundantTransmission(void);
25
26 // ACCESSORS
27
28 vrpn_uint32 defaultRetransmissions(void) const;
29 timeval defaultInterval(void) const;
30 vrpn_bool isEnabled(void) const;
31
32 // MANIPULATORS
33
34 virtual void mainloop(void);
37
38 void enable(vrpn_bool);
39
40 virtual void setDefaults(vrpn_uint32 numRetransmissions,
41 timeval transmissionInterval);
43
44 virtual int pack_message(vrpn_uint32 len, timeval time, vrpn_uint32 type,
45 vrpn_uint32 sender, const char *buffer,
46 vrpn_uint32 class_of_service,
47 vrpn_int32 numRetransmissions = -1,
48 timeval *transmissionInterval = NULL);
54
55protected:
56 vrpn_Connection *d_connection;
57
60 vrpn_uint32 remainingTransmissions;
61 timeval transmissionInterval;
62 timeval nextValidTime;
63 queuedMessage *next;
64 };
65
66 queuedMessage *d_messageList;
69
70 // Default values.
71
72 vrpn_uint32 d_numTransmissions;
73 timeval d_transmissionInterval;
74
75 vrpn_bool d_isEnabled;
76};
77
79
80 char *encode_set(int *len, vrpn_uint32 num, timeval interval);
81 void decode_set(const char **buf, vrpn_uint32 *num, timeval *interval);
82
83 char *encode_enable(int *len, vrpn_bool);
84 void decode_enable(const char **buf, vrpn_bool *);
85
86 void register_types(vrpn_Connection *);
87
88 vrpn_int32 d_set_type;
89 vrpn_int32 d_enable_type;
90};
91
95
97
98public:
101
102 void mainloop(void);
103 // Do nothing; vrpn_BaseClass requires this.
104
105protected:
106 virtual int register_types(void);
107
109
110 static int VRPN_CALLBACK handle_set(void *, vrpn_HANDLERPARAM);
111 static int VRPN_CALLBACK handle_enable(void *, vrpn_HANDLERPARAM);
112
114};
115
119
120class VRPN_API vrpn_RedundantRemote : public vrpn_BaseClass {
121
122public:
125
126 void mainloop(void);
127 // Do nothing; vrpn_BaseClass requires this.
128
129 void set(int numRetransmissions, timeval transmissionInterval);
130 void enable(vrpn_bool);
131
132protected:
133 int register_types(void);
134
136};
137
149
150// A TypeDispatcher insists on too much control of its table for
151// us to use one here - we want to use the same indices as the
152// vrpn_Connection we're attached to, but if we had our own TypeDispatcher
153// we'd have an independent, inconsistent set of type & sender ids.
154
155#define VRPN_RR_LENGTH 8
156
158
159public:
161 virtual ~vrpn_RedundantReceiver(void);
162
163 virtual int register_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler,
164 void *userdata,
165 vrpn_int32 sender = vrpn_ANY_SENDER);
166 virtual int unregister_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler,
167 void *userdata,
168 vrpn_int32 sender = vrpn_ANY_SENDER);
169
170 void record(vrpn_bool);
173
174 void writeMemory(const char *filename);
179
180 void clearMemory(void);
182
183protected:
184 vrpn_Connection *d_connection;
185
186 struct VRPN_API RRRecord {
187 RRRecord(void);
188
189 timeval timestampSeen[VRPN_RR_LENGTH];
190 int numSeen[VRPN_RR_LENGTH];
191 int nextTimestampToReplace;
192
194 vrpn_bool handlerIsRegistered;
195 };
196
197 RRRecord d_records[vrpn_CONNECTION_MAX_TYPES];
198 RRRecord d_generic;
199
200 struct RRMemory {
201 timeval timestamp;
202 int numSeen;
203 RRMemory *next;
204 };
205
206 RRMemory *d_memory;
207 RRMemory *d_lastMemory;
208 vrpn_bool d_record;
209
210 static int VRPN_CALLBACK
211 handle_possiblyRedundantMessage(void *, vrpn_HANDLERPARAM);
212};
213
214#endif // VRPN_REDUNDANT_TRANSMISSION_H
定义 vrpn_BaseClass.h:310
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
定义 vrpn_RedundantTransmission.h:96
virtual int register_types(void)
定义 vrpn_RedundantTransmission.h:157
void writeMemory(const char *filename)
void record(vrpn_bool)
void clearMemory(void)
Throws away / resets statistics.
定义 vrpn_RedundantTransmission.h:120
int register_types(void)
定义 vrpn_RedundantTransmission.h:20
virtual void setDefaults(vrpn_uint32 numRetransmissions, timeval transmissionInterval)
Set default values for future calls to pack_message().
virtual int pack_message(vrpn_uint32 len, timeval time, vrpn_uint32 type, vrpn_uint32 sender, const char *buffer, vrpn_uint32 class_of_service, vrpn_int32 numRetransmissions=-1, timeval *transmissionInterval=NULL)
virtual void mainloop(void)
vrpn_uint32 d_numMessagesQueued
For debugging, mostly.
定义 vrpn_RedundantTransmission.h:67
Description of a callback entry for a user type.
定义 vrpn_Connection.h:228
This structure is what is passed to a vrpn_Connection message callback.
定义 vrpn_Connection.h:41
定义 vrpn_RedundantTransmission.h:78
定义 vrpn_RedundantTransmission.h:200
定义 vrpn_RedundantTransmission.h:186
定义 vrpn_RedundantTransmission.h:58