-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <includes.hpp> | ||
#include "fastfile_handlers.hpp" | ||
|
||
namespace fastfile { | ||
|
||
void* FFAssetPool::FindAssetHeader(size_t type, uint64_t name) { | ||
if (type >= pool.size()) return nullptr; | ||
auto it{ pool[type].find(name) }; | ||
if (it == pool[type].end()) return nullptr; | ||
return it->second; | ||
} | ||
|
||
void FFAssetPool::AddAssetHeader(size_t type, uint64_t name, void* header) { | ||
if (type >= pool.size()) { | ||
pool.resize(type + 1); | ||
} | ||
pool[type][name] = header; | ||
} | ||
|
||
void FFAssetPool::ClearRef() { | ||
pool.clear(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
namespace fastfile { | ||
|
||
class FFAssetPool { | ||
std::vector<std::unordered_map<uint64_t, void*>> pool{}; | ||
public: | ||
FFAssetPool() {}; | ||
|
||
void* FindAssetHeader(size_t type, uint64_t name); | ||
void AddAssetHeader(size_t type, uint64_t name, void* header); | ||
void ClearRef(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include <includes.hpp> | ||
#include <tools/fastfile.hpp> |