coal  3.0.1
Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library
fwd.hh
Go to the documentation of this file.
1 //
2 // Software License Agreement (BSD License)
3 //
4 // Copyright (c) 2014, CNRS-LAAS
5 // Copyright (c) 2022-2024, Inria
6 // Author: Florent Lamiraux
7 //
8 // All rights reserved.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions
12 // are met:
13 //
14 // * Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 // * Redistributions in binary form must reproduce the above
17 // copyright notice, this list of conditions and the following
18 // disclaimer in the documentation and/or other materials provided
19 // with the distribution.
20 // * Neither the name of CNRS-LAAS nor the names of its
21 // contributors may be used to endorse or promote products derived
22 // from this software without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 // POSSIBILITY OF SUCH DAMAGE.
36 //
37 
38 #ifndef COAL_FWD_HH
39 #define COAL_FWD_HH
40 
41 #include <cassert>
42 #include <memory>
43 #include <sstream>
44 #include <stdexcept>
45 
46 #include "coal/config.hh"
47 #include "coal/deprecated.hh"
48 #include "coal/warning.hh"
49 
50 #if _WIN32
51 #define COAL_PRETTY_FUNCTION __FUNCSIG__
52 #else
53 #define COAL_PRETTY_FUNCTION __PRETTY_FUNCTION__
54 #endif
55 
56 #define COAL_UNUSED_VARIABLE(var) (void)(var)
57 
58 #ifdef NDEBUG
59 #define COAL_ONLY_USED_FOR_DEBUG(var) COAL_UNUSED_VARIABLE(var)
60 #else
61 #define COAL_ONLY_USED_FOR_DEBUG(var)
62 #endif
63 
64 #define COAL_THROW_PRETTY(message, exception) \
65  { \
66  std::stringstream ss; \
67  ss << "From file: " << __FILE__ << "\n"; \
68  ss << "in function: " << COAL_PRETTY_FUNCTION << "\n"; \
69  ss << "at line: " << __LINE__ << "\n"; \
70  ss << "message: " << message << "\n"; \
71  throw exception(ss.str()); \
72  }
73 
74 #ifdef COAL_TURN_ASSERT_INTO_EXCEPTION
75 #define COAL_ASSERT(check, message, exception) \
76  do { \
77  if (!(check)) { \
78  COAL_THROW_PRETTY(message, exception); \
79  } \
80  } while (0)
81 #else
82 #define COAL_ASSERT(check, message, exception) \
83  { \
84  assert((check) && message); \
85  }
86 #endif
87 
88 #if (__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
89 #define COAL_WITH_CXX11_SUPPORT
90 #endif
91 
92 #if defined(__GNUC__) || defined(__clang__)
93 #define COAL_COMPILER_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
94 #define COAL_COMPILER_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
95 #define COAL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS \
96  _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
97 
98 // GCC version 4.6 and higher supports -Wmaybe-uninitialized
99 #if (defined(__GNUC__) && \
100  ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
101 #define COAL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED \
102  _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
103 // Use __has_warning with clang. Clang introduced it in 2024 (3.5+)
104 #elif (defined(__clang__) && defined(__has_warning) && \
105  __has_warning("-Wmaybe-uninitialized"))
106 #define COAL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED \
107  _Pragma("clang diagnostic ignored \"-Wmaybe-uninitialized\"")
108 #else
109 #define COAL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
110 #endif
111 #elif defined(WIN32)
112 #define COAL_COMPILER_DIAGNOSTIC_PUSH _Pragma("warning(push)")
113 #define COAL_COMPILER_DIAGNOSTIC_POP _Pragma("warning(pop)")
114 #define COAL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS \
115  _Pragma("warning(disable : 4996)")
116 #define COAL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED \
117  _Pragma("warning(disable : 4700)")
118 #else
119 #define COAL_COMPILER_DIAGNOSTIC_PUSH
120 #define COAL_COMPILER_DIAGNOSTIC_POP
121 #define COAL_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
122 #define COAL_COMPILER_DIAGNOSTIC_IGNORED_MAYBE_UNINITIALIZED
123 #endif // __GNUC__
124 
125 namespace coal {
126 using std::dynamic_pointer_cast;
127 using std::make_shared;
128 using std::shared_ptr;
129 
130 class CollisionObject;
131 typedef shared_ptr<CollisionObject> CollisionObjectPtr_t;
132 typedef shared_ptr<const CollisionObject> CollisionObjectConstPtr_t;
133 class CollisionGeometry;
134 typedef shared_ptr<CollisionGeometry> CollisionGeometryPtr_t;
135 typedef shared_ptr<const CollisionGeometry> CollisionGeometryConstPtr_t;
136 class Transform3s;
137 
138 class AABB;
139 
140 class BVHModelBase;
141 typedef shared_ptr<BVHModelBase> BVHModelPtr_t;
142 
143 class OcTree;
144 typedef shared_ptr<OcTree> OcTreePtr_t;
145 typedef shared_ptr<const OcTree> OcTreeConstPtr_t;
146 } // namespace coal
147 
148 #ifdef COAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL
149 namespace hpp {
150 namespace fcl {
151 using namespace coal;
152 using Transform3f = Transform3s; // For backward compatibility
153 } // namespace fcl
154 } // namespace hpp
155 #endif
156 
157 #endif // COAL_FWD_HH
A class describing the AABB collision structure, which is a box in 3D space determined by two diagona...
Definition: AABB.h:55
A base class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewe...
Definition: BVH_model.h:66
The geometry for the object for collision or distance computation.
Definition: collision_object.h:96
Octree is one type of collision geometry which can encode uncertainty information in the sensor data.
Definition: octree.h:53
Simple transform class used locally by InterpMotion.
Definition: transform.h:55
Main namespace.
Definition: broadphase_bruteforce.h:44
shared_ptr< CollisionObject > CollisionObjectPtr_t
Definition: fwd.hh:130
shared_ptr< const CollisionObject > CollisionObjectConstPtr_t
Definition: fwd.hh:132
shared_ptr< CollisionGeometry > CollisionGeometryPtr_t
Definition: fwd.hh:133
shared_ptr< const OcTree > OcTreeConstPtr_t
Definition: fwd.hh:145
shared_ptr< OcTree > OcTreePtr_t
Definition: fwd.hh:143
shared_ptr< const CollisionGeometry > CollisionGeometryConstPtr_t
Definition: fwd.hh:135
shared_ptr< BVHModelBase > BVHModelPtr_t
Definition: fwd.hh:140