vrpn 07.35
Virtual Reality Peripheral Network
 
Loading...
Searching...
No Matches
vrpn_Log Class Reference

Logs a VRPN stream. More...

#include <vrpn_Log.h>

Collaboration diagram for vrpn_Log:

Public Member Functions

 vrpn_Log (vrpn_TranslationTable *senders, vrpn_TranslationTable *types)
 
 ~vrpn_Log (void)
 
char * getName ()
 Allocates a new string and copies the log file name to it. IMPORTANT: code calling this function is responsible for freeing the memory.
 
int open (void)
 Opens the log file.
 
int close (void)
 Closes and saves the log file.
 
int saveLogSoFar (void)
 Saves any messages logged so far.
 
int logIncomingMessage (size_t payloadLen, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer)
 Should be called with the timeval adjusted by the clock offset on the receiving Endpoint.
 
int logOutgoingMessage (vrpn_int32 payloadLen, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer)
 
int logMessage (vrpn_int32 payloadLen, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_bool isRemote=VRPN_FALSE)
 We'd like to make this protected, but there's one place it needs to be exposed, at least until we get cleverer.
 
int setCookie (const char *cookieBuffer)
 The magic cookie is set to the default value of the version of VRPN compiled, but a more correct value to write in the logfile (if we're logging incoming messages) is that of the version of VRPN we're communicating with.
 
int setCompoundName (const char *name, int index)
 Takes a name of the form foo.bar and an index <n> and sets the name of the log file to be foo-<n>.bar; if there is no period in the name, merely appends -<n>.
 
int setName (const char *name)
 
int setName (const char *name, size_t len)
 
long & logMode (void)
 Returns a reference so we can |= it.
 
int addFilter (vrpn_LOGFILTER filter, void *userdata)
 
timeval lastLogTime ()
 Returns the time of the last message that was logged.
 

Protected Member Functions

int checkFilters (vrpn_int32 payloadLen, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer)
 

Protected Attributes

char * d_logFileName
 
long d_logmode
 
vrpn_LOGLISTd_logTail
 
vrpn_LOGLISTd_firstEntry
 
FILE * d_file
 
char * d_magicCookie
 
vrpn_bool d_wroteMagicCookie
 
vrpnLogFilterEntryd_filters
 
vrpn_TranslationTable * d_senders
 
vrpn_TranslationTable * d_types
 
timeval d_lastLogTime
 

Detailed Description

Logs a VRPN stream.

Used by vrpn_Endpoint.

Definition at line 10 of file vrpn_Log.h.

Constructor & Destructor Documentation

◆ vrpn_Log()

vrpn_Log::vrpn_Log ( vrpn_TranslationTable * senders,
vrpn_TranslationTable * types )

◆ ~vrpn_Log()

vrpn_Log::~vrpn_Log ( void )

Definition at line 491 of file vrpn_Connection.C.

References close(), d_file, d_filters, and d_magicCookie.

Here is the call graph for this function:

Member Function Documentation

◆ addFilter()

int vrpn_Log::addFilter ( vrpn_LOGFILTER filter,
void * userdata )

◆ checkFilters()

int vrpn_Log::checkFilters ( vrpn_int32 payloadLen,
struct timeval time,
vrpn_int32 type,
vrpn_int32 sender,
const char * buffer )
protected

◆ close()

int vrpn_Log::close ( void )

Closes and saves the log file.

Definition at line 597 of file vrpn_Connection.C.

References d_file, d_logFileName, and saveLogSoFar().

Referenced by ~vrpn_Log().

Here is the call graph for this function:

◆ getName()

char * vrpn_Log::getName ( )

Allocates a new string and copies the log file name to it. IMPORTANT: code calling this function is responsible for freeing the memory.

Definition at line 521 of file vrpn_Connection.C.

References d_logFileName.

Referenced by vrpn_Connection::get_log_names().

◆ lastLogTime()

timeval vrpn_Log::lastLogTime ( )

Returns the time of the last message that was logged.

Definition at line 939 of file vrpn_Connection.C.

References d_lastLogTime.

◆ logIncomingMessage()

int vrpn_Log::logIncomingMessage ( size_t payloadLen,
struct timeval time,
vrpn_int32 type,
vrpn_int32 sender,
const char * buffer )

Should be called with the timeval adjusted by the clock offset on the receiving Endpoint.

Definition at line 741 of file vrpn_Connection.C.

References logMessage(), logMode(), and vrpn_LOG_INCOMING.

Referenced by vrpn_File_Connection::playone_to_filetime().

Here is the call graph for this function:

◆ logMessage()

int vrpn_Log::logMessage ( vrpn_int32 payloadLen,
struct timeval time,
vrpn_int32 type,
vrpn_int32 sender,
const char * buffer,
vrpn_bool isRemote = VRPN_FALSE )

We'd like to make this protected, but there's one place it needs to be exposed, at least until we get cleverer.

Definition at line 772 of file vrpn_Connection.C.

References vrpn_HANDLERPARAM::buffer, checkFilters(), d_firstEntry, d_lastLogTime, d_logTail, d_senders, d_types, vrpn_LOGLIST::data, vrpn_HANDLERPARAM::msg_time, vrpn_LOGLIST::next, vrpn_HANDLERPARAM::payload_len, vrpn_LOGLIST::prev, vrpn_HANDLERPARAM::sender, and vrpn_HANDLERPARAM::type.

Referenced by logIncomingMessage(), and logOutgoingMessage().

Here is the call graph for this function:

◆ logMode()

◆ logOutgoingMessage()

int vrpn_Log::logOutgoingMessage ( vrpn_int32 payloadLen,
struct timeval time,
vrpn_int32 type,
vrpn_int32 sender,
const char * buffer )

Definition at line 760 of file vrpn_Connection.C.

References logMessage(), logMode(), and vrpn_LOG_OUTGOING.

Here is the call graph for this function:

◆ open()

◆ saveLogSoFar()

int vrpn_Log::saveLogSoFar ( void )

◆ setCompoundName()

int vrpn_Log::setCompoundName ( const char * name,
int index )

Takes a name of the form foo.bar and an index <n> and sets the name of the log file to be foo-<n>.bar; if there is no period in the name, merely appends -<n>.

Definition at line 845 of file vrpn_Connection.C.

References setName().

Referenced by vrpn_Connection_IP::server_check_for_incoming_connections().

Here is the call graph for this function:

◆ setCookie()

int vrpn_Log::setCookie ( const char * cookieBuffer)

The magic cookie is set to the default value of the version of VRPN compiled, but a more correct value to write in the logfile (if we're logging incoming messages) is that of the version of VRPN we're communicating with.

Definition at line 898 of file vrpn_Connection.C.

References d_magicCookie, and vrpn_cookie_size().

Here is the call graph for this function:

◆ setName() [1/2]

int vrpn_Log::setName ( const char * name)

Definition at line 875 of file vrpn_Connection.C.

References setName().

Referenced by setCompoundName(), setName(), vrpn_Connection::vrpn_Connection(), and vrpn_Connection::vrpn_Connection().

Here is the call graph for this function:

◆ setName() [2/2]

int vrpn_Log::setName ( const char * name,
size_t len )

Definition at line 877 of file vrpn_Connection.C.

References d_logFileName.

Member Data Documentation

◆ d_file

FILE* vrpn_Log::d_file
protected

Definition at line 80 of file vrpn_Log.h.

Referenced by close(), open(), saveLogSoFar(), vrpn_Log(), and ~vrpn_Log().

◆ d_filters

vrpnLogFilterEntry* vrpn_Log::d_filters
protected

Definition at line 86 of file vrpn_Log.h.

Referenced by addFilter(), checkFilters(), vrpn_Log(), and ~vrpn_Log().

◆ d_firstEntry

vrpn_LOGLIST* vrpn_Log::d_firstEntry
protected

Definition at line 78 of file vrpn_Log.h.

Referenced by logMessage(), saveLogSoFar(), and vrpn_Log().

◆ d_lastLogTime

timeval vrpn_Log::d_lastLogTime
protected

Definition at line 91 of file vrpn_Log.h.

Referenced by lastLogTime(), logMessage(), and vrpn_Log().

◆ d_logFileName

char* vrpn_Log::d_logFileName
protected

Definition at line 74 of file vrpn_Log.h.

Referenced by close(), getName(), open(), setName(), and vrpn_Log().

◆ d_logmode

long vrpn_Log::d_logmode
protected

Definition at line 75 of file vrpn_Log.h.

Referenced by logMode(), and vrpn_Log().

◆ d_logTail

vrpn_LOGLIST* vrpn_Log::d_logTail
protected

Definition at line 77 of file vrpn_Log.h.

Referenced by logMessage(), saveLogSoFar(), and vrpn_Log().

◆ d_magicCookie

char* vrpn_Log::d_magicCookie
protected

Definition at line 82 of file vrpn_Log.h.

Referenced by saveLogSoFar(), setCookie(), vrpn_Log(), and ~vrpn_Log().

◆ d_senders

vrpn_TranslationTable* vrpn_Log::d_senders
protected

Definition at line 88 of file vrpn_Log.h.

Referenced by logMessage(), and vrpn_Log().

◆ d_types

vrpn_TranslationTable* vrpn_Log::d_types
protected

Definition at line 89 of file vrpn_Log.h.

Referenced by logMessage(), and vrpn_Log().

◆ d_wroteMagicCookie

vrpn_bool vrpn_Log::d_wroteMagicCookie
protected

Definition at line 84 of file vrpn_Log.h.

Referenced by saveLogSoFar(), and vrpn_Log().


The documentation for this class was generated from the following files: