14 #ifndef __cplusplus_cli
15 #error ERROR: msclr libraries are not compatible with /clr:oldSyntax
21 namespace delegate_map {
34 if((proxy_type^)m_gc_managed_native_delegate_proxy !=
nullptr)
36 m_gc_managed_native_delegate_proxy->detach();
42 if((proxy_type^)m_gc_managed_native_delegate_proxy ==
nullptr)
44 m_gc_managed_native_delegate_proxy =
gcnew proxy_type(pNativeTarget);
55 #define BEGIN_DELEGATE_MAP(CLASS)\
56 ref class delegate_proxy_type;\
57 msclr::delegate_map::internal::delegate_proxy_factory<CLASS> m_delegate_map_proxy;\
59 ref class delegate_proxy_type\
61 CLASS* m_p_native_target;\
63 delegate_proxy_type(CLASS* pNativeTarget) : m_p_native_target(pNativeTarget) {}\
64 void detach() { m_p_native_target = NULL; }
66 #define EVENT_DELEGATE_ENTRY(MEMBER,ARG0,ARG1)\
67 void MEMBER(ARG0 arg0,ARG1 arg1)\
69 if(m_p_native_target == NULL)\
70 throw gcnew System::ArgumentNullException("Delegate call failed: Native sink was not attached or has already detached from the managed proxy (m_p_native_target == NULL). Hint: see if native sink was destructed or not constructed properly");\
72 m_p_native_target->MEMBER(arg0,arg1);\
75 #define END_DELEGATE_MAP()\
78 #define MAKE_DELEGATE(DELEGATE,MEMBER)\
79 gcnew DELEGATE(m_delegate_map_proxy.get_proxy(this),&delegate_proxy_type::MEMBER)
virtual ~delegate_proxy_factory()
Definition: event.h:32
ios_base &__CLRCALL_OR_CDECL internal(ios_base &_Iosbase)
Definition: ios:255
proxy_type get_proxy(CLASS *pNativeTarget)
Definition: event.h:40
CLASS::delegate_proxy_type proxy_type
Definition: event.h:26
delegate_proxy_factory()
Definition: event.h:30
gcroot< proxy_type^> m_gc_managed_native_delegate_proxy
Definition: event.h:27