Go to the documentation of this file.
42 #ifndef GENCAM_EXCEPTION_H_
43 #define GENCAM_EXCEPTION_H_
67 GenericException(
const char* pDescription,
const char *pSourceFileName,
unsigned int SourceLine);
70 GenericException(
const char* pDescription,
const char *pSourceFileName,
unsigned int SourceLine,
const char* pExceptionType);
73 GenericException(
const char* pDescription,
const char *pSourceFileName,
unsigned int SourceLine,
const char *pEntryPoint,
const char *pErrorNodeName,
const char* pExceptionType);
79 virtual const char* GetSourceFileName()
const throw();
82 virtual unsigned int GetSourceLine()
const throw();
85 virtual const char *what()
const throw();
92 void AssembleMessage();
120 #define DECLARE_EXCEPTION( name ) \
121 class GCBASE_RTTI_CLASS_API name : public GENICAM_NAMESPACE::GenericException \
124 name( const char* pDescription, const char *pSourceFileName, int SourceLine ); \
125 name( const char* pDescription, const char *pSourceFileName, int SourceLine, const char* pExceptionType ); \
126 name( const char* pDescription, const char *pSourceFileName, int SourceLine, const char *pEntryPoint, const char *pErrorNodeName, const char* pExceptionType ); \
167 template <
typename E>
189 va_start(vap, pFormat);
191 # if defined (_MSC_VER)
192 vsnprintf_s(pBuffer,
sizeof pBuffer, _TRUNCATE, pFormat, vap);
194 vsnprintf( pBuffer,
sizeof pBuffer, pFormat, vap );
232 #define GENERIC_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<GENICAM_NAMESPACE::GenericException>(__FILE__, __LINE__).Report
235 #define BAD_ALLOC_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<GENICAM_NAMESPACE::BadAllocException>(__FILE__, __LINE__, "BadAllocException" ).Report
238 #define INVALID_ARGUMENT_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<GENICAM_NAMESPACE::InvalidArgumentException>(__FILE__, __LINE__, "InvalidArgumentException" ).Report
241 #define OUT_OF_RANGE_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<GENICAM_NAMESPACE::OutOfRangeException>(__FILE__, __LINE__, "OutOfRangeException" ).Report
244 #define PROPERTY_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<GENICAM_NAMESPACE::PropertyException>(__FILE__, __LINE__, "PropertyException" ).Report
247 #define RUNTIME_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<GENICAM_NAMESPACE::RuntimeException>(__FILE__, __LINE__, "RuntimeException" ).Report
250 #define LOGICAL_ERROR_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<GENICAM_NAMESPACE::LogicalErrorException>(__FILE__, __LINE__, "LogicalErrorException" ).Report
253 #define ACCESS_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<GENICAM_NAMESPACE::AccessException>(__FILE__, __LINE__, "AccessException" ).Report
256 #define TIMEOUT_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<GENICAM_NAMESPACE::TimeoutException>(__FILE__, __LINE__,"TimeoutException" ).Report
259 #define DYNAMICCAST_EXCEPTION GENICAM_NAMESPACE::ExceptionReporter<GENICAM_NAMESPACE::DynamicCastException>(__FILE__, __LINE__, "DynamicCastException" ).Report
262 #define CHECK_RANGE_I64(_Value, _Min, _Max, _Inc) \
263 if((int64_t)(_Value) < (int64_t)(_Min)) \
264 throw OUT_OF_RANGE_EXCEPTION("Value = %" FMT_I64 "d must be equal or greater than Min = %" FMT_I64 "d", (int64_t)(_Value), (int64_t)(_Min)); \
265 else if((int64_t)(_Value) > (int64_t)(_Max)) \
266 throw OUT_OF_RANGE_EXCEPTION("Value = %" FMT_I64 "d must be equal or smaller than Max = %" FMT_I64 "d", (int64_t)(_Value), (int64_t)(_Max)); \
267 else if ( 0 == _Inc ) \
268 throw LOGICAL_ERROR_EXCEPTION("Increment must not equal 0!"); \
269 else if( ((int64_t)(_Value) - (int64_t)(_Min)) % (int64_t)(_Inc) != 0) \
270 throw OUT_OF_RANGE_EXCEPTION("The difference between Value = %" FMT_I64 "d and Min = %" FMT_I64 "d must be dividable without rest by Inc = %" FMT_I64 "d", (int64_t)(_Value), (int64_t)(_Min), (int64_t)(_Inc));
273 #define CHECK_RANGE_FLT(_Value, _Min, _Max) \
274 if ((_Value) < (_Min)) \
275 throw OUT_OF_RANGE_EXCEPTION( "Value %f must be greater than or equal %f", (_Value), (_Min) ); \
276 else if ((_Value) > (_Max)) \
277 throw OUT_OF_RANGE_EXCEPTION( "Value %f must be smaller than or equal %f", (_Value), (_Max) );
280 #define CHECK_DYNAMIC_CAST_POINTER( _Pointer )\
281 assert( (_Pointer) != NULL ); \
282 if (NULL == (_Pointer)) throw LOGICAL_ERROR_EXCEPTION( "Unexpected type in dynamic cast" )
290 #endif // GENCAM_EXCEPTION_H_
ExceptionReporter(const char *pSourceFileName, int SourceLine)
E Report(const std::string &s)
printf like creation of exceptions
A string class which is a clone of std::string.
GENICAM_NAMESPACE::gcstring m_Description
Error description.
unsigned int m_SourceLine
Line number at which the error occurred.
GENICAM_NAMESPACE::gcstring m_SourceFileName
the path to the source file where the exception is thrown
ExceptionReporter(const char *pSourceFileName, int SourceLine, const char *pExceptionType)
virtual GENICAM_NAMESPACE::gcstring GetDescription() const =0
Get a long description of the node.
GENICAM_NAMESPACE::gcstring m_ExceptionType
The full error message.
DECLARE_EXCEPTION(BadAllocException)
E Report(const std::stringstream &str)
GenICam's exception class.
GENICAM_NAMESPACE::gcstring m_EntryPoint
Node and method where the call stack entered the node map (may be empty)
Platform-dependent type definitions.
GENICAM_NAMESPACE::gcstring m_SourceFileName
Filename in which the error occurred.
Project wide definitions for compatibility.
virtual const char * c_str(void) const
GENICAM_NAMESPACE::gcstring m_What
The full error message.
E Report(const char *pFormat,...)
int m_SourceLine
The line within the source file where the exception is thrown.
GENICAM_NAMESPACE::gcstring m_ExceptionType
the type of the exception in string
Portable string implementation.
GENICAM_NAMESPACE::gcstring m_ErrorNodeName
Node where the error occurred (may be empty)
rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11