1
0

main.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include "main.h"
  2. //#include "wac_download_http_receiver_factory.h"
  3. #include "wac_downloadManager.h"
  4. #include "bfc/platform/export.h"
  5. static Singleton2<api_downloadManager, DownloadManager> dlMgrFactory;
  6. static DownloadManager dlMgr;
  7. //static wa::Components::WAC_DownloadsFactory _wac_download_factory;
  8. static wa::Components::WAC_DownloadManager_Component _wac_downloadManager_Component;
  9. //wa::Factory::WAC_DownloadMabager_HTTPReceiver_Factory _wac_downloadManager_http_receiver_service;
  10. api_service *WASABI_API_SVC = 0;
  11. api_application *WASABI_API_APP = 0;
  12. api_config *AGAVE_API_CONFIG = 0;
  13. api_threadpool *WASABI_API_THREADPOOL = 0;
  14. void wa::Components::WAC_DownloadManager_Component::RegisterServices( api_service *p_service )
  15. {
  16. WASABI_API_SVC = p_service;
  17. ServiceBuild( WASABI_API_APP, applicationApiServiceGuid );
  18. ServiceBuild( AGAVE_API_CONFIG, AgaveConfigGUID );
  19. ServiceBuild( WASABI_API_THREADPOOL, ThreadPoolGUID );
  20. dlMgrFactory.Register( &dlMgr );
  21. //WASABI_API_SVC->service_register( &_wac_downloadManager_http_receiver_service );
  22. }
  23. void wa::Components::WAC_DownloadManager_Component::DeregisterServices( api_service *p_service )
  24. {
  25. Q_UNUSED( p_service )
  26. ServiceRelease( WASABI_API_APP, applicationApiServiceGuid );
  27. ServiceRelease( AGAVE_API_CONFIG, AgaveConfigGUID );
  28. dlMgr.Kill();
  29. dlMgrFactory.Deregister();
  30. ServiceRelease( WASABI_API_THREADPOOL, ThreadPoolGUID );
  31. //p_service->service_deregister( &_wac_downloadManager_http_receiver_service );
  32. }
  33. extern "C" WAC_DOWNLOAD_MANAGER_EXPORT ifc_wa5component * GetWinamp5SystemComponent()
  34. {
  35. return &_wac_downloadManager_Component;
  36. }
  37. #ifdef CBCLASS
  38. #undef CBCLASS
  39. #endif
  40. #define CBCLASS wa::Components::WAC_DownloadManager_Component
  41. START_DISPATCH;
  42. VCB( API_WA5COMPONENT_REGISTERSERVICES, RegisterServices )
  43. CB( API_WA5COMPONENT_REGISTERSERVICES_SAFE_MODE, RegisterServicesSafeModeOk )
  44. VCB( API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices )
  45. END_DISPATCH;
  46. #undef CBCLASS