[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / DatabaseManager.h
blob258355ffd96079611cc9b14a748fe5bd30e40dd8
1 /*
2 * Copyright (C) 2012-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 "threads/CriticalSection.h"
13 #include <atomic>
14 #include <map>
15 #include <string>
17 class CDatabase;
18 class DatabaseSettings;
20 /*!
21 \ingroup database
22 \brief Database manager class for handling database updating
24 Ensures that databases used in XBMC are up to date, and if a database can't be
25 opened, ensures we don't continuously try it.
28 class CDatabaseManager
30 public:
31 CDatabaseManager();
32 CDatabaseManager(const CDatabaseManager&) = delete;
33 CDatabaseManager const& operator=(CDatabaseManager const&) = delete;
34 ~CDatabaseManager();
36 /*! \brief Initialize the database manager
37 Checks that all databases are up to date, otherwise updates them.
39 void Initialize();
41 /*! \brief Check whether we can open a database.
43 Checks whether the database has been updated correctly, if so returns true.
44 If the database update failed, returns false immediately.
45 If the database update is in progress, returns false.
47 \param name the name of the database to check.
48 \return true if the database can be opened, false otherwise.
50 bool CanOpen(const std::string &name);
52 bool IsUpgrading() const { return m_bIsUpgrading; }
54 void LocalizationChanged();
56 private:
57 std::atomic<bool> m_bIsUpgrading;
59 enum DB_STATUS { DB_CLOSED, DB_UPDATING, DB_READY, DB_FAILED };
60 void UpdateStatus(const std::string &name, DB_STATUS status);
61 void UpdateDatabase(CDatabase &db, DatabaseSettings *settings = NULL);
62 bool Update(CDatabase &db, const DatabaseSettings &settings);
63 bool UpdateVersion(CDatabase &db, const std::string &dbName);
65 CCriticalSection m_section; ///< Critical section protecting m_dbStatus.
66 std::map<std::string, DB_STATUS> m_dbStatus; ///< Our database status map.