ifc_servicefactory.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include "../foundation/dispatch.h"
  3. #include "../foundation/guid.h"
  4. #include "../nx/nxstring.h"
  5. // ----------------------------------------------------------------------------
  6. class NOVTABLE ifc_serviceFactory : public Wasabi2::Dispatchable
  7. {
  8. protected:
  9. ifc_serviceFactory() : Dispatchable(DISPATCHABLE_VERSION) {}
  10. ~ifc_serviceFactory() {}
  11. public:
  12. GUID GetServiceType() { return ServiceFactory_GetServiceType(); }
  13. nx_string_t GetServiceName() { return ServiceFactory_GetServiceName(); }
  14. GUID GetGUID() { return ServiceFactory_GetGUID(); }
  15. void *GetInterface() { return ServiceFactory_GetInterface(); }
  16. int ServiceNotify(int msg, intptr_t param1 = 0, intptr_t param2 = 0) { return ServiceFactory_ServiceNotify(msg, param1, param2); }
  17. // serviceNotify enums
  18. enum
  19. {
  20. ONREGISTERED=0, // init yourself here -- not all other services are registered yet
  21. ONSTARTUP=1, // everyone is initialized, safe to talk to other services
  22. ONAPPRUNNING=2, // app is showing and processing events
  23. ONBEFORESHUTDOWN=3, // system is about to shutdown, call WASABI2_API_APP->main_cancelShutdown() to cancel
  24. ONSHUTDOWN=4, // studio is shutting down, release resources from other services
  25. ONUNREGISTERED=5, // bye bye
  26. };
  27. enum
  28. {
  29. DISPATCHABLE_VERSION,
  30. };
  31. protected:
  32. virtual GUID WASABICALL ServiceFactory_GetServiceType()=0;
  33. virtual nx_string_t WASABICALL ServiceFactory_GetServiceName()=0;
  34. virtual GUID WASABICALL ServiceFactory_GetGUID()=0;
  35. virtual void *WASABICALL ServiceFactory_GetInterface()=0;
  36. virtual int WASABICALL ServiceFactory_ServiceNotify(int msg, intptr_t param1 = 0, intptr_t param2 = 0)=0;
  37. };