MrSID Decode SDK for LiDAR Reference Manual  1.1.5.5244
Error.h
Go to the documentation of this file.
1 //
2 // This code is property of Celartem, Inc dba Extensis.
3 // Copyright (c) 1995-2023. All rights reserved.
4 // Use permitted only under license from Extensis.
5 //
6 /* PUBLIC */
7 
8 #ifndef __LIDAR_ERROR_H__
9 #define __LIDAR_ERROR_H__
10 
11 #include "lidar/Base.h"
12 #include <exception>
13 
14 LT_BEGIN_LIDAR_NAMESPACE
15 
17 #define THROW_LIBRARY_ERROR(code) \
18  throw LizardTech::Error(__FILE__, __FUNCTION__, __LINE__, code)
19 
21 #define THROW_OS_ERROR() \
22  throw LizardTech::OSError(__FILE__, __FUNCTION__, __LINE__)
23 
27 class Error : public std::exception
28 {
29 public:
30  ~Error(void) throw();
31  Error(const Error &copy) throw();
32 
42  Error(const char *file, const char *func, int line, int code) throw();
43 
49  const char *filename(void) const throw();
55  const char *function(void) const throw();
61  int line(void) const throw();
67  int error(void) const throw();
68 
74  const char *what(void) const throw();
75 
83  Error &operator()(const char *fmt, ...) throw();
84 
85 protected:
86  enum { BUFFERSIZE = 1024 };
88  const char *m_file;
89  const char *m_func;
90  int m_line;
91  int m_error;
92 };
93 
98 class OSError : public Error
99 {
100 public:
112  OSError(const char *file, const char *func, int line) throw();
113 };
114 
115 LT_END_LIDAR_NAMESPACE
116 #endif // __LIDAR_ERROR_H__
Error is the base class for all LiDAR SDK errors.
Definition: Error.h:28
int m_line
Definition: Error.h:90
const char * m_func
Definition: Error.h:89
const char * filename(void) const
Get the file name.
int error(void) const
Get the error code.
Error & operator()(const char *fmt,...)
Append more text the error discription.
Error(const char *file, const char *func, int line, int code)
Construct an error exception.
Error(const Error &copy)
const char * m_file
Definition: Error.h:88
@ BUFFERSIZE
Definition: Error.h:86
int m_error
Definition: Error.h:91
int line(void) const
Get the line number.
const char * what(void) const
Get the text description.
char m_desc[BUFFERSIZE]
Definition: Error.h:87
~Error(void)
OSError extends Error by using errno or GetLastError() to build the text description of the error.
Definition: Error.h:99
OSError(const char *file, const char *func, int line)
Construct an OS error exception.

Extensis