25 #ifndef __DOTS_LIBRARY_EXCEPTIONS_H__
26 #define __DOTS_LIBRARY_EXCEPTIONS_H__
28 #include <boost/noncopyable.hpp>
29 #include <boost/unordered_map.hpp>
30 #include <boost/thread/once.hpp>
35 #pragma warning (push)
36 #pragma warning (disable: 4251) // warning C4251: 'Safir::Dob::Typesystem::LibraryExceptions::m_CallbackMap' : class 'stdext::hash_map<_Kty,_Ty>' needs to have dll-interface to be used by clients of class 'Safir::Dob::Typesystem::LibraryExceptions'
37 #pragma warning (disable: 4275) // warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'Safir::Dob::Typesystem::LibraryExceptions'
40 #define CATCH_LIBRARY_EXCEPTIONS_AND_RUN(statement) \
41 catch (const Safir::Dob::Typesystem::FundamentalException & exc) \
42 {Safir::Dob::Typesystem::LibraryExceptions::Instance().Set(exc); statement;} \
43 catch (const Safir::Dob::Typesystem::Exception & exc) \
44 {Safir::Dob::Typesystem::LibraryExceptions::Instance().Set(exc); statement;} \
45 catch (const std::exception & exc) \
46 {Safir::Dob::Typesystem::LibraryExceptions::Instance().Set(exc); statement;} \
48 {Safir::Dob::Typesystem::LibraryExceptions::Instance().SetUnknown(); statement;}
50 #define CATCH_LIBRARY_EXCEPTIONS \
51 catch (const Safir::Dob::Typesystem::FundamentalException & exc) \
52 {Safir::Dob::Typesystem::LibraryExceptions::Instance().Set(exc);} \
53 catch (const Safir::Dob::Typesystem::Exception & exc) \
54 {Safir::Dob::Typesystem::LibraryExceptions::Instance().Set(exc);} \
55 catch (const std::exception & exc) \
56 {Safir::Dob::Typesystem::LibraryExceptions::Instance().Set(exc);} \
58 {Safir::Dob::Typesystem::LibraryExceptions::Instance().SetUnknown();}
71 private boost::noncopyable
168 void Set(
const std::exception & exception);
202 void AppendDescription(
const std::wstring & moreDescription);
223 typedef void (*ThrowExceptionCallback)(
const std::wstring & description);
234 {
return m_CallbackMap.insert(CallbackMap::value_type(exceptionId,throwFunction)).second;}
249 void Throw(
const TypeId exceptionId,
const std::string& description)
const;
258 typedef boost::unordered_map<TypeId, ThrowExceptionCallback> CallbackMap;
259 CallbackMap m_CallbackMap;
267 struct SingletonHelper
273 static boost::once_flag m_onceFlag;
281 #pragma warning (pop)
DotsC_TypeId TypeId
A unique type identifier.
Definition: Defs.h:218
This is the base class of all Fundamental Exceptions.
Definition: Exceptions.h:190
This namespace contains all the functionality and definitions of the SAFIR SDK.
Definition: Backdoor.h:30
static LibraryExceptions & Instance()
Get the instance of the singleton.
#define DOTS_CPP_API
Definition: Defs.h:33
Common functionality for the exception hierarchy of the DOB typesystem.
Definition: Exceptions.h:63
bool RegisterException(const TypeId exceptionId, ThrowExceptionCallback throwFunction)
Register an exception with the object factory.
Definition: LibraryExceptions.h:233
Contains methods used when passing exceptions across language boundaries.
Definition: LibraryExceptions.h:70
This is the base class of all (non-Fundamental) Exceptions.
Definition: Exceptions.h:223