Merge pull request #22816 from CastagnaIT/fix_tx3g
[xbmc.git] / xbmc / ServiceManager.h
blob9c99811a4068b27e62adeadef2860ce0fb9571da
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "platform/Platform.h"
13 #include <memory>
15 namespace ADDON
17 class CAddonMgr;
18 class CBinaryAddonManager;
19 class CBinaryAddonCache;
20 class CVFSAddonCache;
21 class CServiceAddonManager;
22 class CRepositoryUpdater;
23 } // namespace ADDON
25 namespace PVR
27 class CPVRManager;
30 namespace PLAYLIST
32 class CPlayListPlayer;
35 class CContextMenuManager;
36 #ifdef HAS_PYTHON
37 class XBPython;
38 #endif
39 #if defined(HAS_FILESYSTEM_SMB)
40 namespace WSDiscovery
42 class IWSDiscovery;
44 #endif
45 class CDataCacheCore;
46 class CFavouritesService;
47 class CNetworkBase;
48 class CWinSystemBase;
49 class CPowerManager;
50 class CWeatherManager;
52 namespace KODI
54 namespace ADDONS
56 class CExtsMimeSupportList;
59 namespace GAME
61 class CControllerManager;
62 class CGameServices;
63 } // namespace GAME
65 namespace RETRO
67 class CGUIGameRenderManager;
69 } // namespace KODI
71 namespace MEDIA_DETECT
73 class CDetectDVDMedia;
76 namespace PERIPHERALS
78 class CPeripherals;
81 class CInputManager;
82 class CFileExtensionProvider;
83 class CPlayerCoreFactory;
84 class CDatabaseManager;
85 class CProfileManager;
86 class CEventLog;
87 class CMediaManager;
89 class CServiceManager
91 public:
92 CServiceManager();
93 ~CServiceManager();
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();
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();
121 /**\brief Get the platform object. This is save to be called after Init1() was called
123 CPlatform& GetPlatform();
124 KODI::GAME::CControllerManager& GetGameControllerManager();
125 KODI::GAME::CGameServices& GetGameServices();
126 KODI::RETRO::CGUIGameRenderManager& GetGameRenderManager();
127 PERIPHERALS::CPeripherals& GetPeripherals();
129 PLAYLIST::CPlayListPlayer& GetPlaylistPlayer();
130 int init_level = 0;
132 CFavouritesService& GetFavouritesService();
133 CInputManager& GetInputManager();
134 CFileExtensionProvider& GetFileExtensionProvider();
136 CPowerManager& GetPowerManager();
138 CWeatherManager& GetWeatherManager();
140 CPlayerCoreFactory& GetPlayerCoreFactory();
142 CDatabaseManager& GetDatabaseManager();
144 CMediaManager& GetMediaManager();
146 #if !defined(TARGET_WINDOWS) && defined(HAS_DVD_DRIVE)
147 MEDIA_DETECT::CDetectDVDMedia& GetDetectDVDMedia();
148 #endif
150 protected:
151 struct delete_dataCacheCore
153 void operator()(CDataCacheCore* p) const;
156 struct delete_contextMenuManager
158 void operator()(CContextMenuManager* p) const;
161 struct delete_favouritesService
163 void operator()(CFavouritesService* p) const;
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_DVD_DRIVE)
198 std::unique_ptr<MEDIA_DETECT::CDetectDVDMedia> m_DetectDVDType;
199 #endif