JointVisitor.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Louis Langholtz https://github.com/louis-langholtz/PlayRho
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty. In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  * claim that you wrote the original software. If you use this software
14  * in a product, an acknowledgment in the product documentation would be
15  * appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  * misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  */
20 
21 #ifndef PLAYRHO_DYNAMICS_JOINTS_JOINTVISITOR_HPP
22 #define PLAYRHO_DYNAMICS_JOINTS_JOINTVISITOR_HPP
23 
24 namespace playrho {
25 namespace d2 {
26 
27 class RevoluteJoint;
28 class PrismaticJoint;
29 class DistanceJoint;
30 class PulleyJoint;
31 class TargetJoint;
32 class GearJoint;
33 class WheelJoint;
34 class WeldJoint;
35 class FrictionJoint;
36 class RopeJoint;
37 class MotorJoint;
38 
46 {
47 public:
48  virtual ~JointVisitor() = default;
49 
51  virtual void Visit(const RevoluteJoint& joint) = 0;
52 
54  virtual void Visit(RevoluteJoint& joint) = 0;
55 
57  virtual void Visit(const PrismaticJoint& joint) = 0;
58 
60  virtual void Visit(PrismaticJoint& joint) = 0;
61 
63  virtual void Visit(const DistanceJoint& joint) = 0;
64 
66  virtual void Visit(DistanceJoint& joint) = 0;
67 
69  virtual void Visit(const PulleyJoint& joint) = 0;
70 
72  virtual void Visit(PulleyJoint& joint) = 0;
73 
75  virtual void Visit(const TargetJoint& joint) = 0;
76 
78  virtual void Visit(TargetJoint& joint) = 0;
79 
81  virtual void Visit(const GearJoint& joint) = 0;
82 
84  virtual void Visit(GearJoint& joint) = 0;
85 
87  virtual void Visit(const WheelJoint& joint) = 0;
88 
90  virtual void Visit(WheelJoint& joint) = 0;
91 
93  virtual void Visit(const WeldJoint& joint) = 0;
94 
96  virtual void Visit(WeldJoint& joint) = 0;
97 
99  virtual void Visit(const FrictionJoint& joint) = 0;
100 
102  virtual void Visit(FrictionJoint& joint) = 0;
103 
105  virtual void Visit(const RopeJoint& joint) = 0;
106 
108  virtual void Visit(RopeJoint& joint) = 0;
109 
111  virtual void Visit(const MotorJoint& joint) = 0;
112 
114  virtual void Visit(MotorJoint& joint) = 0;
115 
116 protected:
117  JointVisitor() = default;
118 
120  JointVisitor(const JointVisitor& other) = default;
121 
123  JointVisitor(JointVisitor&& other) = default;
124 
126  JointVisitor& operator= (const JointVisitor& other) = default;
127 
129  JointVisitor& operator= (JointVisitor&& other) = default;
130 };
131 
134 {
135 public:
136  void Visit(const RevoluteJoint& j) override = 0;
137  void Visit(RevoluteJoint& j) override { Visit(static_cast<const RevoluteJoint&>(j)); }
138  void Visit(const PrismaticJoint& j) override = 0;
139  void Visit(PrismaticJoint& j) override { Visit(static_cast<const PrismaticJoint&>(j)); }
140  void Visit(const DistanceJoint& j) override = 0;
141  void Visit(DistanceJoint& j) override { Visit(static_cast<const DistanceJoint&>(j)); }
142  void Visit(const PulleyJoint& j) override = 0;
143  void Visit(PulleyJoint& j) override { Visit(static_cast<const PulleyJoint&>(j)); }
144  void Visit(const TargetJoint& j) override = 0;
145  void Visit(TargetJoint& j) override { Visit(static_cast<const TargetJoint&>(j)); }
146  void Visit(const GearJoint& j) override = 0;
147  void Visit(GearJoint& j) override { Visit(static_cast<const GearJoint&>(j)); }
148  void Visit(const WheelJoint& j) override = 0;
149  void Visit(WheelJoint& j) override { Visit(static_cast<const WheelJoint&>(j)); }
150  void Visit(const WeldJoint& j) override = 0;
151  void Visit(WeldJoint& j) override { Visit(static_cast<const WeldJoint&>(j)); }
152  void Visit(const FrictionJoint& j) override = 0;
153  void Visit(FrictionJoint& j) override { Visit(static_cast<const FrictionJoint&>(j)); }
154  void Visit(const RopeJoint& j) override = 0;
155  void Visit(RopeJoint& j) override { Visit(static_cast<const RopeJoint&>(j)); }
156  void Visit(const MotorJoint& j) override = 0;
157  void Visit(MotorJoint& j) override { Visit(static_cast<const MotorJoint&>(j)); }
158 };
159 
160 } // namespace d2
161 } // namespace playrho
162 
163 #endif // PLAYRHO_DYNAMICS_JOINTS_JOINTVISITOR_HPP