CGenericObserverNotifier.h
上传用户:lianquan
上传日期:2007-01-02
资源大小:197k
文件大小:1k
源码类别:

ActiveX/DCOM/ATL

开发平台:

Visual C++

  1. //
  2. // CGenericObserverNotifier.h
  3. //
  4. #ifndef CGenericObserverNotifier_H_
  5. #define CGenericObserverNotifier_H_
  6. #include "..RnsoSupportCCriticalArray.h"
  7. #include "..RnsoSupportObserverNotification.h"
  8. #include "..RnsoSupportRnsoNotificationRout.h"
  9. class AFX_EXT_CLASS CGenericObserverNotifier: 
  10. public CComObjectRootEx<CComMultiThreadModel>,
  11. public IDispatchImpl<IGenericObserverNotification,&IID_IGenericObserverNotification,&LIBID_RNSOLib>
  12. {
  13. public:
  14. HANDLE m_hThread;
  15. void FinalRelease( );
  16. HRESULT FinalConstruct( );
  17. BOOL m_bContinueToRun ;
  18. CEvent m_evtStartStopThread;
  19. CEvent m_evtStopThread;
  20. CEvent m_evtNotification;
  21. CCriticalArray<CNotificationFromManager*,CNotificationFromManager*> m_apNotifications;
  22. RnsoNotificationRout * m_pRouter;
  23. static DWORD   _stdcall ThreadStarter( LPVOID lpParam ) ;
  24. DWORD ThreadProc();
  25. void NotificationMessage(CNotificationFromManager * pNotification);
  26. void OnNotifyNOTIFY(ObserverNotification* pNotification);
  27. void OnNotifyNOTIFY_SUBJECTBROKEN(DWORD dwSubjectID);
  28. RnsoNotificationRout * SetNotificationRout(RnsoNotificationRout * pRout);
  29. CGenericObserverNotifier() {m_pRouter=NULL;}
  30. BEGIN_COM_MAP(CGenericObserverNotifier)
  31. COM_INTERFACE_ENTRY(IUnknown)
  32. COM_INTERFACE_ENTRY(IGenericObserverNotification)
  33. END_COM_MAP()
  34. STDMETHOD(OnNotify)(DWORD dwSenderSubject,LONG nSize,byte * pBytes);
  35. STDMETHOD(OnNotifySubjectBroken)(DWORD dwSubjectID);
  36. };
  37. #endif