RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Log.h
1#ifndef VRPN_LOG_H
2#define VRPN_LOG_H
3
4/**
5 * @class vrpn_Log
6 * Logs a VRPN stream.
7 * Used by vrpn_Endpoint.
8 */
9
10class VRPN_API vrpn_Log {
11
12public:
13 vrpn_Log(vrpn_TranslationTable* senders, vrpn_TranslationTable* types);
14 ~vrpn_Log(void);
15
16 // ACCESSORS
17 char* getName();
18 ///< Allocates a new string and copies the log file name to it.
19 ///< IMPORTANT: code calling this function is responsible for freeing the
20 /// memory.
21
22 // MANIPULATORS
23 int open(void);
24 ///< Opens the log file.
25
26 int close(void);
27 ///< Closes and saves the log file.
28
29 int saveLogSoFar(void);
30 ///< Saves any messages logged so far.
31
32 int logIncomingMessage(size_t payloadLen, struct timeval time,
33 vrpn_int32 type, vrpn_int32 sender,
34 const char* buffer);
35 ///< Should be called with the timeval adjusted by the clock offset
36 ///< on the receiving Endpoint.
37
38 int logOutgoingMessage(vrpn_int32 payloadLen, struct timeval time,
39 vrpn_int32 type, vrpn_int32 sender,
40 const char* buffer);
41
42 int logMessage(vrpn_int32 payloadLen, struct timeval time, vrpn_int32 type,
43 vrpn_int32 sender, const char* buffer,
44 vrpn_bool isRemote = VRPN_FALSE);
45 ///< We'd like to make this protected, but there's one place it needs
46 ///< to be exposed, at least until we get cleverer.
47
48 int setCookie(const char* cookieBuffer);
49 ///< The magic cookie is set to the default value of the version of
50 ///< VRPN compiled, but a more correct value to write in the logfile
51 ///< (if we're logging incoming messages) is that of the version of
52 ///< VRPN we're communicating with.
53
54 int setCompoundName(const char* name, int index);
55 ///< Takes a name of the form foo.bar and an index <n> and sets the
56 ///< name of the log file to be foo-<n>.bar; if there is no period
57 ///< in the name, merely appends -<n>.
58
59 int setName(const char* name);
60 int setName(const char* name, size_t len);
61
62 long& logMode(void);
63 ///< Returns a reference so we can |= it.
64
65 int addFilter(vrpn_LOGFILTER filter, void* userdata);
66
67 timeval lastLogTime();
68 ///< Returns the time of the last message that was logged
69
70protected:
71 int checkFilters(vrpn_int32 payloadLen, struct timeval time,
72 vrpn_int32 type, vrpn_int32 sender, const char* buffer);
73
74 char* d_logFileName;
75 long d_logmode;
76
77 vrpn_LOGLIST* d_logTail;
78 vrpn_LOGLIST* d_firstEntry;
79
80 FILE* d_file;
81
82 char* d_magicCookie;
83
84 vrpn_bool d_wroteMagicCookie;
85
86 vrpnLogFilterEntry* d_filters;
87
88 vrpn_TranslationTable* d_senders;
89 vrpn_TranslationTable* d_types;
90
91 timeval d_lastLogTime;
92};
93
94#endif // VRPN_LOG_H
定义 vrpn_Log.h:10
int logIncomingMessage(size_t payloadLen, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer)
int saveLogSoFar(void)
Saves any messages logged so far.
int setCookie(const char *cookieBuffer)
long & logMode(void)
Returns a reference so we can |= it.
char * getName()
int open(void)
Opens the log file.
int close(void)
Closes and saves the log file.
timeval lastLogTime()
Returns the time of the last message that was logged
int setCompoundName(const char *name, int index)
int logMessage(vrpn_int32 payloadLen, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_bool isRemote=VRPN_FALSE)
定义 vrpn_Connection.h:235
Placed here so vrpn_FileConnection can use it too.
定义 vrpn_Connection.h:160