openni_exception.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2011 Willow Garage, Inc.
00005  *
00006  *  All rights reserved.
00007  *
00008  *  Redistribution and use in source and binary forms, with or without
00009  *  modification, are permitted provided that the following conditions
00010  *  are met:
00011  *
00012  *   * Redistributions of source code must retain the above copyright
00013  *     notice, this list of conditions and the following disclaimer.
00014  *   * Redistributions in binary form must reproduce the above
00015  *     copyright notice, this list of conditions and the following
00016  *     disclaimer in the documentation and/or other materials provided
00017  *     with the distribution.
00018  *   * Neither the name of the copyright holder(s) nor the names of its
00019  *     contributors may be used to endorse or promote products derived
00020  *     from this software without specific prior written permission.
00021  *
00022  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033  *  POSSIBILITY OF SUCH DAMAGE.
00034  *
00035  */
00036 
00037 #include <pcl/pcl_config.h>
00038 #ifdef HAVE_OPENNI
00039 
00040 #ifndef __OPENNI_EXCEPTION__
00041 #define __OPENNI_EXCEPTION__
00042 
00043 #include <cstdarg>
00044 #include <cstdio>
00045 #include <exception>
00046 #include <string>
00047 //#include <pcl/pcl_macros.h> <-- because current header is included in NVCC-compiled code and contains <Eigen/Core>. Consider <pcl/pcl_exports.h>
00048 
00049 
00050 //fom <pcl/pcl_macros.h>
00051 #if defined _WIN32 && defined _MSC_VER && !defined __PRETTY_FUNCTION__
00052   #define __PRETTY_FUNCTION__ __FUNCTION__  
00053 #endif
00054 
00055 
00056 #define THROW_OPENNI_EXCEPTION(format,...) throwOpenNIException( __PRETTY_FUNCTION__, __FILE__, __LINE__, format , ##__VA_ARGS__ )
00057 
00058 
00059 namespace openni_wrapper
00060 {
00061 
00068   class OpenNIException : public std::exception
00069   {
00070   public:
00079     OpenNIException (const std::string& function_name, const std::string& file_name, unsigned line_number, const std::string& message) throw ();
00080 
00084     virtual ~OpenNIException () throw ();
00085 
00091     OpenNIException & operator= (const OpenNIException& exception) throw ();
00092 
00097     virtual const char* what () const throw ();
00098 
00102     const std::string& getFunctionName () const throw ();
00103 
00107     const std::string& getFileName () const throw ();
00108 
00112     unsigned getLineNumber () const throw ();
00113   protected:
00114     std::string function_name_;
00115     std::string file_name_;
00116     unsigned line_number_;
00117     std::string message_;
00118     std::string message_long_;
00119   } ;
00120 
00129   inline void
00130   throwOpenNIException (const char* function_name, const char* file_name, unsigned line_number, const char* format, ...)
00131   {
00132     static char msg[1024];
00133     va_list args;
00134     va_start (args, format);
00135     vsprintf (msg, format, args);
00136     throw OpenNIException (function_name, file_name, line_number, msg);
00137   }
00138 } // namespace openni_camera
00139 #endif
00140 #endif


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:26:23