opensurgsim
AddSphereBehavior.h
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 EXAMPLES_ADDSPHEREFROMINPUT_ADDSPHEREBEHAVIOR_H
17 #define EXAMPLES_ADDSPHEREFROMINPUT_ADDSPHEREBEHAVIOR_H
18 
19 #include "SurgSim/Framework/Behavior.h"
20 #include "SurgSim/Input/InputComponent.h"
21 
23 {
24 public:
27  explicit AddSphereFromInputBehavior(const std::string& name);
28 
31  void setInputComponent(std::shared_ptr<SurgSim::Input::InputComponent> sender);
32 
35  void update(double dt) override;
36 
38  int getTargetManagerType() const override;
39 
40 protected:
42  bool doInitialize() override;
44  bool doWakeUp() override;
45 
46 private:
48  std::shared_ptr<SurgSim::Input::InputComponent> m_from;
49 
51  int m_numElements;
52 
54  bool m_buttonPreviouslyPressed;
55 };
56 
57 #endif // EXAMPLES_ADDSPHEREFROMINPUT_ADDSPHEREBEHAVIOR_H
Definition: AddSphereBehavior.h:22
bool doWakeUp() override
Wakeup the behavior.
Definition: AddSphereBehavior.cpp:78
int getTargetManagerType() const override
Return the type of manager that should be responsible for this behavior.
Definition: AddSphereBehavior.cpp:68
void setInputComponent(std::shared_ptr< SurgSim::Input::InputComponent > sender)
Set input component to get the pose.
Definition: AddSphereBehavior.cpp:33
void update(double dt) override
Update the behavior.
Definition: AddSphereBehavior.cpp:38
Behaviors perform actions.
Definition: Behavior.h:40
AddSphereFromInputBehavior(const std::string &name)
Constructor.
Definition: AddSphereBehavior.cpp:27
bool doInitialize() override
Initialize the behavior.
Definition: AddSphereBehavior.cpp:73