Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
surface
3rdparty
poisson4
poisson_exceptions.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2019-, Open Perception, Inc.
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of the copyright holder(s) nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
*/
37
38
#pragma once
39
40
#include <stdexcept>
41
#include <sstream>
42
#include <boost/current_function.hpp>
43
44
/** POISSON_THROW_EXCEPTION is a helper macro to be used for throwing exceptions. e.g.
45
* POISSON_THROW_EXCEPTION (PoissonBadArgumentException, "[ERROR] B-spline up-sampling not supported for degree " << Degree);
46
*
47
* \note
48
* Adapted from PCL_THROW_EXCEPTION. We intentionally do not reuse PCL_THROW_EXCEPTION here
49
* to avoid introducing any dependencies on PCL in this 3rd party module.
50
*/
51
// NOLINTBEGIN(bugprone-macro-parentheses)
52
#define POISSON_THROW_EXCEPTION(ExceptionName, message) \
53
{ \
54
std::ostringstream s; \
55
s << message; \
56
throw ExceptionName(s.str(), __FILE__, BOOST_CURRENT_FUNCTION, __LINE__); \
57
}
58
// NOLINTEND(bugprone-macro-parentheses)
59
60
namespace
pcl
61
{
62
namespace
poisson
63
{
64
/** \class PoissonException
65
* \brief A base class for all poisson exceptions which inherits from std::runtime_error
66
*
67
* \note
68
* Adapted from PCLException. We intentionally do not reuse PCLException here
69
* to avoid introducing any dependencies on PCL in this 3rd party module.
70
*/
71
class
PoissonException
:
public
std::runtime_error
72
{
73
public
:
74
PoissonException
(
const
std::string& error_description,
75
const
char
* file_name =
nullptr
,
76
const
char
* function_name =
nullptr
,
77
unsigned
line_number = 0)
78
: std::runtime_error (
createDetailedMessage
(error_description,
79
file_name,
80
function_name,
81
line_number))
82
,
file_name_
(file_name)
83
,
function_name_
(function_name)
84
,
line_number_
(line_number)
85
{}
86
87
protected
:
88
static
std::string
89
createDetailedMessage
(
const
std::string& error_description,
90
const
char
* file_name,
91
const
char
* function_name,
92
unsigned
line_number)
93
{
94
std::ostringstream sstream;
95
if
(function_name)
96
sstream << function_name <<
' '
;
97
98
if
(file_name)
99
{
100
sstream <<
"in "
<< file_name <<
' '
;
101
if
(line_number)
102
sstream <<
"@ "
<< line_number <<
' '
;
103
}
104
sstream <<
": "
<< error_description;
105
106
return
(sstream.str ());
107
}
108
109
const
char
*
file_name_
;
110
const
char
*
function_name_
;
111
unsigned
line_number_
;
112
};
113
114
/** \class PoissonBadArgumentException
115
* \brief An exception that is thrown when the arguments number or type is wrong/unhandled.
116
*/
117
class
PoissonBadArgumentException
:
public
PoissonException
118
{
119
public
:
120
PoissonBadArgumentException
(
const
std::string& error_description,
121
const
char
* file_name =
nullptr
,
122
const
char
* function_name =
nullptr
,
123
unsigned
line_number = 0)
124
:
pcl
::
poisson
::
PoissonException
(error_description, file_name, function_name, line_number) {}
125
};
126
127
/** \class PoissonOpenMPException
128
* \brief An exception that is thrown when something goes wrong inside an openMP for loop.
129
*/
130
class
PoissonOpenMPException
:
public
PoissonException
131
{
132
public
:
133
PoissonOpenMPException
(
const
std::string& error_description,
134
const
char
* file_name =
nullptr
,
135
const
char
* function_name =
nullptr
,
136
unsigned
line_number = 0)
137
:
pcl
::
poisson
::
PoissonException
(error_description, file_name, function_name, line_number) {}
138
};
139
140
/** \class PoissonBadInitException
141
* \brief An exception that is thrown when initialization fails.
142
*/
143
class
PoissonBadInitException
:
public
PoissonException
144
{
145
public
:
146
PoissonBadInitException
(
const
std::string& error_description,
147
const
char
* file_name =
nullptr
,
148
const
char
* function_name =
nullptr
,
149
unsigned
line_number = 0)
150
:
pcl
::
poisson
::
PoissonException
(error_description, file_name, function_name, line_number) {}
151
};
152
}
153
}
pcl::poisson::PoissonBadArgumentException::PoissonBadArgumentException
PoissonBadArgumentException(const std::string &error_description, const char *file_name=nullptr, const char *function_name=nullptr, unsigned line_number=0)
Definition
poisson_exceptions.h:120
pcl::poisson::PoissonBadInitException::PoissonBadInitException
PoissonBadInitException(const std::string &error_description, const char *file_name=nullptr, const char *function_name=nullptr, unsigned line_number=0)
Definition
poisson_exceptions.h:146
pcl::poisson::PoissonException::line_number_
unsigned line_number_
Definition
poisson_exceptions.h:111
pcl::poisson::PoissonException::file_name_
const char * file_name_
Definition
poisson_exceptions.h:109
pcl::poisson::PoissonException::function_name_
const char * function_name_
Definition
poisson_exceptions.h:110
pcl::poisson::PoissonException::PoissonException
PoissonException(const std::string &error_description, const char *file_name=nullptr, const char *function_name=nullptr, unsigned line_number=0)
Definition
poisson_exceptions.h:74
pcl::poisson::PoissonException::createDetailedMessage
static std::string createDetailedMessage(const std::string &error_description, const char *file_name, const char *function_name, unsigned line_number)
Definition
poisson_exceptions.h:89
pcl::poisson::PoissonOpenMPException::PoissonOpenMPException
PoissonOpenMPException(const std::string &error_description, const char *file_name=nullptr, const char *function_name=nullptr, unsigned line_number=0)
Definition
poisson_exceptions.h:133
pcl::poisson
Definition
allocator.h:36
pcl
Definition
convolution.h:46