Sink.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2015, 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_PARTICLES_SINK_H
17 #define SURGSIM_PARTICLES_SINK_H
18 
19 #include <memory>
20 
23 
24 
25 namespace SurgSim
26 {
27 
28 namespace Collision
29 {
30 class Representation;
31 };
32 
33 namespace Framework
34 {
35 class Component;
36 class Logger;
37 };
38 
39 namespace Particles
40 {
41 
42 class Representation;
43 
44 SURGSIM_STATIC_REGISTRATION(Sink);
45 
48 {
49 public:
52  explicit Sink(const std::string& name);
53 
55 
58  void setTarget(const std::shared_ptr<SurgSim::Framework::Component>& target);
59 
62  std::shared_ptr<SurgSim::Framework::Component> getTarget();
63 
67  void setCollisionRepresentation(const std::shared_ptr<SurgSim::Framework::Component>& representation);
68 
72  std::shared_ptr<SurgSim::Framework::Component> getCollisionRepresentation();
73 
74  void update(double dt) override;
75 
76  int getTargetManagerType() const override;
77 
78 private:
79  bool doInitialize() override;
80 
81  bool doWakeUp() override;
82 
83  std::shared_ptr<SurgSim::Collision::Representation> m_collisionRepresentation;
84 
85  std::shared_ptr<SurgSim::Particles::Representation> m_target;
86 
87  std::shared_ptr<SurgSim::Framework::Logger> m_logger;
88 };
89 
90 };
91 };
92 
93 #endif // SURGSIM_PARTICLES_SINK_H
94 
SurgSim::Particles::Sink::getTarget
std::shared_ptr< SurgSim::Framework::Component > getTarget()
Get the target removing particles from.
Definition: Sink.cpp:51
SurgSim::Particles::Sink::getTargetManagerType
int getTargetManagerType() const override
Specifies which manger will handle this behavior.
Definition: Sink.cpp:100
SurgSim::Particles::Sink::update
void update(double dt) override
Update the behavior.
Definition: Sink.cpp:87
SurgSim::Framework::Behavior
Behaviors perform actions.
Definition: Behavior.h:40
SurgSim::Particles::Sink::Sink
Sink(const std::string &name)
Constructor.
Definition: Sink.cpp:35
SurgSim::Particles::Sink::m_logger
std::shared_ptr< SurgSim::Framework::Logger > m_logger
Definition: Sink.h:87
ObjectFactory.h
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Particles::Sink::m_target
std::shared_ptr< SurgSim::Particles::Representation > m_target
Definition: Sink.h:85
SurgSim::Particles::Sink::m_collisionRepresentation
std::shared_ptr< SurgSim::Collision::Representation > m_collisionRepresentation
Definition: Sink.h:83
SurgSim::Particles::Sink::getCollisionRepresentation
std::shared_ptr< SurgSim::Framework::Component > getCollisionRepresentation()
Get the collision representation for this Sink Particles that collide with this collision representat...
Definition: Sink.cpp:62
SurgSim::Particles::Sink::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Particles::Sink)
SurgSim::Particles::Sink::doInitialize
bool doInitialize() override
Interface to be implemented by derived classes.
Definition: Sink.cpp:67
SurgSim::Particles::Sink::doWakeUp
bool doWakeUp() override
Interface to be implemented by derived classes.
Definition: Sink.cpp:72
SurgSim::Particles::Sink
Sink removes particles from a ParticleSystem.
Definition: Sink.h:47
SurgSim::Particles::Sink::setTarget
void setTarget(const std::shared_ptr< SurgSim::Framework::Component > &target)
Set the target to remove particles from.
Definition: Sink.cpp:45
SurgSim::Particles::Particles
DataStructures::Vertices< ParticleData > Particles
Definition: Particles.h:53
Behavior.h
SurgSim::Particles::Sink::setCollisionRepresentation
void setCollisionRepresentation(const std::shared_ptr< SurgSim::Framework::Component > &representation)
Set the collision representation for this Sink Particles that collide with this collision representat...
Definition: Sink.cpp:56