OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
osvr::common::BaseDevice Class Referenceabstract

Class used as an interface for underlying devices that can have device components (corresponding to interface classes) More...

#include <osvr/Common/BaseDevice.h>

Inheritance diagram for osvr::common::BaseDevice:
osvr::common::DeviceWrapper osvr::connection::vrpn_BaseFlexServer

Public Member Functions

virtual ~BaseDevice ()
 Virtual destructor. More...
 
template<typename T >
T * addComponent (shared_ptr< T > component)
 Adds a component to a base device. More...
 
void registerHandler (vrpn_MESSAGEHANDLER handler, void *userdata, RawMessageType const &msgType)
 
void unregisterHandler (vrpn_MESSAGEHANDLER handler, void *userdata, RawMessageType const &msgType)
 
template<typename T >
void registerMessageType (MessageRegistration< T > &messageReg)
 Call with a MessageRegistration object, and the message type will be registered and stored in the type field.
 
RawSenderType getSender ()
 
void update ()
 Called from the outside to run the mainloop on the device and its components.
 
void sendPending ()
 Called from a component to send pending messages instead of waiting for next time.
 
template<typename T , typename ClassOfService >
void packMessage (Buffer< T > const &buf, RawMessageType const &msgType, util::time::TimeValue const &timestamp, class_of_service::ClassOfServiceBase< ClassOfService > const &)
 
template<typename T >
void packMessage (Buffer< T > const &buf, RawMessageType const &msgType, util::time::TimeValue const &timestamp)
 
template<typename T , typename ClassOfService >
void packMessage (Buffer< T > const &buf, RawMessageType const &msgType, class_of_service::ClassOfServiceBase< ClassOfService > const &)
 
template<typename T >
void packMessage (Buffer< T > const &buf, RawMessageType const &msgType)
 
std::string const & getDeviceName () const
 

Protected Member Functions

 BaseDevice ()
 Constructor.
 
void m_setup (vrpn_ConnectionPtr conn, RawSenderType sender, std::string const &name)
 Should be called by derived class to set the connection, etc.
 
vrpn_ConnectionPtr m_getConnection () const
 Accessor for underlying connection.
 
virtual void m_update ()=0
 Implementation-specific update (call client_mainloop() or server_mainloop() in it!)
 

Detailed Description

Class used as an interface for underlying devices that can have device components (corresponding to interface classes)

Definition at line 51 of file BaseDevice.h.

Constructor & Destructor Documentation

osvr::common::BaseDevice::~BaseDevice ( )
virtual

Virtual destructor.

Clear the component list first to make sure handler are unregistered.

Definition at line 42 of file BaseDevice.cpp.

Member Function Documentation

template<typename T >
T* osvr::common::BaseDevice::addComponent ( shared_ptr< T >  component)
inline

Adds a component to a base device.

Exceptions
std::logic_errorif you pass a null pointer.

Definition at line 58 of file BaseDevice.h.


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