vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Shared.h File Reference
#include "vrpn_Configure.h"
#include "vrpn_Types.h"
#include <string.h>
#include <stdio.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <assert.h>
#include <pthread.h>
#include <semaphore.h>
Include dependency graph for vrpn_Shared.h:

Go to the source code of this file.

Classes

struct  vrpn_byte_order::vrpn_detail::uint_traits< TypeSize >
 Traits class to get the uint type of a given size. More...
 
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...
 
class  vrpn_Semaphore
 
struct  vrpn_ThreadData
 
class  vrpn_Thread
 

Namespaces

 vrpn_byte_order
 Internal header providing unbuffering facilities for a number of types.
 
 vrpn_byte_order::vrpn_detail
 
 vrpn_detail
 

Macros

#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. More...
 

Typedefs

typedef void(* vrpn_THREAD_FUNC) (vrpn_ThreadData &threadData)
 

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. More...
 
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. More...
 
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 dMsecs)
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
vrpn_uint8 vrpn_byte_order::hton (vrpn_uint8 hostval)
 host to network byte order for 8-bit uints is a no-op More...
 
vrpn_uint8 vrpn_byte_order::ntoh (vrpn_uint8 netval)
 network to host byte order for 8-bit uints is a no-op More...
 
vrpn_uint16 vrpn_byte_order::hton (vrpn_uint16 hostval)
 host to network byte order for 16-bit uints More...
 
vrpn_uint16 vrpn_byte_order::ntoh (vrpn_uint16 netval)
 network to host byte order for 16-bit uints More...
 
vrpn_uint32 vrpn_byte_order::hton (vrpn_uint32 hostval)
 host to network byte order for 32-bit uints More...
 
vrpn_uint32 vrpn_byte_order::ntoh (vrpn_uint32 netval)
 network to host byte order for 32-bit uints More...
 
vrpn_float64 vrpn_byte_order::hton (vrpn_float64 hostval)
 host to network byte order for 64-bit floats, using vrpn_htond More...
 
vrpn_float64 vrpn_byte_order::ntoh (vrpn_float64 netval)
 network to host byte order for 64-bit floats, using vrpn_ntohd More...
 
template<typename 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. More...
 
template<typename 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. More...
 
template<typename T , typename ByteT >
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. More...
 
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. More...
 
template<typename T , typename ByteT >
int vrpn_unbuffer (ByteT **input, T *lvalue)
 
bool vrpn_test_threads_and_semaphores (void)
 

Macro Definition Documentation

◆ INVALID_SOCKET

#define INVALID_SOCKET   -1

Definition at line 45 of file vrpn_Shared.h.

◆ SOCKET

#define SOCKET   int

Definition at line 46 of file vrpn_Shared.h.

◆ vrpn_gettimeofday

#define vrpn_gettimeofday   gettimeofday

Definition at line 89 of file vrpn_Shared.h.

Referenced by vrpn_Tracker_WiimoteHead::_reset_pose(), vrpn_ForceDevice_Remote::addObject(), vrpn_ForceDevice_Remote::addObjectExScene(), vrpn_SharedObject::becomeSerializer(), vrpn_ForceDevice_Remote::clearObjectTrimesh(), vrpn_BaseClassUnique::client_mainloop(), vrpn_3DConnexion::decodePacket(), vrpn_DreamCheeky_Drum_Kit::decodePacket(), vrpn_Endpoint_IP::drop_connection(), vrpn_RedundantRemote::enable(), vrpn_Forwarder_Controller::forward_message_type(), vrpn_Tracker_3Space::get_report(), vrpn_Zaber::get_report(), vrpn_Keyboard::get_report(), vrpn_Nikon_Controls::get_report(), vrpn_Radamec_SPI::get_report(), vrpn_5dt16::get_report(), vrpn_CerealBox::get_report(), vrpn_GlobalHapticsOrb::get_report(), vrpn_Magellan::get_report(), vrpn_Spaceball::get_report(), vrpn_Tracker_Dyna::get_report(), vrpn_Tracker_GPS::get_report(), vrpn_Tng3::get_report(), vrpn_ImmersionBox::get_report(), vrpn_3DMicroscribe::get_report(), vrpn_Tracker_Flock::get_report(), vrpn_5dt::get_report(), vrpn_Tracker_TrivisioColibri::get_report(), vrpn_BiosciencesTools::get_report(), vrpn_Tracker_Isotrak::get_report(), vrpn_Tracker_Liberty::get_report(), vrpn_Tracker_InterSense::get_report(), vrpn_Tracker_LibertyHS::get_report(), vrpn_Mouse::get_report(), vrpn_Tracker_Fastrak::get_report(), vrpn_IDEA::get_report(), vrpn_Tracker_NDI_Polaris::get_report(), vrpn_inertiamouse::get_report(), vrpn_YEI_3Space_Sensor::get_report(), vrpn_Connection::get_time(), vrpn_ForceDeviceServer::handle_addObject_message(), vrpn_ForceDeviceServer::handle_addObjectExScene_message(), vrpn_Poser_Analog::handle_change_message(), vrpn_ForceDeviceServer::handle_clearTrimesh_message(), vrpn_Imager_Stream_Buffer::handle_got_first_connection(), vrpn_SharedObject::handle_grantSerializer(), vrpn_ForceDeviceServer::handle_moveToParent_message(), vrpn_ForceDeviceServer::handle_removeObject_message(), vrpn_ForceDeviceServer::handle_removeTriangle_message(), vrpn_Auxiliary_Logger_Server_Generic::handle_request_logging(), vrpn_Imager_Stream_Buffer::handle_request_logging(), vrpn_Mutex_Server::handle_requestIndex(), vrpn_SharedObject::handle_requestSerializer(), vrpn_ForceDeviceServer::handle_setHapticOrigin_message(), vrpn_ForceDeviceServer::handle_setHapticScale_message(), vrpn_ForceDeviceServer::handle_setNormal_message(), vrpn_ForceDeviceServer::handle_setObjectIsTouchable_message(), vrpn_ForceDeviceServer::handle_setObjectOrientation_message(), vrpn_ForceDeviceServer::handle_setObjectPosition_message(), vrpn_ForceDeviceServer::handle_setObjectScale_message(), vrpn_ForceDeviceServer::handle_setSceneOrigin_message(), vrpn_ForceDeviceServer::handle_setTriangle_message(), vrpn_ForceDeviceServer::handle_setTrimeshType_message(), vrpn_ForceDeviceServer::handle_setVertex_message(), vrpn_Tracker::handle_t2r_request(), vrpn_ForceDeviceServer::handle_transformTrimesh_message(), vrpn_Tracker::handle_u2s_request(), vrpn_ForceDeviceServer::handle_updateTrimeshChanges_message(), vrpn_Poser_Analog::handle_vel_change_message(), vrpn_Tracker::handle_workspace_request(), vrpn_YEI_3Space::init(), vrpn_Connection::init(), vrpn_Sound_Client::LoadMaterial(), vrpn_Sound_Client::LoadModel_local(), vrpn_Sound_Client::LoadPolyQuad(), vrpn_Sound_Client::LoadPolyTri(), vrpn_Sound_Client::loadSound(), vrpn_Nikon_Controls::mainloop(), vrpn_Joystick::mainloop(), vrpn_Zaber::mainloop(), vrpn_Radamec_SPI::mainloop(), vrpn_5dt16::mainloop(), vrpn_CerealBox::mainloop(), vrpn_GlobalHapticsOrb::mainloop(), vrpn_Tng3::mainloop(), vrpn_ImmersionBox::mainloop(), vrpn_ADBox::mainloop(), vrpn_3DConnexion::mainloop(), vrpn_5dt::mainloop(), vrpn_RedundantTransmission::mainloop(), vrpn_BiosciencesTools::mainloop(), vrpn_LUDL_USBMAC6000::mainloop(), vrpn_YEI_3Space::mainloop(), vrpn_National_Instruments_Server::mainloop(), vrpn_Futaba_InterLink_Elite::mainloop(), vrpn_Griffin_PowerMate::mainloop(), vrpn_Logitech_Extreme_3D_Pro::mainloop(), vrpn_CHProducts_Fighterstick_USB::mainloop(), vrpn_Saitek_ST290_Pro::mainloop(), vrpn_Contour_ShuttleXpress::mainloop(), vrpn_DreamCheeky_Drum_Kit::mainloop(), vrpn_Dial_Example_Server::mainloop(), vrpn_IDEA::mainloop(), vrpn_Analog_5dtUSB::mainloop(), vrpn_Xkeys_Desktop::mainloop(), vrpn_Microsoft_SideWinder_Precision_2::mainloop(), vrpn_Freespace::mainloop(), vrpn_Button_5DT_Server::mainloop(), vrpn_Retrolink_GameCube::mainloop(), vrpn_Tracker_OSVRHackerDevKit::mainloop(), vrpn_File_Connection::mainloop(), vrpn_Xkeys_Pro::mainloop(), vrpn_Tracker_Flock_Parallel_Slave::mainloop(), vrpn_Microsoft_SideWinder::mainloop(), vrpn_Xkeys_Joystick::mainloop(), vrpn_Microsoft_Controller_Raw_Xbox_S::mainloop(), vrpn_Tracker_WiimoteHead::mainloop(), vrpn_Tracker_DTrack::mainloop(), vrpn_Tracker_AnalogFly::mainloop(), vrpn_Xkeys_Jog_And_Shuttle::mainloop(), vrpn_Microsoft_Controller_Raw_Xbox_360::mainloop(), vrpn_Button_Example_Server::mainloop(), vrpn_Tracker_ButtonFly::mainloop(), vrpn_Xkeys_XK3::mainloop(), vrpn_WiiMote::mainloop(), vrpn_Tracker_Serial::mainloop(), vrpn_Tracker_USB::mainloop(), vrpn_Tracker_NULL::mainloop(), vrpn_Endpoint_IP::mainloop(), vrpn_Imager_Stream_Buffer::make_new_logging_connection(), vrpn_ForceDevice_Remote::moveToParent(), vrpn_Tracker_Wintracker::on_data_received(), vrpn_Tracker_SpacePoint::on_data_received(), vrpn_Analog_5dtUSB::on_data_received(), vrpn_Imager_Stream_Buffer::open_new_log_connection(), vrpn_BaseClassUnique::SendTextMessageBoundCall::operator()(), vrpn_Shared_int32::operator=(), vrpn_Shared_float64::operator=(), vrpn_Shared_String::operator=(), vrpn_Endpoint::pack_log_description(), vrpn_Auxiliary_Logger::pack_log_message_of_type(), vrpn_Endpoint::pack_sender_description(), vrpn_Endpoint::pack_type_description(), vrpn_File_Controller::play_to_time(), vrpn_File_Connection::playone_to_filetime(), vrpn_Sound_Client::playSound(), vrpn_Tracker_Crossbow::process_packet(), vrpn_Button_PinchGlove::read(), vrpn_File_Connection::read_entry(), vrpn_ForceDevice_Remote::removeObject(), vrpn_ForceDevice_Remote::removeObjectTriangle(), vrpn_Analog::report(), vrpn_Tracker_WiimoteHead::report(), vrpn_Analog_Output_Server::report_num_channels(), vrpn_National_Instruments_Server::report_num_channels(), vrpn_Analog_Output_Server_NI::report_num_channels(), vrpn_Analog_Output_Remote::request_change_channel_value(), vrpn_Analog_Output_Remote::request_change_channels(), vrpn_Tracker_Remote::request_t2r_xform(), vrpn_Tracker_Remote::request_u2s_xform(), vrpn_Tracker_Remote::request_workspace(), vrpn_FunctionGenerator_Remote::requestAllChannels(), vrpn_FunctionGenerator_Remote::requestChannel(), vrpn_FunctionGenerator_Remote::requestInterpreterDescription(), vrpn_FunctionGenerator_Remote::requestSampleRate(), vrpn_FunctionGenerator_Remote::requestStart(), vrpn_FunctionGenerator_Remote::requestStop(), vrpn_Tracker_3Space::reset(), vrpn_Magellan::reset(), vrpn_Spaceball::reset(), vrpn_File_Controller::reset(), vrpn_3DMicroscribe::reset(), vrpn_Zaber::reset(), vrpn_Radamec_SPI::reset(), vrpn_Tracker_Crossbow::reset(), vrpn_5dt16::reset(), vrpn_Poser_Tek4662::reset(), vrpn_Tng3::reset(), vrpn_BiosciencesTools::reset(), vrpn_5dt::reset(), vrpn_Tracker_Flock::reset(), vrpn_Tracker_Liberty::reset(), vrpn_Tracker_Isotrak::reset(), vrpn_Tracker_InterSense::reset(), vrpn_Tracker_LibertyHS::reset(), vrpn_Tracker_Fastrak::reset(), vrpn_Tracker_Flock_Parallel_Slave::reset(), vrpn_IDEA::reset(), vrpn_Tracker_AnalogFly::reset(), vrpn_inertiamouse::reset(), vrpn_Tracker_ButtonFly::reset(), vrpn_Tracker_Remote::reset_origin(), vrpn_Poser_Tek4662::run(), vrpn_ForceDevice_Remote::send(), 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_Text_Sender::send_message(), vrpn_Imager_Server::send_region_using_base_pointer(), vrpn_Tracker_Flock::send_report(), vrpn_FunctionGenerator_Server::sendChannelReply(), vrpn_Mutex::sendDenyRequest(), vrpn_PeerMutex::sendDenyRequest(), vrpn_ForceDevice::sendError(), vrpn_FunctionGenerator_Server::sendError(), vrpn_ForceDevice_Remote::sendForceField(), vrpn_Mutex::sendGrantRequest(), vrpn_PeerMutex::sendGrantRequest(), vrpn_FunctionGenerator_Server::sendInterpreterDescription(), vrpn_Mutex::sendRelease(), vrpn_PeerMutex::sendRelease(), vrpn_Mutex::sendReleaseNotification(), vrpn_Mutex::sendRequest(), vrpn_PeerMutex::sendRequest(), vrpn_FunctionGenerator_Server::sendSampleRateReply(), vrpn_FunctionGenerator_Server::sendStartReply(), vrpn_FunctionGenerator_Server::sendStopReply(), vrpn_ForceDevice_Remote::sendSurface(), vrpn_RedundantRemote::set(), vrpn_Nikon_Controls::set_channel(), vrpn_File_Controller::set_replay_rate(), vrpn_File_Connection::FileTime_Accumulator::set_replay_rate(), vrpn_Tracker_InterSense::set_sensor_output_format(), vrpn_Tracker_Remote::set_update_rate(), vrpn_FunctionGenerator_Remote::setChannel(), vrpn_ForceDevice_Remote::setHapticOrigin(), vrpn_ForceDevice_Remote::setHapticScale(), vrpn_Sound_Client::setListenerPose(), vrpn_Sound_Client::setListenerVelocity(), vrpn_ForceDevice_Remote::setObjectIsTouchable(), vrpn_ForceDevice_Remote::setObjectNormal(), vrpn_ForceDevice_Remote::setObjectOrientation(), vrpn_ForceDevice_Remote::setObjectPosition(), vrpn_ForceDevice_Remote::setObjectScale(), vrpn_ForceDevice_Remote::setObjectTriangle(), vrpn_ForceDevice_Remote::setObjectTrimeshTransform(), vrpn_ForceDevice_Remote::setObjectVertex(), vrpn_Sound_Client::setPolyMaterialName(), vrpn_Sound_Client::setPolyOF(), vrpn_Sound_Client::setQuadVertices(), vrpn_ForceDevice_Remote::setSceneOrigin(), vrpn_Sound_Client::setSoundConeInfo(), vrpn_Sound_Client::setSoundDistances(), vrpn_Sound_Client::setSoundDopScale(), vrpn_Sound_Client::setSoundEqValue(), vrpn_Sound_Client::setSoundPitch(), vrpn_Sound_Client::setSoundPose(), vrpn_Sound_Client::setSoundVelocity(), vrpn_Sound_Client::setSoundVolume(), vrpn_Sound_Client::setTriVertices(), vrpn_Forwarder_Controller::start_remote_forwarding(), vrpn_ForceDevice_Remote::startEffect(), vrpn_ForceDevice_Remote::startSurface(), vrpn_Imager_Stream_Buffer::stop_logging_thread(), vrpn_ForceDevice_Remote::stopEffect(), vrpn_ForceDevice_Remote::stopForceField(), vrpn_Sound_Client::stopSound(), vrpn_ForceDevice_Remote::stopSurface(), the_time(), vrpn_Imager_Remote::throttle_sender(), vrpn_Connection::time_since_connection_open(), vrpn_Sound_Client::unloadSound(), vrpn_ForceDevice_Remote::updateObjectTrimeshChanges(), vrpn_ForceDevice_Remote::useGhost(), vrpn_ForceDevice_Remote::useHcollide(), vrpn_ADBox::vrpn_ADBox(), vrpn_Analog_5dtUSB::vrpn_Analog_5dtUSB(), vrpn_Analog_Output_Remote::vrpn_Analog_Output_Remote(), vrpn_Analog_Remote::vrpn_Analog_Remote(), vrpn_Button_Parallel::vrpn_Button_Parallel(), vrpn_Button_PinchGlove::vrpn_Button_PinchGlove(), vrpn_Button_Remote::vrpn_Button_Remote(), vrpn_Button_Serial::vrpn_Button_Serial(), vrpn_Button_SerialMouse::vrpn_Button_SerialMouse(), vrpn_Dial_Remote::vrpn_Dial_Remote(), vrpn_DreamCheeky::vrpn_DreamCheeky(), vrpn_Event_Analog::vrpn_Event_Analog(), vrpn_Event_Mouse::vrpn_Event_Mouse(), vrpn_ForceDevice_Remote::vrpn_ForceDevice_Remote(), vrpn_IDEA::vrpn_IDEA(), vrpn_noint_block_read_timeout(), vrpn_noint_select(), vrpn_Poser::vrpn_Poser(), vrpn_Poser_Tek4662::vrpn_Poser_Tek4662(), vrpn_read_available_characters(), vrpn_Serial_Analog::vrpn_Serial_Analog(), vrpn_Shared_float64::vrpn_Shared_float64(), vrpn_Shared_String::vrpn_Shared_String(), vrpn_SharedObject::vrpn_SharedObject(), vrpn_Tracker_AnalogFly::vrpn_Tracker_AnalogFly(), vrpn_Tracker_FilterOneEuro::vrpn_Tracker_FilterOneEuro(), vrpn_Tracker_InterSense::vrpn_Tracker_InterSense(), vrpn_Tracker_RazerHydra::vrpn_Tracker_RazerHydra(), vrpn_Tracker_Remote::vrpn_Tracker_Remote(), vrpn_Tracker_Serial::vrpn_Tracker_Serial(), vrpn_Tracker_SpacePoint::vrpn_Tracker_SpacePoint(), vrpn_Tracker_USB::vrpn_Tracker_USB(), vrpn_Tracker_Wintracker::vrpn_Tracker_Wintracker(), and vrpn_VPJoystick::vrpn_VPJoystick().

◆ VRPN_STATIC_ASSERT

#define VRPN_STATIC_ASSERT (   CONDITION,
  MESSAGE 
)    assert((CONDITION) && #MESSAGE)

Fall back to normal asserts.

Definition at line 347 of file vrpn_Shared.h.

Referenced by vrpn_buffer(), and vrpn_unbuffer().

Typedef Documentation

◆ vrpn_THREAD_FUNC

typedef void(* vrpn_THREAD_FUNC) (vrpn_ThreadData &threadData)

Definition at line 552 of file vrpn_Shared.h.

Function Documentation

◆ vrpn_buffer() [1/3]

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 271 of file vrpn_Shared.C.

◆ vrpn_buffer() [2/3]

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 241 of file vrpn_Shared.C.

References vrpn_buffer().

Referenced by vrpn_Imager_Channel::buffer(), vrpn_Shared_int32::encode(), vrpn_Shared_float64::encode(), vrpn_Shared_String::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_Dial::encode_to(), vrpn_Analog::encode_to(), vrpn_Poser::encode_to(), vrpn_Button::encode_to(), vrpn_FunctionGenerator_function_script::encode_to(), vrpn_Tracker::encode_to(), vrpn_FunctionGenerator_channel::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_Mutex_Server::handle_requestIndex(), 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_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_Mutex::sendDenyRequest(), vrpn_PeerMutex::sendDenyRequest(), vrpn_Mutex::sendGrantRequest(), vrpn_PeerMutex::sendGrantRequest(), vrpn_PeerMutex::sendRelease(), vrpn_Mutex::sendRequest(), vrpn_PeerMutex::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(), and vrpn_buffer().

Here is the call graph for this function:

◆ vrpn_buffer() [3/3]

template<typename T , typename ByteT >
int vrpn_buffer ( ByteT **  insertPt,
vrpn_int32 *  buflen,
const T  inVal 
)
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 410 of file vrpn_Shared.h.

References vrpn_byte_order::hton(), and VRPN_STATIC_ASSERT.

Here is the call graph for this function:

◆ vrpn_htond()

VRPN_API vrpn_float64 vrpn_htond ( vrpn_float64  d)

Definition at line 190 of file vrpn_Shared.C.

Referenced by vrpn_byte_order::hton(), and vrpn_ntohd().

◆ vrpn_MsecsTimeval()

VRPN_API struct timeval vrpn_MsecsTimeval ( const double  dMsecs)

◆ vrpn_ntohd()

VRPN_API vrpn_float64 vrpn_ntohd ( vrpn_float64  d)

Definition at line 226 of file vrpn_Shared.C.

References vrpn_htond().

Referenced by vrpn_byte_order::ntoh().

Here is the call graph for this function:

◆ vrpn_SleepMsecs()

VRPN_API void vrpn_SleepMsecs ( double  dMsecs)

Definition at line 157 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_Tracker_Flock_Parallel::mainloop(), vrpn_Analog_USDigital_A2::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_Joystick::reset(), vrpn_Tracker_3DMouse::reset(), vrpn_Zaber::reset(), vrpn_Nikon_Controls::reset(), vrpn_Tracker_Crossbow::reset(), vrpn_5dt16::reset(), vrpn_Poser_Tek4662::reset(), vrpn_Tracker_Dyna::reset(), vrpn_5dt::reset(), vrpn_BiosciencesTools::reset(), vrpn_Tracker_Flock::reset(), vrpn_Tracker_Isotrak::reset(), vrpn_Tracker_Liberty::reset(), vrpn_Tracker_LibertyHS::reset(), vrpn_YEI_3Space::reset(), vrpn_Tracker_Fastrak::reset(), vrpn_Tracker_Flock_Parallel_Slave::reset(), vrpn_IDEA::reset(), vrpn_Tracker_3DMouse::set_filtering_count(), vrpn_Tracker_Isotrak::set_sensor_output_format(), vrpn_Tracker_Liberty::set_sensor_output_format(), vrpn_Tracker_LibertyHS::set_sensor_output_format(), vrpn_Tracker_Fastrak::set_sensor_output_format(), vrpn_Imager_Stream_Buffer::stop_logging_thread(), vrpn_Tracker_NDI_Polaris::switchToHigherBaudRate(), vrpn_Tracker_LibertyHS::test_markers(), vrpn_Magellan::vrpn_Magellan(), 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().

◆ vrpn_test_threads_and_semaphores()

bool vrpn_test_threads_and_semaphores ( void  )

Definition at line 1426 of file vrpn_Shared.C.

References vrpn_Semaphore::condP(), vrpn_ThreadData::pvUD, vrpn_Thread::td, and vrpn_Semaphore::v().

Here is the call graph for this function:

◆ vrpn_TimevalDiff()

VRPN_API struct timeval vrpn_TimevalDiff ( const struct timeval &  tv1,
const struct timeval &  tv2 
)

◆ vrpn_TimevalDuration()

◆ vrpn_TimevalDurationSeconds()

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 135 of file vrpn_Shared.C.

Referenced by vrpn_National_Instruments_Server::mainloop(), vrpn_Tracker_WiimoteHead::mainloop(), vrpn_Tracker_DTrack::mainloop(), vrpn_Tracker_AnalogFly::mainloop(), and vrpn_Tracker_ButtonFly::mainloop().

◆ vrpn_TimevalEqual()

VRPN_API bool vrpn_TimevalEqual ( const struct timeval &  tv1,
const struct timeval &  tv2 
)

◆ vrpn_TimevalGreater()

VRPN_API bool vrpn_TimevalGreater ( const struct timeval &  tv1,
const struct timeval &  tv2 
)

◆ vrpn_TimevalMsecs()

VRPN_API double vrpn_TimevalMsecs ( const struct timeval &  tv1)

◆ vrpn_TimevalNormalize()

VRPN_API struct timeval vrpn_TimevalNormalize ( const struct timeval &  tv)

◆ vrpn_TimevalScale()

VRPN_API struct timeval vrpn_TimevalScale ( const struct timeval &  tv,
double  scale 
)

◆ vrpn_TimevalSum()

VRPN_API struct timeval vrpn_TimevalSum ( const struct timeval &  tv1,
const struct timeval &  tv2 
)

◆ vrpn_unbuffer() [1/4]

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 348 of file vrpn_Shared.C.

◆ vrpn_unbuffer() [2/4]

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 312 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_int32::decode(), vrpn_Shared_float64::decode(), vrpn_Shared_String::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_Poser_Tek4662::handle_change_message(), vrpn_Poser_Analog::handle_change_message(), vrpn_Dial_Remote::handle_change_message(), vrpn_Poser_Server::handle_change_message(), vrpn_Analog_Remote::handle_change_message(), vrpn_Button_Remote::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_Zaber::handle_request_channels_message(), vrpn_Nikon_Controls::handle_request_channels_message(), vrpn_LUDL_USBMAC6000::handle_request_channels_message(), vrpn_BiosciencesTools::handle_request_channels_message(), vrpn_National_Instruments_Server::handle_request_channels_message(), vrpn_Analog_Output_Server::handle_request_channels_message(), vrpn_IDEA::handle_request_channels_message(), vrpn_Analog_Output_Server_NI::handle_request_channels_message(), vrpn_WiiMote::handle_request_channels_message(), vrpn_Zaber::handle_request_message(), vrpn_Nikon_Controls::handle_request_message(), vrpn_LUDL_USBMAC6000::handle_request_message(), vrpn_BiosciencesTools::handle_request_message(), vrpn_National_Instruments_Server::handle_request_message(), vrpn_Analog_Output_Server::handle_request_message(), vrpn_IDEA::handle_request_message(), vrpn_Analog_Output_Server_NI::handle_request_message(), vrpn_WiiMote::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_Tek4662::handle_vel_change_message(), vrpn_Poser_Analog::handle_vel_change_message(), vrpn_Poser_Server::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().

Here is the call graph for this function:

◆ vrpn_unbuffer() [3/4]

template<typename T , typename ByteT >
T vrpn_unbuffer ( ByteT *&  input)
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 383 of file vrpn_Shared.h.

References vrpn_byte_order::ntoh(), and VRPN_STATIC_ASSERT.

Here is the call graph for this function:

◆ vrpn_unbuffer() [4/4]

template<typename T , typename ByteT >
int vrpn_unbuffer ( ByteT **  input,
T *  lvalue 
)
inline

Definition at line 447 of file vrpn_Shared.h.