DriveElementFromInputBehavior.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_DRIVEELEMENTFROMINPUTBEHAVIOR_H
17 #define SURGSIM_BLOCKS_DRIVEELEMENTFROMINPUTBEHAVIOR_H
18 
21 
22 namespace SurgSim
23 {
24 
25 namespace Input
26 {
27 class InputComponent;
28 }
29 
30 namespace Blocks
31 {
32 
33 SURGSIM_STATIC_REGISTRATION(DriveElementFromInputBehavior);
34 
39 {
40 public:
43  explicit DriveElementFromInputBehavior(const std::string& name);
44 
46 
49  void setSource(std::shared_ptr<SurgSim::Framework::Component> source);
50 
53  std::shared_ptr<SurgSim::Framework::Component> getSource();
54 
57  void setPoseName(const std::string& poseName);
58 
61  std::string getPoseName();
62 
65  virtual void update(double dt);
66 
67 protected:
69  virtual bool doInitialize();
70 
72  virtual bool doWakeUp();
73 
74 private:
76  std::shared_ptr<SurgSim::Input::InputComponent> m_source;
77 
78  std::string m_poseName;
79 };
80 
81 
82 }; // namespace Blocks
83 
84 }; // namespace SurgSim
85 
86 
87 #endif // SURGSIM_BLOCKS_DRIVEELEMENTFROMINPUTBEHAVIOR_H
virtual bool doInitialize()
Initialize the behavior.
Definition: DriveElementFromInputBehavior.cpp:76
Definition: DriveElementFromInputBehavior.cpp:27
DriveElementFromInputBehavior(const std::string &name)
Constructor.
Definition: DriveElementFromInputBehavior.cpp:34
std::string m_poseName
Definition: DriveElementFromInputBehavior.h:78
SURGSIM_CLASSNAME(SurgSim::Blocks::DriveElementFromInputBehavior)
std::shared_ptr< SurgSim::Framework::Component > getSource()
Get the InputComponent which is being used by this behavior.
Definition: DriveElementFromInputBehavior.cpp:50
virtual void update(double dt)
Update the behavior.
Definition: DriveElementFromInputBehavior.cpp:65
InputComponent combines the Component interface and the InputConsumerInterface so that input devices ...
Definition: InputComponent.h:41
void setSource(std::shared_ptr< SurgSim::Framework::Component > source)
Set the InputComponent that provides the pose.
Definition: DriveElementFromInputBehavior.cpp:43
std::shared_ptr< SurgSim::Input::InputComponent > m_source
InputComponent to get the pose.
Definition: DriveElementFromInputBehavior.h:76
std::string getPoseName()
Get name of the pose.
Definition: DriveElementFromInputBehavior.cpp:60
void setPoseName(const std::string &poseName)
Set name of the pose.
Definition: DriveElementFromInputBehavior.cpp:55
virtual bool doWakeUp()
Wakeup the behavior, which copies the initial pose.
Definition: DriveElementFromInputBehavior.cpp:81
Behavior to copy a pose from an input component to a SceneElement By adding this behavior to a SceneE...
Definition: DriveElementFromInputBehavior.h:38
Behaviors perform actions.
Definition: Behavior.h:40
SURGSIM_STATIC_REGISTRATION(DriveElementFromInputBehavior)