Point Cloud Library (PCL)
1.3.1
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2010-2011, Willow Garage, Inc. 00006 * 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * * Redistributions in binary form must reproduce the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer in the documentation and/or other materials provided 00018 * with the distribution. 00019 * * Neither the name of Willow Garage, Inc. nor the names of its 00020 * contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00029 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00033 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 * Author: Eitan Marder-Eppstein, Suat Gedikli (gedikli@willowgarage.com) 00037 */ 00038 #ifndef PCL_EXCEPTIONS_H_ 00039 #define PCL_EXCEPTIONS_H_ 00040 00041 #include <stdexcept> 00042 00043 namespace pcl 00044 { 00045 00049 class PCLException : public std::runtime_error 00050 { 00051 public: 00052 00053 PCLException (const std::string& error_description, 00054 const std::string& file_name = "", 00055 const std::string& function_name = "" , 00056 unsigned line_number = 0) throw () 00057 : std::runtime_error (error_description) 00058 , file_name_ (file_name) 00059 , function_name_ (function_name) 00060 , line_number_ (line_number) 00061 {} 00062 00063 virtual ~PCLException () throw () 00064 {} 00065 00066 const std::string& 00067 getFileName () const throw () 00068 { 00069 return file_name_; 00070 } 00071 00072 const std::string& 00073 getFunctionName () const throw () 00074 { 00075 return function_name_; 00076 } 00077 00078 unsigned 00079 getLineNumber () const throw () 00080 { 00081 return line_number_; 00082 } 00083 00084 std::string 00085 detailedMessage () const throw () 00086 { 00087 std::stringstream sstream; 00088 if (function_name_ != "") 00089 sstream << function_name_ << " "; 00090 00091 if (file_name_ != "") 00092 { 00093 sstream << "in " << file_name_ << " "; 00094 if (line_number_ != 0) 00095 sstream << "@ " << line_number_ << " "; 00096 } 00097 sstream << ":" << what (); 00098 00099 return sstream.str (); 00100 } 00101 00102 protected: 00103 std::string file_name_; 00104 std::string function_name_; 00105 unsigned line_number_; 00106 } ; 00107 00111 class InvalidConversionException : public PCLException 00112 { 00113 public: 00114 00115 InvalidConversionException (const std::string& error_description, 00116 const std::string& file_name = "", 00117 const std::string& function_name = "" , 00118 unsigned line_number = 0) throw () 00119 : pcl::PCLException (error_description, file_name, function_name, line_number) { } 00120 } ; 00121 00126 class IsNotDenseException : public PCLException 00127 { 00128 public: 00129 00130 IsNotDenseException (const std::string& error_description, 00131 const std::string& file_name = "", 00132 const std::string& function_name = "" , 00133 unsigned line_number = 0) throw () 00134 : pcl::PCLException (error_description, file_name, function_name, line_number) { } 00135 } ; 00136 00141 class InvalidSACModelTypeException : public PCLException 00142 { 00143 public: 00144 00145 InvalidSACModelTypeException (const std::string& error_description, 00146 const std::string& file_name = "", 00147 const std::string& function_name = "" , 00148 unsigned line_number = 0) throw () 00149 : pcl::PCLException (error_description, file_name, function_name, line_number) { } 00150 } ; 00151 00155 class IOException : public PCLException 00156 { 00157 public: 00158 00159 IOException (const std::string& error_description, 00160 const std::string& file_name = "", 00161 const std::string& function_name = "" , 00162 unsigned line_number = 0) throw () 00163 : pcl::PCLException (error_description, file_name, function_name, line_number) { } 00164 } ; 00165 } 00166 #endif