MrSID Decode SDK for LiDAR Reference Manual  1.1.3.4427
Error.h
Go to the documentation of this file.
00001 /* //////////////////////////////////////////////////////////////////////////
00002 //                                                                         //
00003 // This code is Copyright (c) 2008-2010 LizardTech, Inc, 1008 Western      //
00004 // Avenue, Suite 200, Seattle, WA 98104.  Unauthorized use or distribution //
00005 // prohibited.  Access to and use of this code is permitted only under     //
00006 // license from LizardTech, Inc.  Portions of the code are protected by    //
00007 // US and foreign patents and other filings. All Rights Reserved.          //
00008 //                                                                         //
00010 /* PUBLIC */
00011 
00012 #ifndef __LIDAR_ERROR_H__
00013 #define __LIDAR_ERROR_H__
00014 
00015 #include "lidar/Base.h"
00016 #include <exception>
00017 
00018 LT_BEGIN_LIDAR_NAMESPACE
00019 
00021 #define THROW_LIBRARY_ERROR(code) \
00022    throw Error(__FILE__, __FUNCTION__, __LINE__, code)
00023 
00025 #define THROW_OS_ERROR() \
00026    throw OSError(__FILE__, __FUNCTION__, __LINE__)
00027 
00031 class Error : public std::exception
00032 {
00033 public:
00034    ~Error(void) throw();
00035    Error(const Error &copy) throw();
00036 
00046    Error(const char *file, const char *func, int line, int code) throw();
00047 
00053    const char *filename(void) const throw();
00059    const char *function(void) const throw();
00065    int line(void) const throw();
00071    int error(void) const throw();
00072 
00078    const char *what(void) const throw();
00079 
00087    Error &operator()(const char *fmt, ...) throw();
00088 
00089 protected:
00090    enum { BUFFERSIZE = 1024 };
00091    char m_desc[BUFFERSIZE];
00092    const char *m_file;
00093    const char *m_func;
00094    int m_line;
00095    int m_error;
00096 };
00097 
00102 class OSError : public Error
00103 {
00104 public:
00116    OSError(const char *file, const char *func, int line) throw();
00117 };
00118 
00119 LT_END_LIDAR_NAMESPACE
00120 #endif // __LIDAR_ERROR_H__