IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BaseException.h
1 // BaseException.h:
3 // ----------------
4 //
14 
15 #ifndef __IPSDKUTIL_BASEEXCEPTION_H__
16 #define __IPSDKUTIL_BASEEXCEPTION_H__
17 
18 // suppression warning
19 // warning C4251: 'ipsdk::BaseException::_msg' : class 'std::basic_string<_Elem,_Traits,_Ax>' nécessite une interface DLL pour être utilisé(e) par les clients de class 'ipsdk::BaseException'
20 // warning C4275: non dll-interface class 'boost::exception' used as base for dll-interface class 'ipsdk::BaseException'
21 #pragma warning (push)
22 #pragma warning (disable : 4251 4275)
23 
24 #include <exception>
25 #include <string>
27 #include <IPSDKUtil/BaseTypes.h>
28 #include <boost/scoped_ptr.hpp>
29 #include <boost/exception/exception.hpp>
30 
31 namespace ipsdk {
32 
35 
36 class IPSDKUTIL_API BaseException : public std::exception,
37  public boost::exception
38 {
39 public:
42 
44  BaseException();
45 
51  BaseException(const std::string& msg,
52  const char* functionName,
53  const char* filePath,
54  ipUInt32 lineIdx);
55 
62  BaseException(const std::string& msg,
63  const char* functionName,
64  const char* filePath,
65  ipUInt32 lineIdx,
66  const BaseException& exceptionFromReThrow);
67 
74  BaseException(const std::string& msg,
75  const char* functionName,
76  const char* filePath,
77  ipUInt32 lineIdx,
78  const std::exception& exceptionFromReThrow);
79 
81  BaseException(const BaseException& e);
82 
84  BaseException& operator= (const BaseException& e);
85 
87  virtual ~BaseException() throw();
88 
90 
91 // methodes
92 public:
94  const char* what() const throw();
95 
97  const std::string& getMsg() const;
98 
100  const char* getFunctionName() const;
101 
103  const char* getFilePath() const;
104 
106  ipUInt32 getLineIdx() const;
107 
110  const BaseException* getExcpFromReThrow() const;
111 
112 // attributs
113 protected:
115  std::string _msg;
116 
118  const char* _functionName;
119 
121  const char* _filePath;
122 
125 
127  typedef boost::scoped_ptr<BaseException> BaseExceptionPtr;
128 
131 };
132 
135 
136 inline const char*
138 {
139  return _msg.c_str();
140 }
141 
142 inline const std::string&
144 {
145  return _msg;
146 }
147 
148 inline const char*
150 {
151  return _functionName;
152 }
153 
154 inline const char*
156 {
157  return _filePath;
158 }
159 
160 inline ipUInt32
162 {
163  return _lineIdx;
164 }
165 
166 inline const ipsdk::BaseException*
168 {
169  return _pExcpFromReThrow.get();
170 }
171 
174 
175 } // end of namespace ipsdk
176 
177 #pragma warning (pop)
178 
179 #endif // __IPSDKUTIL_BASEEXCEPTION_H__
ipUInt32 getLineIdx() const
recovery of line number associated to exception
Definition: BaseException.h:161
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
BaseExceptionPtr _pExcpFromReThrow
previous exception from rethrow
Definition: BaseException.h:130
const char * _filePath
file path associated to exception
Definition: BaseException.h:121
Base exception class for IPSDK library.
Definition: BaseException.h:36
std::string _msg
message associed to exception
Definition: BaseException.h:115
const char * _functionName
function name associated to exception
Definition: BaseException.h:118
const char * getFunctionName() const
recovery of function name associated to exception
Definition: BaseException.h:149
Base types for multiplatform compatibility.
#define IPSDKUTIL_API
Import/Export macro for library IPSDKUtil.
Definition: IPSDKUtilExports.h:27
const BaseException * getExcpFromReThrow() const
recovery of pointer on previous exception
Definition: BaseException.h:167
ipUInt32 _lineIdx
line number associated to exception
Definition: BaseException.h:124
Definition of import/export macro for library.
boost::scoped_ptr< BaseException > BaseExceptionPtr
BaseException scoped pointer.
Definition: BaseException.h:127
const char * getFilePath() const
recovery of file path associated to exception
Definition: BaseException.h:155
const std::string & getMsg() const
recovery of error message associated to exception
Definition: BaseException.h:143
const char * what() const
recovery of error string associated to exception
Definition: BaseException.h:137
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53