kodi
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;
52 
53 namespace KODI
54 {
55 namespace ADDONS
56 {
57 class CExtsMimeSupportList;
58 }
59 
60 namespace GAME
61 {
62 class CControllerManager;
63 class CGameServices;
64 } // namespace GAME
65 
66 namespace RETRO
67 {
68 class CGUIGameRenderManager;
69 }
70 } // namespace KODI
71 
72 namespace MEDIA_DETECT
73 {
74 class CDetectDVDMedia;
75 }
76 
77 namespace PERIPHERALS
78 {
79 class CPeripherals;
80 }
81 
82 class CInputManager;
84 class CPlayerCoreFactory;
85 class CDatabaseManager;
86 class CProfileManager;
87 class CEventLog;
88 class CMediaManager;
89 
91 {
92 public:
94  ~CServiceManager();
95 
96  bool InitForTesting();
97  bool InitStageOne();
98  bool InitStageTwo(const std::string& profilesUserDataFolder);
99  bool InitStageThree(const std::shared_ptr<CProfileManager>& profileManager);
100  void DeinitTesting();
101  void DeinitStageThree();
102  void DeinitStageTwo();
103  void DeinitStageOne();
104 
105  ADDON::CAddonMgr& GetAddonMgr();
106  ADDON::CBinaryAddonManager& GetBinaryAddonManager();
107  ADDON::CBinaryAddonCache& GetBinaryAddonCache();
108  KODI::ADDONS::CExtsMimeSupportList& GetExtsMimeSupportList();
109  ADDON::CVFSAddonCache& GetVFSAddonCache();
110  ADDON::CServiceAddonManager& GetServiceAddons();
111  ADDON::CRepositoryUpdater& GetRepositoryUpdater();
112  CNetworkBase& GetNetwork();
113 #ifdef HAS_PYTHON
114  XBPython& GetXBPython();
115 #endif
116 #if defined(HAS_FILESYSTEM_SMB)
117  WSDiscovery::IWSDiscovery& GetWSDiscovery();
118 #endif
119  PVR::CPVRManager& GetPVRManager();
120  CContextMenuManager& GetContextMenuManager();
121  CDataCacheCore& GetDataCacheCore();
124  CPlatform& GetPlatform();
125  KODI::GAME::CControllerManager& GetGameControllerManager();
126  KODI::GAME::CGameServices& GetGameServices();
127  KODI::RETRO::CGUIGameRenderManager& GetGameRenderManager();
128  PERIPHERALS::CPeripherals& GetPeripherals();
129 
130  PLAYLIST::CPlayListPlayer& GetPlaylistPlayer();
131  CSlideShowDelegator& GetSlideShowDelegator();
132  int init_level = 0;
133 
134  CFavouritesService& GetFavouritesService();
135  CInputManager& GetInputManager();
136  CFileExtensionProvider& GetFileExtensionProvider();
137 
138  CPowerManager& GetPowerManager();
139 
140  CWeatherManager& GetWeatherManager();
141 
142  CPlayerCoreFactory& GetPlayerCoreFactory();
143 
144  CDatabaseManager& GetDatabaseManager();
145 
146  CMediaManager& GetMediaManager();
147 
148 #if !defined(TARGET_WINDOWS) && defined(HAS_OPTICAL_DRIVE)
149  MEDIA_DETECT::CDetectDVDMedia& GetDetectDVDMedia();
150 #endif
151 
152 protected:
153  std::unique_ptr<ADDON::CAddonMgr> m_addonMgr;
154  std::unique_ptr<ADDON::CBinaryAddonManager> m_binaryAddonManager;
155  std::unique_ptr<ADDON::CBinaryAddonCache> m_binaryAddonCache;
156  std::unique_ptr<KODI::ADDONS::CExtsMimeSupportList> m_extsMimeSupportList;
157  std::unique_ptr<ADDON::CVFSAddonCache> m_vfsAddonCache;
158  std::unique_ptr<ADDON::CServiceAddonManager> m_serviceAddons;
159  std::unique_ptr<ADDON::CRepositoryUpdater> m_repositoryUpdater;
160 #if defined(HAS_FILESYSTEM_SMB)
161  std::unique_ptr<WSDiscovery::IWSDiscovery> m_WSDiscovery;
162 #endif
163 #ifdef HAS_PYTHON
164  std::unique_ptr<XBPython> m_XBPython;
165 #endif
166  std::unique_ptr<PVR::CPVRManager> m_PVRManager;
167  std::unique_ptr<CContextMenuManager> m_contextMenuManager;
168  std::unique_ptr<CDataCacheCore> m_dataCacheCore;
169  std::unique_ptr<CPlatform> m_Platform;
170  std::unique_ptr<PLAYLIST::CPlayListPlayer> m_playlistPlayer;
171  std::unique_ptr<KODI::GAME::CControllerManager> m_gameControllerManager;
172  std::unique_ptr<KODI::GAME::CGameServices> m_gameServices;
173  std::unique_ptr<KODI::RETRO::CGUIGameRenderManager> m_gameRenderManager;
174  std::unique_ptr<PERIPHERALS::CPeripherals> m_peripherals;
175  std::unique_ptr<CFavouritesService> m_favouritesService;
176  std::unique_ptr<CInputManager> m_inputManager;
177  std::unique_ptr<CFileExtensionProvider> m_fileExtensionProvider;
178  std::unique_ptr<CNetworkBase> m_network;
179  std::unique_ptr<CPowerManager> m_powerManager;
180  std::unique_ptr<CWeatherManager> m_weatherManager;
181  std::unique_ptr<CPlayerCoreFactory> m_playerCoreFactory;
182  std::unique_ptr<CDatabaseManager> m_databaseManager;
183  std::unique_ptr<CMediaManager> m_mediaManager;
184 #if !defined(TARGET_WINDOWS) && defined(HAS_OPTICAL_DRIVE)
185  std::unique_ptr<MEDIA_DETECT::CDetectDVDMedia> m_DetectDVDType;
186 #endif
187  std::unique_ptr<CSlideShowDelegator> m_slideShowDelegator;
188 };
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:90
Definition: Application.h:62
Main input processing class.
Definition: InputManager.h:68
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:40
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: Application.h:57
Definition: Service.h:23
Definition: ProfileManager.h:25
Definition: SlideShowDelegator.h:17
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: PlayListPlayer.h:29
Definition: Peripherals.h:56