Manager.h
资源名称:rnso.zip [点击查看]
上传用户:lianquan
上传日期:2007-01-02
资源大小:197k
文件大小:2k
源码类别:
ActiveX/DCOM/ATL
开发平台:
Visual C++
- //
- // Manager.h
- //
- #ifndef GenericManager_H_
- #define GenericManager_H_
- #include "..RnsoSupportObserverNotification.h"
- #include "..RnsoSupportCCriticalArray.h"
- class GenericObjectsIds
- {
- CArray<DWORD,DWORD> m_adwUsedIDs;
- LONG m_dwNextID;
- public:
- CArray<void*,void*> m_apObject;
- GenericObjectsIds();
- DWORD GenerateID(void * pObject);
- BOOL Find(DWORD dwID,void*& pObject);
- void RemoveObjects(void * pObject);
- };
- class GenericSubscription
- {
- public:
- DWORD m_dwObserver;
- DWORD m_dwSubject;
- void * m_pObserver;
- void * m_pSubject;
- GenericSubscription( DWORD dwObserverID,void * pObserver,
- DWORD dwSubjectID,void * pSubject);
- };
- class GenericManager
- {
- static HANDLE m_hThread;
- static DWORD m_ThreadId;
- static BOOL m_bContinueToRun;
- static CEvent m_evtStopThread;
- static CEvent m_evtNotification;
- static CCriticalSection m_csServer;
- static GenericObjectsIds m_aUsedObjectIDs;
- static CCriticalArray<GenericSubscription*,GenericSubscription*> m_aSubscriptions;
- static CCriticalArray<ObserverNotification*,ObserverNotification*> m_aNotifications;
- static void DispatchNotification(ObserverNotification *pNotification);
- static void RemoveSubscriptions(void * pObject);
- public:
- static void RemoveObject(void * pObject);
- static DWORD GenerateObjectID(BOOL& bOk,void * pObject);
- static BOOL AddSubscription(DWORD dwObserverID,DWORD dwSubjectID);
- static BOOL RemoveSubscription(DWORD m_dwObserverID,DWORD dwSubjectID,BOOL bAllSubjects);
- static BOOL AddNotification(ObserverNotification * pGenericNotification);
- static BOOL IsObserverSubscribedToSubject(DWORD dwObserverID,DWORD dwSubjectID);
- static BOOL FindObjectID(BSTR strname,DWORD * dwObjectID);
- static int FindName(CComBSTR bstr);
- static void StartManager();
- static void StopManager();
- static DWORD _stdcall ThreadProc( LPVOID lpParam ) ;
- };
- #endif