39 namespace vrpnserver {
50 std::string useDecoratedName(std::string
const &name) {
51 std::string ret = m_ctx.
getName() +
"/" + name;
54 if (std::find(begin(m_names), end(m_names), ret) == end(m_names)) {
55 m_names.push_back(ret);
62 osvr::connection::Connection::retrieveConnection(
65 auto const &names = getNames();
67 throw std::logic_error(
68 "Your VRPN device has to register at least one name!");
70 m_connDev = conn->registerAdvancedDevice(names, cb, dev);
73 void setDeviceDescriptor(std::string
const &jsonString) {
74 m_connDev->setDeviceDescriptor(jsonString);
75 osvr::connection::Connection::retrieveConnection(m_ctx.
getParent())
76 ->triggerDescriptorHandlers();
79 connection::ConnectionDevice::NameList
const &getNames()
const {
85 connection::ConnectionDevice::NameList m_names;
90 : m_ctx(pluginhost::PluginSpecificRegistrationContext::get(ctx)),
102 return m_impl->useDecoratedName(name);
109 VRPNDeviceRegistration::setDeviceDescriptor(std::string
const &jsonString) {
110 m_impl->setDeviceDescriptor(jsonString);
115 m_impl->registerDevice(cb, dev);
VRPNDeviceRegistration(VRPNDeviceRegistration const &)=delete
noncopyable
vrpn_Connection * getVRPNConnection()
Get the vrpn_Connection object to use in constructing your object.
Class providing the external interface of a registration context backing a single plugin...
shared_ptr< Connection > ConnectionPtr
How one must hold a Connection.
const std::string & getName() const
Accessor for plugin name.
~VRPNDeviceRegistration()
destructor
vrpn_Connection * getVRPNConnection(OSVR_PluginRegContext ctx)
Retrieves the vrpn_Connection pointer from an OSVR_PluginRegContext.
shared_ptr< ConnectionDevice > ConnectionDevicePtr
How to hold on to a ConnectionDevice.
virtual RegistrationContext & getParent()=0
Get parent registration context.
std::string useDecoratedName(std::string const &name)
Decorates a device name with the plugin name and returns it, as well as records it for registration w...
OSVR_EXTERN_C_BEGIN typedef void * OSVR_PluginRegContext
A context pointer passed in to your plugin's entry point and other locations of control flow transfer...
OSVR_ReturnCode(* OSVR_DeviceUpdateCallback)(void *userData)
Function type of a Device Update callback.