diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-05 00:03:10 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-05 00:03:10 +0100 |
commit | 8aa43f634c1a89f05681ffc5f3cd0a3477e50e71 (patch) | |
tree | a1321d75328da0952ba7bf294a8036f50debb60f /src/crepe/api/SaveManager.h | |
parent | d9e46281c1e24a5f23d779d314e5df87fa3317a3 (diff) | |
parent | cfb67ffddb9f4bb0357c2b9df4239bfee7364c5a (diff) |
added loopTimer to mediator and fixed update loop
Diffstat (limited to 'src/crepe/api/SaveManager.h')
-rw-r--r-- | src/crepe/api/SaveManager.h | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/src/crepe/api/SaveManager.h b/src/crepe/api/SaveManager.h deleted file mode 100644 index 3d8c852..0000000 --- a/src/crepe/api/SaveManager.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -#include <memory> - -#include "../ValueBroker.h" - -namespace crepe { - -class DB; - -/** - * \brief Save data manager - * - * This class provides access to a simple key-value store that stores - * - integers (8-64 bit, signed or unsigned) - * - real numbers (float or double) - * - string (std::string) - * - * The underlying database is a key-value store. - */ -class SaveManager { -public: - /** - * \brief Get a read/write reference to a value and initialize it if it does not yet exist - * - * \param key The value key - * \param default_value Value to initialize \c key with if it does not already exist in the - * database - * - * \return Read/write reference to the value - */ - template <typename T> - ValueBroker<T> get(const std::string & key, const T & default_value); - - /** - * \brief Get a read/write reference to a value - * - * \param key The value key - * - * \return Read/write reference to the value - * - * \note Attempting to read this value before it is initialized (i.e. set) will result in an - * exception - */ - template <typename T> - ValueBroker<T> get(const std::string & key); - - /** - * \brief Set a value directly - * - * \param key The value key - * \param value The value to store - */ - template <typename T> - void set(const std::string & key, const T & value); - - /** - * \brief Check if the save file has a value for this \c key - * - * \param key The value key - * - * \returns True if the key exists, or false if it does not - */ - bool has(const std::string & key); - -private: - SaveManager(); - virtual ~SaveManager() = default; - -private: - /** - * \brief Serialize an arbitrary value to STL string - * - * \tparam T Type of arbitrary value - * - * \returns String representation of value - */ - template <typename T> - std::string serialize(const T &) const noexcept; - - /** - * \brief Deserialize an STL string back to type \c T - * - * \tparam T Type of value - * \param value Serialized value - * - * \returns Deserialized value - */ - template <typename T> - T deserialize(const std::string & value) const noexcept; - -public: - // singleton - static SaveManager & get_instance(); - SaveManager(const SaveManager &) = delete; - SaveManager(SaveManager &&) = delete; - SaveManager & operator=(const SaveManager &) = delete; - SaveManager & operator=(SaveManager &&) = delete; - -private: - /** - * \brief Create an instance of DB and return its reference - * - * \returns DB instance - * - * This function exists because DB is a facade class, which can't directly be used in the API - * without workarounds - * - * TODO: better solution - */ - static DB & get_db(); -}; - -} // namespace crepe |