SystemInputDeviceHandle.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_DEVICES_MULTIAXIS_SYSTEMINPUTDEVICEHANDLE_H
#define SURGSIM_DEVICES_MULTIAXIS_SYSTEMINPUTDEVICEHANDLE_H
#include <string>
#include <memory>
#include <array>
#include <vector>
namespace SurgSim
{
namespace Devices
{
class SystemInputDeviceHandle
{
public:
static const size_t MAX_NUM_AXES = 6;
static const size_t MAX_NUM_BUTTONS = 4;
typedef std::array<int, MAX_NUM_AXES> AxisStates;
typedef std::array<bool, MAX_NUM_BUTTONS> ButtonStates;
virtual ~SystemInputDeviceHandle();
virtual std::string getDeviceName() const = 0;
virtual bool getDeviceIds(int* vendorId, int* productId) const = 0;
virtual bool hasTranslationAndRotationAxes() const = 0;
virtual bool updateStates(AxisStates* axisStates, ButtonStates* buttonStates, bool* updated) = 0;
virtual void prepareForShutdown();
protected:
SystemInputDeviceHandle();
private:
// Prevent copy construction and copy assignment. (VS2012 does not support "= delete" yet.)
SystemInputDeviceHandle(const SystemInputDeviceHandle& other) /*= delete*/;
SystemInputDeviceHandle& operator=(const SystemInputDeviceHandle& other) /*= delete*/;
};
}; // namespace Devices
}; // namespace SurgSim
#endif // SURGSIM_DEVICES_MULTIAXIS_SYSTEMINPUTDEVICEHANDLE_H
SurgSim::Devices::SystemInputDeviceHandle::hasTranslationAndRotationAxes
virtual bool hasTranslationAndRotationAxes() const =0
Queries if this device has 3 translation and 3 rotation axes.
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Devices::SystemInputDeviceHandle::updateStates
virtual bool updateStates(AxisStates *axisStates, ButtonStates *buttonStates, bool *updated)=0
Updates the axis and states from the device input, if any.
SurgSim::Devices::SystemInputDeviceHandle::~SystemInputDeviceHandle
virtual ~SystemInputDeviceHandle()
Destructor.
Definition: SystemInputDeviceHandle.cpp:28
SurgSim::Devices::SystemInputDeviceHandle::SystemInputDeviceHandle
SystemInputDeviceHandle()
Default constructor.
Definition: SystemInputDeviceHandle.cpp:24
SurgSim::Devices::SystemInputDeviceHandle::prepareForShutdown
virtual void prepareForShutdown()
Prepares the handle for sampling thread shutdown.
Definition: SystemInputDeviceHandle.cpp:32
SurgSim::Devices::SystemInputDeviceHandle::MAX_NUM_BUTTONS
static const size_t MAX_NUM_BUTTONS
The maximum number of buttons supported by any device object.
Definition: SystemInputDeviceHandle.h:36
SurgSim::Devices::SystemInputDeviceHandle::getDeviceName
virtual std::string getDeviceName() const =0
Gets the name returned by the operating system for this device.
SurgSim::Devices::SystemInputDeviceHandle::getDeviceIds
virtual bool getDeviceIds(int *vendorId, int *productId) const =0
Gets the device identifiers.
SurgSim::Devices::SystemInputDeviceHandle::ButtonStates
std::array< bool, MAX_NUM_BUTTONS > ButtonStates
Type used to store button states.
Definition: SystemInputDeviceHandle.h:41
SurgSim::Devices::SystemInputDeviceHandle
A wrapper for system-dependent access to an input/HID device.
Definition: SystemInputDeviceHandle.h:30
SurgSim::Devices::SystemInputDeviceHandle::operator=
SystemInputDeviceHandle & operator=(const SystemInputDeviceHandle &other)
SurgSim::Devices::SystemInputDeviceHandle::AxisStates
std::array< int, MAX_NUM_AXES > AxisStates
Type used to store axis states.
Definition: SystemInputDeviceHandle.h:39
SurgSim::Devices::SystemInputDeviceHandle::MAX_NUM_AXES
static const size_t MAX_NUM_AXES
The maximum number of axes supported by any device object.
Definition: SystemInputDeviceHandle.h:34