vrpn 07.35
Virtual Reality Peripheral Network
|
#include "vrpn_Configure.h"
#include "vrpn_Types.h"
#include "vrpn_Thread.h"
#include <string.h>
#include <stdio.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <assert.h>
Go to the source code of this file.
Classes | |
struct | vrpn_byte_order::vrpn_detail::uint_traits< 1 > |
struct | vrpn_byte_order::vrpn_detail::uint_traits< 2 > |
struct | vrpn_byte_order::vrpn_detail::uint_traits< 4 > |
struct | vrpn_detail::remove_const< T > |
struct | vrpn_detail::remove_const< const T > |
struct | vrpn_detail::vrpn_static_assert< Condition > |
struct | vrpn_detail::vrpn_static_assert< true > |
Each static assertion needs its message in this enum, or it will always fail. More... | |
Namespaces | |
namespace | vrpn_byte_order |
Internal header providing unbuffering facilities for a number of types. | |
namespace | vrpn_byte_order::vrpn_detail |
namespace | vrpn_detail |
Macros | |
#define | VRPN_PI (3.14159265358979323846) |
#define | VRPN_INCHES_TO_METERS (2.54/100.0) |
#define | VRPN_DEGREES_TO_RADIANS (VRPN_PI/180.0) |
#define | INVALID_SOCKET -1 |
#define | SOCKET int |
#define | vrpn_gettimeofday gettimeofday |
#define | VRPN_STATIC_ASSERT(CONDITION, MESSAGE) assert((CONDITION) && #MESSAGE) |
Fall back to normal asserts. | |
Functions | |
VRPN_API struct timeval | vrpn_TimevalNormalize (const struct timeval &tv) |
VRPN_API struct timeval | vrpn_TimevalSum (const struct timeval &tv1, const struct timeval &tv2) |
VRPN_API struct timeval | vrpn_TimevalDiff (const struct timeval &tv1, const struct timeval &tv2) |
VRPN_API struct timeval | vrpn_TimevalScale (const struct timeval &tv, double scale) |
VRPN_API unsigned long | vrpn_TimevalDuration (struct timeval endT, struct timeval startT) |
Return number of microseconds between startT and endT. | |
VRPN_API double | vrpn_TimevalDurationSeconds (struct timeval endT, struct timeval startT) |
Return the number of seconds between startT and endT as a floating-point value. | |
VRPN_API bool | vrpn_TimevalGreater (const struct timeval &tv1, const struct timeval &tv2) |
VRPN_API bool | vrpn_TimevalEqual (const struct timeval &tv1, const struct timeval &tv2) |
VRPN_API double | vrpn_TimevalMsecs (const struct timeval &tv1) |
VRPN_API struct timeval | vrpn_MsecsTimeval (const double dMsecs) |
VRPN_API void | vrpn_SleepMsecs (double dMilliSecs) |
VRPN_API vrpn_float64 | vrpn_htond (vrpn_float64 d) |
VRPN_API vrpn_float64 | vrpn_ntohd (vrpn_float64 d) |
VRPN_API int | vrpn_buffer (char **insertPt, vrpn_int32 *buflen, const char *string, vrpn_int32 length) |
Utility routine for placing a character string of given length into a buffer that is to be sent as a message. | |
VRPN_API int | vrpn_unbuffer (const char **buffer, char *string, vrpn_int32 length) |
Utility routine for taking a string of specified length from a buffer that was sent as a message. | |
VRPN_API int | vrpn_unbuffer (const char **buffer, timeval *t) |
Utility routine for taking a struct timeval from a buffer that was sent as a message. | |
VRPN_API int | vrpn_buffer (char **insertPt, vrpn_int32 *buflen, const timeval t) |
Utility routine for placing a timeval struct into a buffer that is to be sent as a message. | |
vrpn_uint8 | vrpn_byte_order::hton (vrpn_uint8 hostval) |
host to network byte order for 8-bit uints is a no-op | |
vrpn_uint8 | vrpn_byte_order::ntoh (vrpn_uint8 netval) |
network to host byte order for 8-bit uints is a no-op | |
vrpn_uint16 | vrpn_byte_order::hton (vrpn_uint16 hostval) |
host to network byte order for 16-bit uints | |
vrpn_uint16 | vrpn_byte_order::ntoh (vrpn_uint16 netval) |
network to host byte order for 16-bit uints | |
vrpn_uint32 | vrpn_byte_order::hton (vrpn_uint32 hostval) |
host to network byte order for 32-bit uints | |
vrpn_uint32 | vrpn_byte_order::ntoh (vrpn_uint32 netval) |
network to host byte order for 32-bit uints | |
vrpn_float64 | vrpn_byte_order::hton (vrpn_float64 hostval) |
host to network byte order for 64-bit floats, using vrpn_htond | |
vrpn_float64 | vrpn_byte_order::ntoh (vrpn_float64 netval) |
network to host byte order for 64-bit floats, using vrpn_ntohd | |
template<typename T > | |
T | vrpn_byte_order::hton (T input) |
Templated hton that type-puns to the same-sized uint type as a fallback for those types not explicitly defined above. | |
template<typename T > | |
T | vrpn_byte_order::ntoh (T input) |
Templated ntoh that type-puns to the same-sized uint type as a fallback for those types not explicitly defined above. | |
template<typename T , typename ByteT > | |
T | vrpn_unbuffer (ByteT *&input) |
Function template to unbuffer values from a buffer stored in network byte order. Specify the type to extract T as a template parameter. The templated buffer type ByteT will be deduced automatically. The input pointer will be advanced past the unbuffered value. | |
template<typename T , typename ByteT > | |
int | vrpn_buffer_to_little_endian (ByteT **insertPt, vrpn_int32 *buflen, const T inVal) |
Function template to buffer values to a buffer stored in little- endian order. Specify the type to buffer T as a template parameter. The templated buffer type ByteT will be deduced automatically. The input pointer will be advanced past the unbuffered value. | |
template<typename T , typename ByteT > | |
int | vrpn_buffer (ByteT **insertPt, vrpn_int32 *buflen, const T inVal) |
Function template to buffer values to a buffer stored in network byte order. Specify the type to buffer T as a template parameter. The templated buffer type ByteT will be deduced automatically. The input pointer will be advanced past the unbuffered value. | |
template<typename T , typename ByteT > | |
int | vrpn_unbuffer (ByteT **input, T *lvalue) |
bool | vrpn_test_pack_unpack (void) |
template<size_t charCount> | |
void | vrpn_strcpy (char(&to)[charCount], const char *pSrc) |
Null-terminated-string copy function that both guarantees not to overrun the buffer and guarantees that the last character copied is a NULL terminator character. Infers the size of the output buffer by template magic. See https://randomascii.wordpress.com/2013/04/03/stop-using-strncpy-already/ for a description of how this works. | |
#define INVALID_SOCKET -1 |
Definition at line 51 of file vrpn_Shared.h.
#define SOCKET int |
Definition at line 52 of file vrpn_Shared.h.
#define VRPN_DEGREES_TO_RADIANS (VRPN_PI/180.0) |
Definition at line 15 of file vrpn_Shared.h.
#define vrpn_gettimeofday gettimeofday |
Definition at line 99 of file vrpn_Shared.h.
#define VRPN_INCHES_TO_METERS (2.54/100.0) |
Definition at line 14 of file vrpn_Shared.h.
#define VRPN_PI (3.14159265358979323846) |
Definition at line 13 of file vrpn_Shared.h.
#define VRPN_STATIC_ASSERT | ( | CONDITION, | |
MESSAGE | |||
) | assert((CONDITION) && #MESSAGE) |
Fall back to normal asserts.
Definition at line 352 of file vrpn_Shared.h.
|
inline |
Function template to buffer values to a buffer stored in network byte order. Specify the type to buffer T as a template parameter. The templated buffer type ByteT will be deduced automatically. The input pointer will be advanced past the unbuffered value.
Union to allow type-punning and ensure alignment
Populate union in network byte order
Copy bytes into buffer
Advance insert pointer
Decrement buffer length
Definition at line 458 of file vrpn_Shared.h.
References VRPN_STATIC_ASSERT.
VRPN_API int vrpn_buffer | ( | char ** | insertPt, |
vrpn_int32 * | buflen, | ||
const char * | string, | ||
vrpn_int32 | length | ||
) |
Utility routine for placing a character string of given length into a buffer that is to be sent as a message.
Handles packing into an unaligned buffer (though this should not be done). Advances the insertPt pointer to just after newly-inserted value. Decreases the buflen (space remaining) by the length of the value. Returns zero on success and -1 on failure.
Part of a family of routines that buffer different VRPN types based on their type (vrpn_buffer is overloaded based on the third parameter type). These routines handle byte-swapping to the VRPN standard wire protocol.
If the length is specified as -1, then the string will be assumed to be NULL-terminated and will be copied using the string-copy routines.
Definition at line 280 of file vrpn_Shared.C.
VRPN_API int vrpn_buffer | ( | char ** | insertPt, |
vrpn_int32 * | buflen, | ||
const timeval | t | ||
) |
Utility routine for placing a timeval struct into a buffer that is to be sent as a message.
Handles packing into an unaligned buffer (though this should not be done). Advances the insertPt pointer to just after newly-inserted value. Decreases the buflen (space remaining) by the length of the value. Returns zero on success and -1 on failure.
Part of a family of routines that buffer different VRPN types based on their type (vrpn_buffer is overloaded based on the third parameter type). These routines handle byte-swapping to the VRPN standard wire protocol.
Definition at line 250 of file vrpn_Shared.C.
References vrpn_buffer().
Referenced by vrpn_Imager_Channel::buffer(), vrpn_Shared_String::encode(), vrpn_Shared_float64::encode(), vrpn_Shared_int32::encode(), vrpn_Tracker::encode_acc_to(), vrpn_ForceDevice::encode_addObject(), vrpn_ForceDevice::encode_addObjectExScene(), vrpn_Analog_Output_Remote::encode_change_channels_to(), vrpn_Analog_Output_Remote::encode_change_to(), vrpn_FunctionGenerator_Remote::encode_channel(), vrpn_FunctionGenerator_Server::encode_channel_reply(), vrpn_FunctionGenerator_Remote::encode_channel_request(), vrpn_ForceDevice::encode_clearTrimesh(), vrpn_ForceDevice::encode_custom_effect(), vrpn_RedundantController_Protocol::encode_enable(), vrpn_ForceDevice::encode_enableConstraint(), vrpn_ForceDevice::encode_error(), vrpn_FunctionGenerator_Server::encode_error_report(), vrpn_ForceDevice::encode_force(), vrpn_ForceDevice::encode_forcefield(), vrpn_FunctionGenerator_Server::encode_interpreterDescription_reply(), vrpn_ForceDevice::encode_moveToParent(), vrpn_ForceDevice::encode_normal(), vrpn_Analog_Output_Server::encode_num_channels_to(), vrpn_National_Instruments_Server::encode_num_channels_to(), vrpn_Analog_Output_Server_NI::encode_num_channels_to(), vrpn_ForceDevice::encode_objectOrientation(), vrpn_ForceDevice::encode_objectPosition(), vrpn_ForceDevice::encode_objectScale(), vrpn_ForceDevice::encode_plane(), vrpn_ForceDevice::encode_removeObject(), vrpn_ForceDevice::encode_removeTriangle(), vrpn_FunctionGenerator_Server::encode_sampleRate_reply(), vrpn_FunctionGenerator_Remote::encode_sampleRate_request(), vrpn_ForceDevice::encode_scp(), vrpn_RedundantController_Protocol::encode_set(), vrpn_ForceDevice::encode_setConstraintKSpring(), vrpn_ForceDevice::encode_setConstraintMode(), vrpn_ForceDevice::encode_setHapticOrigin(), vrpn_ForceDevice::encode_setHapticScale(), vrpn_ForceDevice::encode_setObjectIsTouchable(), vrpn_ForceDevice::encode_setSceneOrigin(), vrpn_ForceDevice::encode_setTrimeshType(), vrpn_FunctionGenerator_Server::encode_start_reply(), vrpn_Button::encode_states_to(), vrpn_Button_Filter::encode_states_to(), vrpn_FunctionGenerator_Server::encode_stop_reply(), vrpn_ForceDevice::encode_surface_effects(), vrpn_BaseClassUnique::encode_text_message_to_buffer(), vrpn_FunctionGenerator_function_script::encode_to(), vrpn_FunctionGenerator_channel::encode_to(), vrpn_Analog::encode_to(), vrpn_Poser::encode_to(), vrpn_Tracker::encode_to(), vrpn_Dial::encode_to(), vrpn_Button::encode_to(), vrpn_Tracker::encode_tracker2room_to(), vrpn_ForceDevice::encode_triangle(), vrpn_ForceDevice::encode_trimeshTransform(), vrpn_Tracker::encode_unit2sensor_to(), vrpn_ForceDevice::encode_updateTrimeshChanges(), vrpn_Poser::encode_vel_to(), vrpn_Tracker::encode_vel_to(), vrpn_ForceDevice::encode_vertex(), vrpn_Tracker::encode_workspace_to(), vrpn_Shared_int32::encodeLamport(), vrpn_Sound::encodeListenerPose(), vrpn_Sound::encodeListenerVelocity(), vrpn_Sound::encodeLoadMaterial(), vrpn_Sound::encodeLoadModel_local(), vrpn_Sound::encodeLoadPolyQuad(), vrpn_Sound::encodeLoadPolyTri(), vrpn_ForceDevice::encodePoint(), vrpn_Sound::encodeSetPolyMaterial(), vrpn_Sound::encodeSetPolyOF(), vrpn_Sound::encodeSetQuadVert(), vrpn_Sound::encodeSetTriVert(), vrpn_Sound::encodeSound_local(), vrpn_Sound::encodeSoundConeInfo(), vrpn_Sound::encodeSoundDef(), vrpn_Sound::encodeSoundDistInfo(), vrpn_Sound::encodeSoundDoplerScale(), vrpn_Sound::encodeSoundEqFactor(), vrpn_Sound::encodeSoundID(), vrpn_Sound::encodeSoundPitch(), vrpn_Sound::encodeSoundPlay(), vrpn_Sound::encodeSoundPose(), vrpn_Sound::encodeSoundVelocity(), vrpn_Sound::encodeSoundVolume(), vrpn_Imager_Stream_Buffer::handle_server_messages(), vrpn_YEI_3Space::init(), vrpn_Endpoint::pack_log_description(), vrpn_Auxiliary_Logger::pack_log_message_of_type(), vrpn_Mutex_Remote::requestIndex(), vrpn_YEI_3Space::reset(), vrpn_Imager_Server::send_begin_frame(), vrpn_Imager_Server::send_description(), vrpn_ImagerPose_Server::send_description(), vrpn_Imager_Server::send_discarded_frames(), vrpn_Imager_Server::send_end_frame(), vrpn_Imager_Server::send_region_using_base_pointer(), vrpn_PeerMutex::sendDenyRequest(), vrpn_Mutex::sendDenyRequest(), vrpn_PeerMutex::sendGrantRequest(), vrpn_Mutex::sendGrantRequest(), vrpn_PeerMutex::sendRelease(), vrpn_PeerMutex::sendRequest(), vrpn_Mutex::sendRequest(), vrpn_YEI_3Space_Sensor_Wireless::set_logical_id(), vrpn_File_Controller::set_replay_rate(), vrpn_Tracker_Remote::set_update_rate(), vrpn_Imager_Remote::throttle_sender(), vrpn_buffer(), and vrpn_test_pack_unpack().
|
inline |
Function template to buffer values to a buffer stored in little- endian order. Specify the type to buffer T as a template parameter. The templated buffer type ByteT will be deduced automatically. The input pointer will be advanced past the unbuffered value.
Union to allow type-punning and ensure alignment
Populate union in network byte order
Swap known big-endian (aka network byte order) into little-endian
Advance insert pointer
Decrement buffer length
Definition at line 415 of file vrpn_Shared.h.
References VRPN_STATIC_ASSERT.
Referenced by vrpn_test_pack_unpack(), vrpn_Oculus_DK1::writeKeepAlive(), and vrpn_Oculus_DK2::writeKeepAlive().
VRPN_API vrpn_float64 vrpn_htond | ( | vrpn_float64 | d | ) |
Definition at line 199 of file vrpn_Shared.C.
Referenced by vrpn_byte_order::hton(), and vrpn_ntohd().
VRPN_API struct timeval vrpn_MsecsTimeval | ( | const double | dMsecs | ) |
Definition at line 155 of file vrpn_Shared.C.
Referenced by vrpn_File_Connection::jump_to_time(), and vrpn_File_Connection::play_to_time().
VRPN_API vrpn_float64 vrpn_ntohd | ( | vrpn_float64 | d | ) |
Definition at line 235 of file vrpn_Shared.C.
References vrpn_htond().
Referenced by vrpn_byte_order::ntoh().
VRPN_API void vrpn_SleepMsecs | ( | double | dMilliSecs | ) |
Definition at line 166 of file vrpn_Shared.C.
Referenced by vrpn_Tracker_Flock::checkError(), vrpn_IDEA::get_report(), vrpn_Tracker_Flock::getMeasurementRate(), vrpn_Imager_Stream_Buffer::handle_got_first_connection(), vrpn_Imager_Stream_Buffer::handle_request_logging(), vrpn_Tracker_LibertyHS::launch_markers(), vrpn_Imager_Stream_Buffer::logging_thread_func(), vrpn_ADBox::mainloop(), vrpn_Analog_USDigital_A2::mainloop(), vrpn_Tracker_Flock_Parallel::mainloop(), vrpn_WiiMote::mainloop(), vrpn_Imager_Stream_Buffer::make_new_logging_connection(), vrpn_Tracker_Crossbow::recalibrate(), vrpn_National_Instruments_Server::reportError(), vrpn_Tracker_3Space::reset(), vrpn_Tracker_Dyna::reset(), vrpn_Tracker_Flock::reset(), vrpn_Tracker_Flock_Parallel_Slave::reset(), vrpn_raw_SGIBox::reset(), vrpn_Streaming_Arduino::reset(), vrpn_Tracker_3DMouse::reset(), vrpn_Tracker_Crossbow::reset(), vrpn_Tracker_Fastrak::reset(), vrpn_Tracker_Isotrak::reset(), vrpn_Tracker_Liberty::reset(), vrpn_Tracker_LibertyHS::reset(), vrpn_Joystick::reset(), vrpn_5dt16::reset(), vrpn_5dt::reset(), vrpn_BiosciencesTools::reset(), vrpn_IDEA::reset(), vrpn_Nikon_Controls::reset(), vrpn_Poser_Tek4662::reset(), vrpn_YEI_3Space::reset(), vrpn_Zaber::reset(), vrpn_Tracker_3DMouse::set_filtering_count(), vrpn_Tracker_Fastrak::set_sensor_output_format(), vrpn_Tracker_Isotrak::set_sensor_output_format(), vrpn_Tracker_Liberty::set_sensor_output_format(), vrpn_Tracker_LibertyHS::set_sensor_output_format(), vrpn_Imager_Stream_Buffer::stop_logging_thread(), vrpn_Tracker_NDI_Polaris::switchToHigherBaudRate(), vrpn_Tracker_LibertyHS::test_markers(), vrpn_LUDL_USBMAC6000::vrpn_LUDL_USBMAC6000(), vrpn_Magellan::vrpn_Magellan(), vrpn_test_threads_and_semaphores(), vrpn_Tracker_NDI_Polaris::vrpn_Tracker_NDI_Polaris(), vrpn_write_slowly(), vrpn_Tracker_LibertyHS::~vrpn_Tracker_LibertyHS(), vrpn_Tracker_RazerHydra::~vrpn_Tracker_RazerHydra(), and vrpn_WiiMote::~vrpn_WiiMote().
void vrpn_strcpy | ( | char(&) | to[charCount], |
const char * | pSrc | ||
) |
Null-terminated-string copy function that both guarantees not to overrun the buffer and guarantees that the last character copied is a NULL terminator character. Infers the size of the output buffer by template magic. See https://randomascii.wordpress.com/2013/04/03/stop-using-strncpy-already/ for a description of how this works.
Definition at line 510 of file vrpn_Shared.h.
Referenced by vrpn_Imager_Server::add_channel(), vrpn_ConnectionManager::addConnection(), vrpn_Connection_IP::handle_UDP_message(), vrpn_Tracker_Fastrak::reset(), vrpn_Tracker_Isotrak::reset(), vrpn_Tracker_Liberty::reset(), vrpn_Tracker_LibertyHS::reset(), vrpn_Tracker_NDI_Polaris::setupOneTool(), vrpn_Button_Serial::vrpn_Button_Serial(), vrpn_Button_SerialMouse::vrpn_Button_SerialMouse(), vrpn_Serial_Analog::vrpn_Serial_Analog(), vrpn_TBF_axis::vrpn_TBF_axis(), vrpn_Tracker_Fastrak::vrpn_Tracker_Fastrak(), vrpn_Tracker_InterSense::vrpn_Tracker_InterSense(), vrpn_Tracker_Isotrak::vrpn_Tracker_Isotrak(), vrpn_Tracker_Liberty::vrpn_Tracker_Liberty(), vrpn_Tracker_LibertyHS::vrpn_Tracker_LibertyHS(), and vrpn_Tracker_Serial::vrpn_Tracker_Serial().
bool vrpn_test_pack_unpack | ( | void | ) |
Definition at line 995 of file vrpn_Shared.C.
References vrpn_buffer(), and vrpn_buffer_to_little_endian().
VRPN_API struct timeval vrpn_TimevalDiff | ( | const struct timeval & | tv1, |
const struct timeval & | tv2 | ||
) |
VRPN_API unsigned long vrpn_TimevalDuration | ( | struct timeval | endT, |
struct timeval | startT | ||
) |
Return number of microseconds between startT and endT.
Definition at line 138 of file vrpn_Shared.C.
Referenced by vrpn_5dt16::mainloop(), vrpn_5dt::mainloop(), vrpn_Radamec_SPI::mainloop(), vrpn_BiosciencesTools::mainloop(), vrpn_Button_Example_Server::mainloop(), vrpn_CerealBox::mainloop(), vrpn_Dial_Example_Server::mainloop(), vrpn_Tracker_Flock_Parallel_Slave::mainloop(), vrpn_GlobalHapticsOrb::mainloop(), vrpn_IDEA::mainloop(), vrpn_Nikon_Controls::mainloop(), vrpn_Tracker_Serial::mainloop(), vrpn_Tracker_USB::mainloop(), vrpn_Tracker_NULL::mainloop(), vrpn_YEI_3Space::mainloop(), vrpn_Zaber::mainloop(), vrpn_CHProducts_Fighterstick_USB::mainloop(), vrpn_Contour_ShuttleXpress::mainloop(), vrpn_Contour_ShuttlePROv2::mainloop(), vrpn_Futaba_InterLink_Elite::mainloop(), vrpn_Griffin_PowerMate::mainloop(), vrpn_ImmersionBox::mainloop(), vrpn_Logitech_Extreme_3D_Pro::mainloop(), vrpn_Microsoft_SideWinder_Precision_2::mainloop(), vrpn_Microsoft_SideWinder::mainloop(), vrpn_Microsoft_Controller_Raw_Xbox_S::mainloop(), vrpn_Microsoft_Controller_Raw_Xbox_360_base::mainloop(), vrpn_nVidia_shield_USB::mainloop(), vrpn_nVidia_shield_stealth_USB::mainloop(), vrpn_Retrolink_GameCube::mainloop(), vrpn_Retrolink_Genesis::mainloop(), vrpn_Saitek_ST290_Pro::mainloop(), vrpn_Streaming_Arduino::mainloop(), vrpn_Tng3::mainloop(), vrpn_Joystick::mainloop(), vrpn_Vality_vGlass::mainloop(), and vrpn_Poser_Tek4662::run().
VRPN_API double vrpn_TimevalDurationSeconds | ( | struct timeval | endT, |
struct timeval | startT | ||
) |
Return the number of seconds between startT and endT as a floating-point value.
Definition at line 144 of file vrpn_Shared.C.
Referenced by vrpn_Tracker_DeadReckoning_Rotation::handle_tracker_report(), vrpn_National_Instruments_Server::mainloop(), vrpn_Oculus::mainloop(), vrpn_Tracker_Spin::mainloop(), vrpn_Tracker_AnalogFly::mainloop(), vrpn_Tracker_ButtonFly::mainloop(), vrpn_Tracker_DTrack::mainloop(), vrpn_IMU_Magnetometer::mainloop(), vrpn_IMU_SimpleCombiner::mainloop(), and vrpn_Tracker_WiimoteHead::mainloop().
VRPN_API bool vrpn_TimevalEqual | ( | const struct timeval & | tv1, |
const struct timeval & | tv2 | ||
) |
VRPN_API bool vrpn_TimevalGreater | ( | const struct timeval & | tv1, |
const struct timeval & | tv2 | ||
) |
VRPN_API double vrpn_TimevalMsecs | ( | const struct timeval & | tv1 | ) |
VRPN_API struct timeval vrpn_TimevalNormalize | ( | const struct timeval & | tv | ) |
VRPN_API struct timeval vrpn_TimevalScale | ( | const struct timeval & | tv, |
double | scale | ||
) |
VRPN_API struct timeval vrpn_TimevalSum | ( | const struct timeval & | tv1, |
const struct timeval & | tv2 | ||
) |
|
inline |
Function template to unbuffer values from a buffer stored in network byte order. Specify the type to extract T as a template parameter. The templated buffer type ByteT will be deduced automatically. The input pointer will be advanced past the unbuffered value.
Union to allow type-punning and ensure alignment
Copy bytes into union
Advance input pointer
return value in host byte order
Definition at line 388 of file vrpn_Shared.h.
References VRPN_STATIC_ASSERT.
|
inline |
Definition at line 495 of file vrpn_Shared.h.
VRPN_API int vrpn_unbuffer | ( | const char ** | buffer, |
char * | string, | ||
vrpn_int32 | length | ||
) |
Utility routine for taking a string of specified length from a buffer that was sent as a message.
Does NOT handle unpacking from an unaligned buffer, because the semantics of VRPN require message buffers and the values in them to be aligned, in order to reduce the amount of copying that goes on. Advances the read pointer to just after newly-read value. Assumes that the buffer holds a complete value. Returns zero on success and -1 on failure.
Part of a family of routines that unbuffer different VRPN types based on their type (vrpn_buffer is overloaded based on the third parameter type). These routines handle byte-swapping to and from the VRPN defined wire protocol.
If the length is specified as less than zero, then the string will be assumed to be NULL-terminated and will be read using the string-copy routines with a length that is at most the magnitude of the number (-16 means at most 16). NEVER use this on a string that was packed with other than the NULL-terminating condition, since embedded NULL characters will ruin the argument parsing for any later arguments in the message.
Definition at line 356 of file vrpn_Shared.C.
VRPN_API int vrpn_unbuffer | ( | const char ** | buffer, |
timeval * | t | ||
) |
Utility routine for taking a struct timeval from a buffer that was sent as a message.
Handles unpacking from an unaligned buffer, because people did this anyway. Advances the reading pointer to just after newly-read value. Assumes that the buffer holds a complete value. Returns zero on success and -1 on failure.
Part of a family of routines that unbuffer different VRPN types based on their type (vrpn_buffer is overloaded based on the third parameter type). These routines handle byte-swapping to and from the VRPN defined wire protocol.
Definition at line 321 of file vrpn_Shared.C.
References CHECK, and vrpn_unbuffer().
Referenced by vrpn_Radamec_SPI::convert_16bit_unsigned(), vrpn_Radamec_SPI::convert_24bit_unsigned(), vrpn_Shared_String::decode(), vrpn_Shared_float64::decode(), vrpn_Shared_int32::decode(), vrpn_ForceDevice::decode_addObject(), vrpn_ForceDevice::decode_addObjectExScene(), vrpn_FunctionGenerator_Server::decode_channel(), vrpn_FunctionGenerator_Remote::decode_channel_reply(), vrpn_FunctionGenerator_Server::decode_channel_request(), vrpn_ForceDevice::decode_clearTrimesh(), vrpn_ForceDevice::decode_custom_effect(), vrpn_RedundantController_Protocol::decode_enable(), vrpn_ForceDevice::decode_enableConstraint(), vrpn_ForceDevice::decode_error(), vrpn_FunctionGenerator_Remote::decode_error_reply(), vrpn_ForceDevice::decode_force(), vrpn_ForceDevice::decode_forcefield(), vrpn_FunctionGenerator_function_script::decode_from(), vrpn_FunctionGenerator_channel::decode_from(), vrpn_FunctionGenerator_Remote::decode_interpreterDescription_reply(), vrpn_ForceDevice::decode_moveToParent(), vrpn_ForceDevice::decode_normal(), vrpn_ForceDevice::decode_objectOrientation(), vrpn_ForceDevice::decode_objectPosition(), vrpn_ForceDevice::decode_objectScale(), vrpn_ForceDevice::decode_plane(), vrpn_ForceDevice::decode_removeObject(), vrpn_ForceDevice::decode_removeTriangle(), vrpn_FunctionGenerator_Remote::decode_sampleRate_reply(), vrpn_FunctionGenerator_Server::decode_sampleRate_request(), vrpn_ForceDevice::decode_scp(), vrpn_RedundantController_Protocol::decode_set(), vrpn_ForceDevice::decode_setConstraintKSpring(), vrpn_ForceDevice::decode_setConstraintMode(), vrpn_ForceDevice::decode_setHapticOrigin(), vrpn_ForceDevice::decode_setHapticScale(), vrpn_ForceDevice::decode_setObjectIsTouchable(), vrpn_ForceDevice::decode_setSceneOrigin(), vrpn_ForceDevice::decode_setTrimeshType(), vrpn_FunctionGenerator_Remote::decode_start_reply(), vrpn_FunctionGenerator_Remote::decode_stop_reply(), vrpn_ForceDevice::decode_surface_effects(), vrpn_BaseClassUnique::decode_text_message_from_buffer(), vrpn_ForceDevice::decode_triangle(), vrpn_ForceDevice::decode_trimeshTransform(), vrpn_ForceDevice::decode_updateTrimeshChanges(), vrpn_ForceDevice::decode_vertex(), vrpn_Shared_int32::decodeLamport(), vrpn_Sound::decodeListenerPose(), vrpn_Sound::decodeListenerVelocity(), vrpn_Sound::decodeLoadMaterial(), vrpn_Sound::decodeLoadModel_local(), vrpn_Sound::decodeLoadPolyQuad(), vrpn_Sound::decodeLoadPolyTri(), vrpn_ForceDevice::decodePoint(), vrpn_Sound::decodeSetPolyMaterial(), vrpn_Sound::decodeSetPolyOF(), vrpn_Sound::decodeSetQuadVert(), vrpn_Sound::decodeSetTriVert(), vrpn_Sound::decodeSound_local(), vrpn_Sound::decodeSoundConeInfo(), vrpn_Sound::decodeSoundDef(), vrpn_Sound::decodeSoundDistInfo(), vrpn_Sound::decodeSoundDoplerScale(), vrpn_Sound::decodeSoundEqFactor(), vrpn_Sound::decodeSoundID(), vrpn_Sound::decodeSoundPitch(), vrpn_Sound::decodeSoundPlay(), vrpn_Sound::decodeSoundPose(), vrpn_Sound::decodeSoundVelocity(), vrpn_Sound::decodeSoundVolume(), vrpn_Tracker_Remote::handle_acc_change_message(), vrpn_Imager_Remote::handle_begin_frame_message(), vrpn_Analog_Remote::handle_change_message(), vrpn_Button_Remote::handle_change_message(), vrpn_Dial_Remote::handle_change_message(), vrpn_Poser_Server::handle_change_message(), vrpn_Poser_Analog::handle_change_message(), vrpn_Poser_Tek4662::handle_change_message(), vrpn_Tracker_Remote::handle_change_message(), vrpn_Mutex_Remote::handle_denyRequest(), vrpn_PeerMutex::handle_denyRequest(), vrpn_Imager_Remote::handle_description_message(), vrpn_ImagerPose_Remote::handle_description_message(), vrpn_Imager_Remote::handle_discarded_frames_message(), vrpn_Imager_Remote::handle_end_frame_message(), vrpn_Mutex_Remote::handle_grantRequest(), vrpn_PeerMutex::handle_grantRequest(), vrpn_Mutex_Remote::handle_initialize(), vrpn_Connection::handle_log_message(), vrpn_Imager_Remote::handle_region_message(), vrpn_Poser_Server::handle_relative_change_message(), vrpn_Poser_Server::handle_relative_vel_change_message(), vrpn_PeerMutex::handle_release(), vrpn_YEI_3Space::handle_report(), vrpn_Analog_Output_Remote::handle_report_num_channels(), vrpn_PeerMutex::handle_request(), vrpn_Analog_Output_Server::handle_request_channels_message(), vrpn_BiosciencesTools::handle_request_channels_message(), vrpn_IDEA::handle_request_channels_message(), vrpn_LUDL_USBMAC6000::handle_request_channels_message(), vrpn_National_Instruments_Server::handle_request_channels_message(), vrpn_Analog_Output_Server_NI::handle_request_channels_message(), vrpn_Nikon_Controls::handle_request_channels_message(), vrpn_WiiMote::handle_request_channels_message(), vrpn_Zaber::handle_request_channels_message(), vrpn_Analog_Output_Server::handle_request_message(), vrpn_BiosciencesTools::handle_request_message(), vrpn_IDEA::handle_request_message(), vrpn_LUDL_USBMAC6000::handle_request_message(), vrpn_National_Instruments_Server::handle_request_message(), vrpn_Analog_Output_Server_NI::handle_request_message(), vrpn_Nikon_Controls::handle_request_message(), vrpn_WiiMote::handle_request_message(), vrpn_Zaber::handle_request_message(), vrpn_Mutex_Server::handle_requestMutex(), vrpn_Button_Remote::handle_states_message(), vrpn_Imager_Server::handle_throttle_message(), vrpn_Tracker_Remote::handle_tracker2room_change_message(), vrpn_Tracker_Remote::handle_unit2sensor_change_message(), vrpn_Tracker_PhaseSpace::handle_update_rate_request(), vrpn_Poser_Server::handle_vel_change_message(), vrpn_Poser_Analog::handle_vel_change_message(), vrpn_Poser_Tek4662::handle_vel_change_message(), vrpn_Tracker_Remote::handle_vel_change_message(), vrpn_Tracker_Remote::handle_workspace_change_message(), vrpn_YEI_3Space_Sensor::receive_LED_values_response(), vrpn_YEI_3Space_Sensor_Wireless::receive_LED_values_response(), vrpn_Tracker_Crossbow::reset(), vrpn_Imager_Stream_Buffer::static_handle_throttle_message(), vrpn_Imager_Channel::unbuffer(), vrpn_Tracker_Crossbow::unbuffer_packet(), vrpn_Auxiliary_Logger::unpack_log_message_from_buffer(), and vrpn_unbuffer().