opensurgsim
ConstraintComponent.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 SURGSIM_PHYSICS_CONSTRAINTCOMPONENT_H
17 #define SURGSIM_PHYSICS_CONSTRAINTCOMPONENT_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include "SurgSim/Framework/Component.h"
23 
24 namespace SurgSim
25 {
26 namespace Physics
27 {
28 
29 class Constraint;
30 
33 {
34 public:
37  explicit ConstraintComponent(const std::string& name);
38 
40  virtual ~ConstraintComponent();
41 
44  void setConstraint(std::shared_ptr<Constraint> constraint);
45 
48  std::shared_ptr<Constraint> getConstraint() const;
49 
50 protected:
52  std::shared_ptr<Constraint> m_constraint;
53 
56  bool doInitialize() override;
57 
60  bool doWakeUp() override;
61 };
62 
63 }; // namespace SurgSim
64 }; // namespace Physics
65 
66 #endif // SURGSIM_PHYSICS_CONSTRAINTCOMPONENT_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
virtual ~ConstraintComponent()
Destructor.
Definition: ConstraintComponent.cpp:27
bool doInitialize() override
Initialize the component.
Definition: ConstraintComponent.cpp:41
Component is the main interface class to pass information to the system managers each will decide whe...
Definition: Component.h:42
std::shared_ptr< Constraint > m_constraint
The stored constraint.
Definition: ConstraintComponent.h:52
Component class for inserting constraints between physics representations into the scene...
Definition: ConstraintComponent.h:32
std::shared_ptr< Constraint > getConstraint() const
Get the constraint associated with this component.
Definition: ConstraintComponent.cpp:36
ConstraintComponent(const std::string &name)
Constructor.
Definition: ConstraintComponent.cpp:23
bool doWakeUp() override
Wakeup the component.
Definition: ConstraintComponent.cpp:46
void setConstraint(std::shared_ptr< Constraint > constraint)
Set the constraint associated with this component.
Definition: ConstraintComponent.cpp:31