All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Representation.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_COLLISION_REPRESENTATION_H
17 #define SURGSIM_COLLISION_REPRESENTATION_H
18 
19 #include <list>
20 #include <memory>
21 #include <unordered_map>
22 
25 
26 namespace SurgSim
27 {
28 
29 namespace Math
30 {
31 class Shape;
32 };
33 
34 namespace Physics
35 {
36 class Representation;
37 };
38 
39 namespace Collision
40 {
41 struct Contact;
43 
44 typedef std::unordered_map<std::shared_ptr<SurgSim::Collision::Representation>,
45  std::list<std::shared_ptr<SurgSim::Collision::Contact>>> ContactMapType;
46 
53 {
54 public:
57  explicit Representation(const std::string& name);
58 
60  virtual ~Representation();
61 
64  virtual int getShapeType() const = 0;
65 
68  virtual const std::shared_ptr<SurgSim::Math::Shape> getShape() const = 0;
69 
74 
77  virtual void update(const double& dt);
78 
79 protected:
84 };
85 
86 
87 }; // namespace Collision
88 }; // namespace SurgSim
89 
90 #endif
virtual ~Representation()
Destructor.
Definition: Representation.cpp:29
virtual const std::shared_ptr< SurgSim::Math::Shape > getShape() const =0
Get the shape.
virtual int getShapeType() const =0
Get the shape type id.
std::unordered_map< std::shared_ptr< SurgSim::Collision::Representation >, std::list< std::shared_ptr< SurgSim::Collision::Contact > > > ContactMapType
Definition: Representation.h:42
virtual void update(const double &dt)
Update the representation.
Definition: Representation.cpp:39
SurgSim::DataStructures::BufferedValue< ContactMapType > m_collisions
A map which associates a list of contacts with each collision representation.
Definition: Representation.h:83
Representation(const std::string &name)
Constructor.
Definition: Representation.cpp:24
Wrapper class to use for the collision operation, handles its enclosed shaped and a possible local to...
Definition: Representation.h:52
Representations are manifestations of a SceneElement.
Definition: Representation.h:33
SurgSim::DataStructures::BufferedValue< ContactMapType > & getCollisions()
A map between collision representations and contacts.
Definition: Representation.cpp:34