AssetManager can store assets and serialize. More...
#include <AssetManager.hpp>
Public Member Functions | |
void | addExisting (std::vector< std::shared_ptr< Asset >> assets) |
std::shared_ptr< Asset > | get (const std::string &key) |
std::shared_ptr< const Asset > | get (const std::string &key) const |
std::vector< std::shared_ptr< Asset > > | getAll () |
std::vector< std::shared_ptr< const Asset > > | getAll () const |
void | remove (const std::string &key) |
void | serialize (AssetsMutable &assets, std::vector< std::uint8_t > &assetStorage, std::string prefix="") const |
Serializes. More... | |
std::shared_ptr< dai::Asset > | set (Asset asset) |
std::shared_ptr< dai::Asset > | set (const std::string &key, Asset asset) |
std::shared_ptr< dai::Asset > | set (const std::string &key, const dai::Path &path, int alignment=64) |
std::shared_ptr< dai::Asset > | set (const std::string &key, const std::vector< std::uint8_t > &data, int alignment=64) |
std::shared_ptr< dai::Asset > | set (const std::string &key, std::vector< std::uint8_t > &&data, int alignment=64) |
std::size_t | size () const |
Private Attributes | |
std::map< std::string, std::shared_ptr< Asset > > | assetMap |
AssetManager can store assets and serialize.
Definition at line 33 of file AssetManager.hpp.
void dai::AssetManager::addExisting | ( | std::vector< std::shared_ptr< Asset >> | assets | ) |
Adds all assets in an array to the AssetManager
assets | Vector of assets to add |
Definition at line 78 of file AssetManager.cpp.
std::shared_ptr< Asset > dai::AssetManager::get | ( | const std::string & | key | ) |
Definition at line 71 of file AssetManager.cpp.
std::shared_ptr< const Asset > dai::AssetManager::get | ( | const std::string & | key | ) | const |
Definition at line 64 of file AssetManager.cpp.
std::vector<std::shared_ptr<Asset> > dai::AssetManager::getAll | ( | ) |
std::vector< std::shared_ptr< Asset > > dai::AssetManager::getAll | ( | ) | const |
Definition at line 87 of file AssetManager.cpp.
void dai::AssetManager::remove | ( | const std::string & | key | ) |
Removes asset with key
key | Key of asset to remove |
Definition at line 107 of file AssetManager.cpp.
void dai::AssetManager::serialize | ( | AssetsMutable & | assets, |
std::vector< std::uint8_t > & | assetStorage, | ||
std::string | prefix = "" |
||
) | const |
Serializes.
Definition at line 111 of file AssetManager.cpp.
std::shared_ptr< dai::Asset > dai::AssetManager::set | ( | Asset | asset | ) |
Adds or overwrites an asset object to AssetManager.
asset | Asset to add |
Definition at line 15 of file AssetManager.cpp.
std::shared_ptr< dai::Asset > dai::AssetManager::set | ( | const std::string & | key, |
Asset | asset | ||
) |
Adds or overwrites an asset object to AssetManager with a specified key. Key value will be assigned to an Asset as well
key | Key under which the asset should be stored |
asset | Asset to store |
Definition at line 21 of file AssetManager.cpp.
std::shared_ptr< dai::Asset > dai::AssetManager::set | ( | const std::string & | key, |
const dai::Path & | path, | ||
int | alignment = 64 |
||
) |
Loads file into asset manager under specified key.
key | Key under which the asset should be stored |
path | Path to file which to load as asset |
alignment | [Optional] alignment of asset data in asset storage. Default is 64B |
Definition at line 29 of file AssetManager.cpp.
std::shared_ptr< dai::Asset > dai::AssetManager::set | ( | const std::string & | key, |
const std::vector< std::uint8_t > & | data, | ||
int | alignment = 64 |
||
) |
Loads file into asset manager under specified key.
key | Key under which the asset should be stored |
data | Asset data |
alignment | [Optional] alignment of asset data in asset storage. Default is 64B |
Definition at line 46 of file AssetManager.cpp.
std::shared_ptr< dai::Asset > dai::AssetManager::set | ( | const std::string & | key, |
std::vector< std::uint8_t > && | data, | ||
int | alignment = 64 |
||
) |
Definition at line 55 of file AssetManager.cpp.
std::size_t dai::AssetManager::size | ( | ) | const |
Definition at line 103 of file AssetManager.cpp.
|
private |
Definition at line 34 of file AssetManager.hpp.