7#include <nlohmann/json_fwd.hpp>
34 Resource& operator=(
const Resource& other) =
delete;
36 Resource(Resource && other)
noexcept;
37 Resource& operator=(Resource && other)
noexcept;
41 const std::string&
name() const noexcept {
return m_name; }
44 uint64_t
uid() const noexcept {
return m_uid; }
47 uint64_t
version() const noexcept {
return m_version; }
50 bool isHidden() const noexcept {
return m_hidden; }
52 bool hasSource() const noexcept {
return m_source !=
nullptr; }
71 friend class ResourceManager;
74 uint64_t m_version = 1;
77 bool m_hidden =
false;
80 std::unique_ptr<nlohmann::json> m_source;
uint64_t uid() const noexcept
Process-unique id stamped by add(); names the asset, not the slot it sits in.
Definition resource.h:44
const std::string & name() const noexcept
Serializable identity; non-empty and unique within its type once added.
Definition resource.h:41
Resource(const Resource &other)
Duplicate other's contents and name, but not its identity.
nlohmann::json & sourceJson()
Mutable source JSON, allocating a null document if there is none.
uint64_t version() const noexcept
Change counter the backend keys GPU re-uploads on; moved by commit().
Definition resource.h:47
const nlohmann::json & sourceJson() const
Const source JSON; asserts hasSource(), so guard the call with it.
bool isHidden() const noexcept
Added by ResourceManager::addPrivate: not user-facing, not saved.
Definition resource.h:50