DebugDumpBehavior.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_BLOCKS_DEBUGDUMPBEHAVIOR_H
17 #define SURGSIM_BLOCKS_DEBUGDUMPBEHAVIOR_H
18 
19 #include <memory>
21 
22 namespace SurgSim
23 {
24 namespace Input
25 {
26 
27 class InputComponent;
28 }
29 namespace Graphics
30 {
31 class OsgManager;
32 }
33 
34 namespace Blocks
35 {
36 
37 SURGSIM_STATIC_REGISTRATION(DebugDumpBehavior)
38 
39 class DebugDumpBehavior : public Framework::Behavior
45 {
46 
47 public:
48 
51  explicit DebugDumpBehavior(const std::string& name);
52 
53  virtual ~DebugDumpBehavior();
54 
56 
59  void setInputComponent(std::shared_ptr<SurgSim::Framework::Component> inputComponent);
60 
62  std::shared_ptr<SurgSim::Input::InputComponent> getInputComponent() const;
63 
64 private:
65 
66  void update(double dt) override;
67 
68  bool doInitialize() override;
69 
70  bool doWakeUp() override;
71 
72  std::weak_ptr<SurgSim::Graphics::OsgManager> m_manager;
73  std::shared_ptr<SurgSim::Input::InputComponent> m_inputComponent;
75 };
76 
77 }
78 }
79 
80 #endif
SurgSim::Blocks::DebugDumpBehavior::m_inputComponent
std::shared_ptr< SurgSim::Input::InputComponent > m_inputComponent
The input component for reading.
Definition: DebugDumpBehavior.h:73
SurgSim::Blocks::DebugDumpBehavior::m_manager
std::weak_ptr< SurgSim::Graphics::OsgManager > m_manager
Reference to the graphics manager.
Definition: DebugDumpBehavior.h:72
SurgSim::Blocks::DebugDumpBehavior::doInitialize
bool doInitialize() override
Interface to be implemented by derived classes.
Definition: DebugDumpBehavior.cpp:136
SurgSim::Input::InputComponent
InputComponents connect devices to SceneElements, facilitating data transfer from a device to SceneEl...
Definition: InputComponent.h:38
SurgSim::Blocks::DebugDumpBehavior
Provides keyboard access to debugging functionality F1 - call the graphics manager dumpDebugInfo,...
Definition: DebugDumpBehavior.h:44
SurgSim::Blocks::DebugDumpBehavior::m_keyPressedLastUpdate
bool m_keyPressedLastUpdate
prevent a repeated keystroke
Definition: DebugDumpBehavior.h:74
SurgSim::Blocks::DebugDumpBehavior::doWakeUp
bool doWakeUp() override
Interface to be implemented by derived classes.
Definition: DebugDumpBehavior.cpp:155
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Blocks::DebugDumpBehavior::DebugDumpBehavior
DebugDumpBehavior(const std::string &name)
Constructor.
Definition: DebugDumpBehavior.cpp:39
SurgSim::Blocks::DebugDumpBehavior::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Blocks::DebugDumpBehavior)
SurgSim::Blocks::DebugDumpBehavior::~DebugDumpBehavior
virtual ~DebugDumpBehavior()
Definition: DebugDumpBehavior.cpp:47
SurgSim::Blocks::DebugDumpBehavior::update
void update(double dt) override
Update the behavior.
Definition: DebugDumpBehavior.cpp:65
SurgSim::Blocks::DebugDumpBehavior::getInputComponent
std::shared_ptr< SurgSim::Input::InputComponent > getInputComponent() const
Definition: DebugDumpBehavior.cpp:60
SurgSim::Blocks::DebugDumpBehavior::setInputComponent
void setInputComponent(std::shared_ptr< SurgSim::Framework::Component > inputComponent)
Sets the InputComponent, needs to provide keystrokes.
Definition: DebugDumpBehavior.cpp:52
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
Behavior.h