43 : m_direction(direction), m_sensor(sensor) {}
47 template <
typename T>
void processMessage(T &p) {
53 ret.sensor = m_sensor;
54 ret.direction = m_direction;
62 const char *DirectionRecord::identifier() {
63 return "com.osvr.direction.directionrecord";
67 shared_ptr<DirectionComponent>
74 : m_numSensor(numChan) {}
82 messages::DirectionRecord::MessageSerialization msg(direction, sensor);
90 DirectionComponent::m_handleDirectionRecord(
void *userdata,
91 vrpn_HANDLERPARAM p) {
92 auto self =
static_cast<DirectionComponent *
>(userdata);
95 messages::DirectionRecord::MessageSerialization msg;
97 auto data = msg.getData();
100 for (
auto const &cb : self->m_cb) {
107 DirectionComponent::registerDirectionHandler(DirectionHandler handler) {
112 m_cb.push_back(handler);
114 void DirectionComponent::m_parentSet() {
uint32_t OSVR_ChannelCount
The integer type specifying a number of channels/sensors or a channel/sensor index.
void deserialize(BufferReaderType &reader, MessageClass &msg)
Deserializes a message from a buffer, using a MessageClass
A structure defining a 3D vector, often a position/translation.
void serialize(BufferType &buf, MessageClass &msg)
Serializes a message into a buffer, using a MessageClass
static shared_ptr< DirectionComponent > create(OSVR_ChannelCount numSensor=1)
Factory method.
void m_registerHandler(vrpn_MESSAGEHANDLER handler, void *userdata, RawMessageType const &msgType)
Registers a handler whose lifetime is tied to the lifetime of the component.
void fromStructTimeval(TimeValue &dest, struct timeval const &src)
Convert a struct timeval to a TimeValue.
messages::DirectionRecord directionRecord
Message from server to client, containing 3D direction data.
Parent & m_getParent()
Gets the parent - only call if m_hasParent() is true.
Internal, configured header file for verbosity macros.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Header defining buffer types, with optional alignment dependent on Boost version. ...
BufferReader< ExternalBufferReadingWrapper< CharType > > readExternalBuffer(const CharType *buf, size_t len)
Constructs and returns a buffer reader for an externally-allocated buffer: it's on you to supply a va...
void registerMessageType(MessageRegistration< T > &messageReg)
Call with a MessageRegistration object, and the message type will be registered and stored in the typ...