Nebula
Loading...
Searching...
No Matches
resourceid.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
26//------------------------------------------------------------------------------
27#include "util/stringatom.h"
28#include "ids/id.h"
29#include "core/debug.h"
31namespace Resources
32{
34ID_24_8_24_8_NAMED_TYPE(ResourceId, loaderInstanceId, loaderIndex, resourceId, generation, loader, resource); // 24 bits: loader resource id, 8 bits: loader index, 24 bits: unique resource id, 8 bits: generation
35
36// define a generic typed ResourceId, this is so we can have specialized allocators, but have a common pool implementation...
37ID_24_8_NAMED_TYPE(ResourceUnknownId, resourceId, generation, id);
38
39} // namespace Resource
40
41#define RESOURCE_ID_TYPE(type) struct type : public Resources::ResourceUnknownId { \
42 constexpr type() {};\
43 constexpr type(const Resources::ResourceUnknownId& res) : Resources::ResourceUnknownId(res) {};\
44 constexpr type(const Resources::ResourceId& res) : Resources::ResourceUnknownId(res.resourceId, res.generation) {};\
45 constexpr type(const Ids::Id24 id, const Ids::Id8 generation) : Resources::ResourceUnknownId(id, generation) {};\
46 constexpr type(const Ids::Id32 id) : Resources::ResourceUnknownId(Ids::Index(id), Ids::Generation(id)) {};\
47 }; \
48 static constexpr type Invalid##type = Resources::InvalidResourceUnknownId;
A StringAtom.
Definition stringatom.h:22
Nebula debug macros.
#define ID_24_8_NAMED_TYPE(x, id24_name, id8_name, combined_name)
Definition id.h:109
#define ID_24_8_24_8_NAMED_TYPE(x, id24_0_name, id8_0_name, id24_1_name, id8_1_name, combined0_name, combined1_name)
Definition id.h:73
A resource is a container for some type of file which is loaded.
Definition resource.cc:9
Util::StringAtom ResourceName
Definition resourceid.h:33
Definition resourceid.h:37