Atlas Game Manager
A game manager for f95 and dlsite written in c++
Loading...
Searching...
No Matches
Database.hpp
Go to the documentation of this file.
1//
2// Created by kj16609 on 1/12/23.
3//
4
5#pragma once
6#ifndef ATLAS_DATABASE_HPP
7#define ATLAS_DATABASE_HPP
8
9#include <filesystem>
10#include <mutex>
11#include <sqlite3.h>
12
13namespace internal
14{
15 using MtxType = std::mutex;
16 using LockGuardType = std::lock_guard< std::mutex >;
17} // namespace internal
18
20{
22 [[nodiscard]] static internal::MtxType& lock();
23
24 public:
25
27 static void initalize( const std::filesystem::path init_path );
29 static void deinit();
30
31 //static void update();
32
34 static sqlite3& ref();
35
36 private:
37
38 friend class Binder;
39};
40
41#endif //ATLAS_DATABASE_HPP
Definition Database.hpp:20
static internal::MtxType & lock()
Returns a ref to the global DB lock.
Definition Database.cpp:30
static void deinit()
Deinitalizes the DB.
Definition Database.cpp:79
friend class Binder
Definition Database.hpp:38
static void initalize(const std::filesystem::path init_path)
Initalizes the database with init_path. Does not have to be caonical.
Definition Database.cpp:35
static sqlite3 & ref()
Returns a ref to the sqlite DB.
Definition Database.cpp:22
Definition Database.cpp:17
std::mutex MtxType
Definition Database.hpp:15
std::lock_guard< std::mutex > LockGuardType
Definition Database.hpp:16