failed_at_this_configuration.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2019. Toyota Research Institute
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of CNRS-LAAS and AIST nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
37 #ifndef FCL_FAILED_AT_THIS_CONFIGURATION_H
38 #define FCL_FAILED_AT_THIS_CONFIGURATION_H
39 
40 #include <exception>
41 #include <iomanip>
42 #include <iostream>
43 #include <sstream>
44 #include <stdexcept>
45 #include <string>
46 
47 #include "fcl/export.h"
48 
49 namespace fcl {
50 namespace detail {
51 
64 class FCL_EXPORT FailedAtThisConfiguration final
65  : public std::exception {
66  public:
68  : std::exception(), message_(message) {}
69 
70  const char* what() const noexcept final { return message_.c_str(); }
71 
72  private:
74 };
75 
85 FCL_EXPORT void ThrowFailedAtThisConfiguration(
86  const std::string& message, const char* func, const char* file, int line);
87 
102 template <typename Shape1, typename Shape2, typename Solver, typename Pose>
103 void ThrowDetailedConfiguration(const Shape1& s1, const Pose& X_FS1,
104  const Shape2& s2, const Pose& X_FS2,
105  const Solver& solver, const std::exception& e) {
106  std::stringstream ss;
107  ss << std::setprecision(20);
108  ss << "Error with configuration"
109  << "\n Original error message: " << e.what()
110  << "\n Shape 1: " << s1
111  << "\n X_FS1\n" << X_FS1.matrix()
112  << "\n Shape 2: " << s2
113  << "\n X_FS2\n" << X_FS2.matrix()
114  << "\n Solver: " << solver;
115  throw std::logic_error(ss.str());
116 }
117 
118 } // namespace detail
119 } // namespace fcl
120 
121 #define FCL_THROW_FAILED_AT_THIS_CONFIGURATION(message) \
122  ::fcl::detail::ThrowFailedAtThisConfiguration(message, __func__, __FILE__, \
123  __LINE__)
124 
125 #endif // FCL_FAILED_AT_THIS_CONFIGURATION_H
fcl::detail::FailedAtThisConfiguration::what
const char * what() const noexcept final
Definition: failed_at_this_configuration.h:70
testing::internal::string
::std::string string
Definition: gtest-port.h:875
fcl::detail::ThrowFailedAtThisConfiguration
FCL_EXPORT void ThrowFailedAtThisConfiguration(const std::string &message, const char *func, const char *file, int line)
Definition: failed_at_this_configuration.cpp:8
fcl::detail::FailedAtThisConfiguration::message_
std::string message_
Definition: failed_at_this_configuration.h:73
fcl::detail::FailedAtThisConfiguration::FailedAtThisConfiguration
FailedAtThisConfiguration(const std::string &message)
Definition: failed_at_this_configuration.h:67
Solver
Definition: svm.cpp:434
std
Definition: gtest-tuple.h:104
line
static char * line
Definition: svm.cpp:2902
fcl
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
fcl::detail::ThrowDetailedConfiguration
void ThrowDetailedConfiguration(const Shape1 &s1, const Pose &X_FS1, const Shape2 &s2, const Pose &X_FS2, const Solver &solver, const std::exception &e)
Definition: failed_at_this_configuration.h:103
fcl::detail::FailedAtThisConfiguration
Definition: failed_at_this_configuration.h:64


fcl
Author(s):
autogenerated on Fri Jun 11 2021 02:38:02