xbmc
ServiceManager.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "platform/Platform.h"
12 
13 #include <memory>
14 
15 namespace ADDON
16 {
17 class CAddonMgr;
18 class CBinaryAddonManager;
19 class CBinaryAddonCache;
20 class CVFSAddonCache;
21 class CServiceAddonManager;
22 class CRepositoryUpdater;
23 } // namespace ADDON
24 
25 namespace PVR
26 {
27 class CPVRManager;
28 }
29 
30 namespace PLAYLIST
31 {
32 class CPlayListPlayer;
33 }
34 
36 #ifdef HAS_PYTHON
37 class XBPython;
38 #endif
39 #if defined(HAS_FILESYSTEM_SMB)
40 namespace WSDiscovery
41 {
42 class IWSDiscovery;
43 }
44 #endif
45 class CDataCacheCore;
46 class CFavouritesService;
47 class CNetworkBase;
48 class CWinSystemBase;
49 class CPowerManager;
50 class CWeatherManager;
51 
52 namespace KODI
53 {
54 namespace ADDONS
55 {
56 class CExtsMimeSupportList;
57 }
58 
59 namespace GAME
60 {
61 class CControllerManager;
62 class CGameServices;
63 } // namespace GAME
64 
65 namespace RETRO
66 {
67 class CGUIGameRenderManager;
68 }
69 } // namespace KODI
70 
71 namespace MEDIA_DETECT
72 {
73 class CDetectDVDMedia;
74 }
75 
76 namespace PERIPHERALS
77 {
78 class CPeripherals;
79 }
80 
81 class CInputManager;
83 class CPlayerCoreFactory;
84 class CDatabaseManager;
85 class CProfileManager;
86 class CEventLog;
87 class CMediaManager;
88 
90 {
91 public:
93  ~CServiceManager();
94 
95  bool InitForTesting();
96  bool InitStageOne();
97  bool InitStageTwo(const std::string& profilesUserDataFolder);
98  bool InitStageThree(const std::shared_ptr<CProfileManager>& profileManager);
99  void DeinitTesting();
100  void DeinitStageThree();
101  void DeinitStageTwo();
102  void DeinitStageOne();
103 
104  ADDON::CAddonMgr& GetAddonMgr();
105  ADDON::CBinaryAddonManager& GetBinaryAddonManager();
106  ADDON::CBinaryAddonCache& GetBinaryAddonCache();
107  KODI::ADDONS::CExtsMimeSupportList& GetExtsMimeSupportList();
108  ADDON::CVFSAddonCache& GetVFSAddonCache();
109  ADDON::CServiceAddonManager& GetServiceAddons();
110  ADDON::CRepositoryUpdater& GetRepositoryUpdater();
111  CNetworkBase& GetNetwork();
112 #ifdef HAS_PYTHON
113  XBPython& GetXBPython();
114 #endif
115 #if defined(HAS_FILESYSTEM_SMB)
116  WSDiscovery::IWSDiscovery& GetWSDiscovery();
117 #endif
118  PVR::CPVRManager& GetPVRManager();
119  CContextMenuManager& GetContextMenuManager();
120  CDataCacheCore& GetDataCacheCore();
123  CPlatform& GetPlatform();
124  KODI::GAME::CControllerManager& GetGameControllerManager();
125  KODI::GAME::CGameServices& GetGameServices();
126  KODI::RETRO::CGUIGameRenderManager& GetGameRenderManager();
127  PERIPHERALS::CPeripherals& GetPeripherals();
128 
129  PLAYLIST::CPlayListPlayer& GetPlaylistPlayer();
130  int init_level = 0;
131 
132  CFavouritesService& GetFavouritesService();
133  CInputManager& GetInputManager();
134  CFileExtensionProvider& GetFileExtensionProvider();
135 
136  CPowerManager& GetPowerManager();
137 
138  CWeatherManager& GetWeatherManager();
139 
140  CPlayerCoreFactory& GetPlayerCoreFactory();
141 
142  CDatabaseManager& GetDatabaseManager();
143 
144  CMediaManager& GetMediaManager();
145 
146 #if !defined(TARGET_WINDOWS) && defined(HAS_OPTICAL_DRIVE)
147  MEDIA_DETECT::CDetectDVDMedia& GetDetectDVDMedia();
148 #endif
149 
150 protected:
152  {
153  void operator()(CDataCacheCore* p) const;
154  };
155 
157  {
158  void operator()(CContextMenuManager* p) const;
159  };
160 
162  {
163  void operator()(CFavouritesService* p) const;
164  };
165 
166  std::unique_ptr<ADDON::CAddonMgr> m_addonMgr;
167  std::unique_ptr<ADDON::CBinaryAddonManager> m_binaryAddonManager;
168  std::unique_ptr<ADDON::CBinaryAddonCache> m_binaryAddonCache;
169  std::unique_ptr<KODI::ADDONS::CExtsMimeSupportList> m_extsMimeSupportList;
170  std::unique_ptr<ADDON::CVFSAddonCache> m_vfsAddonCache;
171  std::unique_ptr<ADDON::CServiceAddonManager> m_serviceAddons;
172  std::unique_ptr<ADDON::CRepositoryUpdater> m_repositoryUpdater;
173 #if defined(HAS_FILESYSTEM_SMB)
174  std::unique_ptr<WSDiscovery::IWSDiscovery> m_WSDiscovery;
175 #endif
176 #ifdef HAS_PYTHON
177  std::unique_ptr<XBPython> m_XBPython;
178 #endif
179  std::unique_ptr<PVR::CPVRManager> m_PVRManager;
180  std::unique_ptr<CContextMenuManager, delete_contextMenuManager> m_contextMenuManager;
181  std::unique_ptr<CDataCacheCore, delete_dataCacheCore> m_dataCacheCore;
182  std::unique_ptr<CPlatform> m_Platform;
183  std::unique_ptr<PLAYLIST::CPlayListPlayer> m_playlistPlayer;
184  std::unique_ptr<KODI::GAME::CControllerManager> m_gameControllerManager;
185  std::unique_ptr<KODI::GAME::CGameServices> m_gameServices;
186  std::unique_ptr<KODI::RETRO::CGUIGameRenderManager> m_gameRenderManager;
187  std::unique_ptr<PERIPHERALS::CPeripherals> m_peripherals;
188  std::unique_ptr<CFavouritesService, delete_favouritesService> m_favouritesService;
189  std::unique_ptr<CInputManager> m_inputManager;
190  std::unique_ptr<CFileExtensionProvider> m_fileExtensionProvider;
191  std::unique_ptr<CNetworkBase> m_network;
192  std::unique_ptr<CPowerManager> m_powerManager;
193  std::unique_ptr<CWeatherManager> m_weatherManager;
194  std::unique_ptr<CPlayerCoreFactory> m_playerCoreFactory;
195  std::unique_ptr<CDatabaseManager> m_databaseManager;
196  std::unique_ptr<CMediaManager> m_mediaManager;
197 #if !defined(TARGET_WINDOWS) && defined(HAS_OPTICAL_DRIVE)
198  std::unique_ptr<MEDIA_DETECT::CDetectDVDMedia> m_DetectDVDType;
199 #endif
200 };
Class - CAddonMgr Holds references to all addons, enabled or otherwise.
Definition: AddonManager.h:79
Definition: BinaryAddonCache.h:28
Definition: FavouritesService.h:20
Definition: ServiceManager.h:89
Definition: Application.h:64
Main input processing class.
Definition: InputManager.h:63
Definition: IWSDiscovery.h:13
Definition: ContextMenuManager.h:24
Definition: RetroPlayerInput.h:15
Definition: WinSystem.h:49
Definition: Network.h:40
Definition: PlayerCoreFactory.h:30
Definition: FileExtensionProvider.h:25
Database manager class for handling database updating.
Definition: DatabaseManager.h:28
Definition: GameServices.h:50
Definition: BinaryAddonManager.h:33
Definition: PowerManager.h:26
Definition: DataCacheCore.h:19
Definition: IWSDiscovery.h:15
Definition: EventLog.h:23
Definition: WeatherManager.h:80
Definition: RepositoryUpdater.h:34
Definition: MediaManager.h:34
Class to manage all available and activated add-ons and to release their types to the outside for sel...
Definition: ExtsMimeSupportList.h:42
Definition: ControllerManager.h:31
Definition: AudioDecoder.h:18
Definition: XBPython.h:52
Definition: ServiceManager.h:151
Definition: Application.h:59
Definition: Service.h:23
Definition: ProfileManager.h:25
Definition: ServiceManager.h:161
Class for the Platform object.
Definition: Platform.h:25
Class to safely route commands between the GUI and RetroPlayer.
Definition: GUIGameRenderManager.h:69
Definition: ContextMenuManager.h:31
Definition: PVRManager.h:96
Definition: Addon.cpp:39
Definition: VFSEntry.h:27
Definition: ServiceManager.h:156
Definition: PlayListPlayer.h:29
Definition: Peripherals.h:53