Horizon Official Technical Documentation
PersistenceManager.hpp
Go to the documentation of this file.
1/***************************************************
2 * _ _ _ *
3 * | | | | (_) *
4 * | |_| | ___ _ __ _ _______ _ __ *
5 * | _ |/ _ \| '__| |_ / _ \| '_ \ *
6 * | | | | (_) | | | |/ / (_) | | | | *
7 * \_| |_/\___/|_| |_/___\___/|_| |_| *
8 ***************************************************
9 * This file is part of Horizon (c).
10 * Copyright (c) 2019 Sagun K. (sagunxp@gmail.com).
11 * Copyright (c) 2019 Horizon Dev Team.
12 *
13 * Base Author - Sagun K. (sagunxp@gmail.com)
14 *
15 * This library is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this library. If not, see <http://www.gnu.org/licenses/>.
27 **************************************************/
28
29#ifndef HORIZON_ZONE_PERSISTENCE_PERSISTENCEMANAGER
30#define HORIZON_ZONE_PERSISTENCE_PERSISTENCEMANAGER
33
34
35namespace Horizon
36{
37namespace Zone
38{
39 namespace Units
40 {
41 class Player;
42 }
44{
45public:
47 void initialize(int segment_number = 1) override;
48 void finalize() override;
49 void start();
50 void update(uint64_t diff);
51
52 bool is_initialized() override { return _is_initialized.load(); }
53 bool is_finalized() override { return _is_finalized.load(); }
54
55private:
56 std::thread _thread;
57 std::atomic<bool> _is_initialized{false};
58 std::atomic<bool> _is_finalized{false};
59
60protected:
64public:
66};
67}
68}
69#endif /* HORIZON_ZONE_PERSISTENCE_PERSISTENCEMANAGER */
Definition: PersistenceManager.hpp:44
std::atomic< bool > _is_finalized
Definition: PersistenceManager.hpp:58
void start()
Definition: PersistenceManager.cpp:64
std::atomic< bool > _is_initialized
Definition: PersistenceManager.hpp:57
void finalize() override
Definition: PersistenceManager.cpp:56
ResourceManager _resource_manager
Definition: PersistenceManager.hpp:63
void initialize(int segment_number=1) override
Definition: PersistenceManager.cpp:48
ResourceManager & get_resource_manager()
Definition: PersistenceManager.hpp:65
void update(uint64_t diff)
Definition: PersistenceManager.cpp:72
bool is_initialized() override
Definition: PersistenceManager.hpp:52
PersistenceManager()
Definition: PersistenceManager.cpp:42
bool is_finalized() override
Definition: PersistenceManager.hpp:53
std::thread _thread
Definition: PersistenceManager.hpp:56
Definition: Server.hpp:192
Definition: ReferenceListTest.cpp:114
Definition: Server.hpp:113
Definition: Element.hpp:7