MrSID Decode SDK for LiDAR Reference Manual  1.1.3.4427
Error.h
Go to the documentation of this file.
1 /* //////////////////////////////////////////////////////////////////////////
2 // //
3 // This code is Copyright (c) 2008-2010 LizardTech, Inc, 1008 Western //
4 // Avenue, Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
5 // prohibited. Access to and use of this code is permitted only under //
6 // license from LizardTech, Inc. Portions of the code are protected by //
7 // US and foreign patents and other filings. All Rights Reserved. //
8 // //
10 /* PUBLIC */
11 
12 #ifndef __LIDAR_ERROR_H__
13 #define __LIDAR_ERROR_H__
14 
15 #include "lidar/Base.h"
16 #include <exception>
17 
18 LT_BEGIN_LIDAR_NAMESPACE
19 
21 #define THROW_LIBRARY_ERROR(code) \
22  throw Error(__FILE__, __FUNCTION__, __LINE__, code)
23 
25 #define THROW_OS_ERROR() \
26  throw OSError(__FILE__, __FUNCTION__, __LINE__)
27 
31 class Error : public std::exception
32 {
33 public:
34  ~Error(void) throw();
35  Error(const Error &copy) throw();
36 
46  Error(const char *file, const char *func, int line, int code) throw();
47 
53  const char *filename(void) const throw();
59  const char *function(void) const throw();
65  int line(void) const throw();
71  int error(void) const throw();
72 
78  const char *what(void) const throw();
79 
87  Error &operator()(const char *fmt, ...) throw();
88 
89 protected:
90  enum { BUFFERSIZE = 1024 };
92  const char *m_file;
93  const char *m_func;
94  int m_line;
95  int m_error;
96 };
97 
102 class OSError : public Error
103 {
104 public:
116  OSError(const char *file, const char *func, int line) throw();
117 };
118 
119 LT_END_LIDAR_NAMESPACE
120 #endif // __LIDAR_ERROR_H__
Error & operator()(const char *fmt,...)
Append more text the error discription.
OSError extends Error by using errno or GetLastError() to build the text description of the error...
Definition: Error.h:102
int m_line
Definition: Error.h:94
Error is the base class for all LiDAR SDK errors.
Definition: Error.h:31
int line(void) const
Get the line number.
const char * filename(void) const
Get the file name.
OSError(const char *file, const char *func, int line)
Construct an OS error exception.
int m_error
Definition: Error.h:95
const char * m_func
Definition: Error.h:93
char m_desc[BUFFERSIZE]
Definition: Error.h:91
const char * what(void) const
Get the text description.
Error(const Error &copy)
const char * m_file
Definition: Error.h:92
int error(void) const
Get the error code.
~Error(void)

LizardTech