1
0

ComponentManagerBase.h 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include "nx/nxuri.h"
  3. #include "service/api_service.h"
  4. #include "component/ifc_component.h"
  5. #include "nu/PtrDeque.h"
  6. #include "component/ifc_component_sync.h"
  7. class ComponentManagerBase
  8. {
  9. public:
  10. void SetServiceAPI(api_service *service_api);
  11. int Load();
  12. protected:
  13. ComponentManagerBase();
  14. int LateLoad(ifc_component *mod);
  15. enum Phase
  16. {
  17. PHASE_INITIALIZE=0, /* components are still being added */
  18. PHASE_REGISTERED=1, /* RegisterServices() has been called on all components */
  19. PHASE_LOADING=2, /* OnLoading() has been called on all components */
  20. PHASE_LOADED=3, /* OnLoaded() has been called on all components */
  21. };
  22. Phase phase;
  23. typedef nu::PtrDeque<ifc_component> ComponentList;
  24. ComponentList components;
  25. api_service *service_api;
  26. ifc_component_sync *component_sync;
  27. private:
  28. /* your implementation needs to override this. You should call FreeLibrary(component->component_info.hModule); or dlclose(component->component_info.dl_handle); or similar */
  29. virtual void CloseComponent(ifc_component *component)=0;
  30. };