3DiVi Face SDK  3.21.0
 Указатель Классы Пространства имен Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Свойства Группы
Error.h
См. документацию.
1 
9 #ifndef __PBIO_API__PBIO__ERROR_H_
10 #define __PBIO_API__PBIO__ERROR_H_
11 
12 #include <exception>
13 #include <sstream>
14 #include <string>
15 
16 #include <stdint.h>
17 
18 namespace pbio
19 {
20 
26 class Error : public std::exception
27 {
28 public:
29 
30  virtual ~Error() throw()
31  {
32  // nothing
33  }
34 
36 
37  Error(const uint32_t code, const std::string what)
38  {
39  _code = code;
40  _what = what;
41  }
42 
44 
60  virtual const char* what() const throw()
61  {
62  return _what.c_str();
63  }
64 
65 
81  uint32_t code() const throw()
82  {
83  return _code;
84  }
85 
86 private:
87  uint32_t _code;
88  std::string _what;
89 };
90 
91 } // pbio namespace
92 
93 
94 
95 #define PBI0x3dfb4fe3Assert( code, expr, description ) \
96  do \
97  { \
98  if(!(expr)) \
99  { \
100  throw pbio::Error( \
101  code, \
102  "Assertion '" #expr "' failed (" + std::string(description) + \
103  "), error code: " #code "."); \
104  } \
105  } while(0)
106 
107 
108 #endif // __PBIO_API__PBIO__ERROR_H_
Класс исключений, выбрасываемых при возникновении ошибок.
Definition: Error.h:26
virtual const char * what() const
Получить строку с описанием ошибки.
Definition: Error.h:60
uint32_t code() const
Получить код ошибки.
Definition: Error.h:81