MockInputOutput.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_TESTING_MOCKINPUTOUTPUT_H
#define SURGSIM_TESTING_MOCKINPUTOUTPUT_H
#include "SurgSim/DataStructures/DataGroup.h"
#include "SurgSim/DataStructures/OptionalValue.h"
#include "SurgSim/Input/InputConsumerInterface.h"
#include "SurgSim/Input/OutputProducerInterface.h"
namespace SurgSim
{
namespace Testing
{
struct MockInputOutput : public SurgSim::Input::InputConsumerInterface, public SurgSim::Input::OutputProducerInterface
{
public:
MockInputOutput();
virtual void initializeInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData);
virtual void handleInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData);
virtual bool requestOutput(const std::string& device, SurgSim::DataStructures::DataGroup* outputData);
int m_numTimesInitializedInput;
int m_numTimesReceivedInput;
int m_numTimesRequestedOutput;
SurgSim::DataStructures::DataGroup m_lastReceivedInput;
SurgSim::DataStructures::OptionalValue<SurgSim::DataStructures::DataGroup> m_output;
};
};
};
#endif // SURGSIM_TESTING_MOCKINPUTOUTPUT_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Testing::MockInputOutput::handleInput
virtual void handleInput(const std::string &device, const SurgSim::DataStructures::DataGroup &inputData)
Notifies the consumer that the application input coming from the device has been updated.
Definition: MockInputOutput.cpp:44
SurgSim::Testing::MockInputOutput::m_output
SurgSim::DataStructures::OptionalValue< SurgSim::DataStructures::DataGroup > m_output
Definition: MockInputOutput.h:42
DataGroup.h
SurgSim::Input::OutputProducerInterface
Interface for a producer that generates device output updates (forces, status LED state...
Definition: OutputProducerInterface.h:33
SurgSim::Testing::MockInputOutput::m_lastReceivedInput
SurgSim::DataStructures::DataGroup m_lastReceivedInput
Definition: MockInputOutput.h:41
SurgSim::Testing::MockInputOutput::requestOutput
virtual bool requestOutput(const std::string &device, SurgSim::DataStructures::DataGroup *outputData)
Asks the producer to provide output state to the device.
Definition: MockInputOutput.cpp:32
SurgSim::Testing::MockInputOutput
Definition: MockInputOutput.h:29
SurgSim::DataStructures::OptionalValue< SurgSim::DataStructures::DataGroup >
SurgSim::Testing::MockInputOutput::m_numTimesInitializedInput
int m_numTimesInitializedInput
Definition: MockInputOutput.h:38
SurgSim::Input::InputConsumerInterface
Interface for a consumer that monitors device and signal state updates (pose, buttons, etc).
Definition: InputConsumerInterface.h:33
SurgSim::Testing::MockInputOutput::MockInputOutput
MockInputOutput()
Definition: MockInputOutput.cpp:25
InputConsumerInterface.h
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
OutputProducerInterface.h
SurgSim::Testing::MockInputOutput::initializeInput
virtual void initializeInput(const std::string &device, const SurgSim::DataStructures::DataGroup &inputData)
Set the initial input data group.
Definition: MockInputOutput.cpp:50
SurgSim::Testing::MockInputOutput::m_numTimesReceivedInput
int m_numTimesReceivedInput
Definition: MockInputOutput.h:39
OptionalValue.h
SurgSim::Testing::MockInputOutput::m_numTimesRequestedOutput
int m_numTimesRequestedOutput
Definition: MockInputOutput.h:40