Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
FileWatcherManager.cpp
Go to the documentation of this file.
1
2
5
6namespace Divide {
7 namespace {
8 constexpr U32 g_updateFrameInterval = 60;
9 }
10
12
14 s_fileWatchers.emplace_back(std::make_pair( std::make_unique<FileWatcher>(), g_updateFrameInterval));
15 s_fileWatchers.back().first->_impl = std::make_unique<FW::FileWatcher>();
16 return *s_fileWatchers.back().first;
17 }
18
21 }
22
24 s_fileWatchers.erase(
25 std::remove_if(std::begin(s_fileWatchers), std::end(s_fileWatchers),
26 [fileWatcherGUID](const auto& it) noexcept
27 -> bool { return it.first->getGUID() == fileWatcherGUID; }),
28 std::end(s_fileWatchers));
29 }
30
32 // Expensive: update just once every few frame
33 for (auto& [fw, counter] : s_fileWatchers) {
34 if (--counter == 0u) {
35 counter = g_updateFrameInterval;
36 (*fw)().update();
37 return;
38 }
39 }
40 }
41}; //namespace Divide
#define NO_DESTROY
static void deallocateWatcher(I64 fileWatcherGUID)
static vector< std::pair< FileWatcher_uptr, U32 > > s_fileWatchers
static FileWatcher & allocateWatcher()
FORCE_INLINE I64 getGUID() const noexcept
Definition: GUIDWrapper.h:51
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
eastl::vector< Type > vector
Definition: Vector.h:42
int64_t I64
uint32_t U32