1
0

ServiceManager.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef NULLSOFT_SERVICEMANAGERH
  2. #define NULLSOFT_SERVICEMANAGERH
  3. #include <api/service/api_service.h>
  4. #include "../nu/AutoLock.h"
  5. #include <vector>
  6. #include <map>
  7. struct Counter;
  8. class ServiceManager : public api_service
  9. {
  10. public:
  11. ServiceManager();
  12. int service_register( waServiceFactory *svc );
  13. int service_deregister( waServiceFactory *svc );
  14. size_t service_getNumServices( FOURCC svc_type );
  15. waServiceFactory *service_enumService( FOURCC svc_type, size_t n );
  16. waServiceFactory *service_getServiceByGuid( GUID guid );
  17. int service_lock( waServiceFactory *owner, void *svcptr );
  18. int service_clientLock( void *svcptr );
  19. int service_release( void *svcptr );
  20. const char *service_getTypeName( FOURCC svc_type );
  21. int service_unlock( void *svcptr );
  22. int service_isvalid( FOURCC svctype, waServiceFactory *service );
  23. int service_compactDuplicates( waServiceFactory *me );
  24. protected:
  25. RECVS_DISPATCH;
  26. private:
  27. Nullsoft::Utility::LockGuard serviceGuard;
  28. typedef std::vector<waServiceFactory *> ServiceList;
  29. ServiceList services;
  30. std::vector<Counter *> locks;
  31. std::map<FOURCC, ServiceList *> services_by_type;
  32. };
  33. extern api_service *serviceManager;
  34. #endif