openni_exception.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011 Willow Garage, Inc.
5  * Suat Gedikli <gedikli@willowgarage.com>
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 Willow Garage, Inc. 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 #ifndef __OPENNI_EXCEPTION__
38 #define __OPENNI_EXCEPTION__
39 
40 #include <cstdarg>
41 #include <cstdio>
42 #include <exception>
43 #include <string>
44 
45 #if defined _WIN32 && defined _MSC_VER
46 # define __PRETTY_FUNCTION__ __FUNCTION__
47 #endif
48 #define THROW_OPENNI_EXCEPTION(format,...) throwOpenNIException( __PRETTY_FUNCTION__, __FILE__, __LINE__, format , ##__VA_ARGS__ )
49 
50 
51 namespace openni_wrapper
52 {
58 class OpenNIException : public std::exception
59 {
60 public:
61  OpenNIException (const std::string& function_name, const std::string& file_name, unsigned line_number, const std::string& message) throw ();
62  virtual ~OpenNIException () throw ();
63  OpenNIException & operator= (const OpenNIException& exception) throw ();
64  virtual const char* what () const throw ();
65 
66  const std::string& getFunctionName () const throw ();
67  const std::string& getFileName () const throw ();
68  unsigned getLineNumber () const throw ();
69 protected:
70  std::string function_name_;
71  std::string file_name_;
72  unsigned line_number_;
73  std::string message_;
74  std::string message_long_;
75 };
76 
77 inline void throwOpenNIException (const char* function, const char* file, unsigned line, const char* format, ...)
78 {
79  static char msg[1024];
80  va_list args;
81  va_start (args, format);
82  vsprintf (msg, format, args);
83  throw OpenNIException (function, file, line, msg);
84 }
85 } // namespace openni_camera
86 #endif
const std::string & getFunctionName() const
virtual const char * what() const
General exception class.
void throwOpenNIException(const char *function, const char *file, unsigned line, const char *format,...)
OpenNIException & operator=(const OpenNIException &exception)
const std::string & getFileName() const
OpenNIException(const std::string &function_name, const std::string &file_name, unsigned line_number, const std::string &message)


openni_camera
Author(s): Patrick Mihelich, Suat Gedikli, Radu Bogdan Rusu
autogenerated on Mon Jun 10 2019 14:15:53