FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
timer_manager.hpp
1/*
2 * Copyright 2024 Guillaume Guillet
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _FGE_TIMER_MANAGER_HPP_INCLUDED
18#define _FGE_TIMER_MANAGER_HPP_INCLUDED
19
20#include "FastEngine/fge_extern.hpp"
21#include "FastEngine/C_callback.hpp"
22#include "FastEngine/C_timer.hpp"
23#include <memory>
24#include <string>
25
26namespace fge::timer
27{
28
29using TimerShared = std::shared_ptr<fge::Timer>;
30
41FGE_API void Init();
47FGE_API bool IsInit();
51FGE_API void Uninit();
52
56FGE_API void Notify();
57
64FGE_API fge::timer::TimerShared Create(fge::timer::TimerShared timer);
65
72FGE_API bool Destroy(fge::timer::TimerShared const& timer);
79FGE_API bool Remove(std::string const& timerName);
80
84FGE_API void RemoveAll();
85
92FGE_API bool Check(fge::timer::TimerShared const& timer);
99FGE_API bool Check(std::string const& timerName);
100
106FGE_API std::size_t GetTimerSize();
107
114FGE_API fge::timer::TimerShared Get(std::string const& timerName);
115
120} // namespace fge::timer
121
122#endif // _FGE_TIMER_MANAGER_HPP_INCLUDED
FGE_API void Uninit()
Un-init the timer manager.
FGE_API void Notify()
Notify the timer manager thread generally used after adding/updating a timer.
FGE_API void RemoveAll()
Destroy all timers.
FGE_API bool Destroy(fge::timer::TimerShared const &timer)
Destroy a timer with the given pointer.
FGE_API fge::timer::TimerShared Create(fge::timer::TimerShared timer)
Add a new timer to be handled by the thread.
FGE_API std::size_t GetTimerSize()
Get the total number of timers.
FGE_API fge::timer::TimerShared Get(std::string const &timerName)
Get the timer pointer with the given name.
FGE_API bool Remove(std::string const &timerName)
Destroy a timer with the given name.
FGE_API void Init()
Init the timer manager.
FGE_API bool IsInit()
Check if the timer manager is initialized.
FGE_API bool Check(fge::timer::TimerShared const &timer)
Check if the given timer pointer exist in the manager.