diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/nu/ServiceWatcher.h | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/nu/ServiceWatcher.h')
-rw-r--r-- | Src/nu/ServiceWatcher.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Src/nu/ServiceWatcher.h b/Src/nu/ServiceWatcher.h new file mode 100644 index 00000000..7eb4d3da --- /dev/null +++ b/Src/nu/ServiceWatcher.h @@ -0,0 +1,60 @@ +#pragma once +#include <api/service/api_service.h> +#include <api/syscb/callbacks/svccb.h> +#include <map> +#include <api/syscb/api_syscb.h> + +class ServiceWatcher : public SysCallback +{ +public: + ServiceWatcher() : serviceManager(0),systemCallbacks(0) {} + ~ServiceWatcher(); + + void WatchWith(api_service *_serviceApi); + + template <class T> + void WatchFor(T **ptr, GUID watchGUID) + { + WatchForT((void **)ptr, watchGUID); + } + void StopWatching(); + void Clear(); +private: + void WatchForT(void **ptr, GUID watchGUID); + typedef std::map<GUID, void **> WatchList; + WatchList watchList; + FOURCC GetEventType() { return SysCallback::SERVICE; } + int Notify(int msg, intptr_t param1, intptr_t param2); + api_service *serviceManager; + api_syscb *systemCallbacks; +protected: + RECVS_DISPATCH; +}; + +class ServiceWatcherSingle : public SysCallback +{ +public: + ServiceWatcherSingle() : serviceManager(0),systemCallbacks(0),service(0) {} + virtual ~ServiceWatcherSingle(); + void WatchWith(api_service *_serviceApi); + + template <class T> + void WatchFor(T **ptr, GUID watchGUID) + { + WatchForT((void **)ptr, watchGUID); + } + + virtual void OnRegister() {} + virtual void OnDeregister()=0; + void StopWatching(); +private: + void WatchForT(void **ptr, GUID watchGUID); + FOURCC GetEventType() { return SysCallback::SERVICE; } + int Notify(int msg, intptr_t param1, intptr_t param2); + api_service *serviceManager; + api_syscb *systemCallbacks; + void **service; + GUID serviceGUID; +protected: + RECVS_DISPATCH; +};
\ No newline at end of file |