123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #pragma once
- #include "service/ifc_servicefactory.h"
- #include "ReferenceCounted.h"
- template <class impl_t, class disp_t>
- class CountableObjectFactory : public ifc_serviceFactory
- {
- public:
- CountableObjectFactory()
- {
- }
- ~CountableObjectFactory()
- {
- }
- void Register(api_service *serviceManager)
- {
- serviceManager->Register(this);
- }
- void Deregister(api_service *serviceManager)
- {
- serviceManager->Unregister(this);
- }
- private:
- GUID WASABICALL ServiceFactory_GetServiceType() { return impl_t::GetServiceType(); }
- nx_string_t WASABICALL ServiceFactory_GetServiceName() { return impl_t::GetServiceName(); }
- GUID WASABICALL ServiceFactory_GetGUID() { return impl_t::GetServiceGUID(); }
- void *WASABICALL ServiceFactory_GetInterface() { return static_cast<disp_t *>(new ReferenceCounted<impl_t>); }
- int WASABICALL ServiceFactory_ServiceNotify(int msg, intptr_t param1 = 0, intptr_t param2 = 0) { return 0; }
- };
|