4#ifndef TRAM_SDK_FRAMEWORK_RESOURCE_H
5#define TRAM_SDK_FRAMEWORK_RESOURCE_H
72 explicit operator bool() {
return resource !=
nullptr; }
Definition: entitycomponent.h:18
size_t resources_waiting
Definition: entitycomponent.h:37
Definition: resource.h:12
name_t name
Definition: resource.h:38
void Load()
Definition: resource.h:33
name_t GetName() const
Definition: resource.h:23
void RemoveReference()
Definition: resource.h:28
Resource::Status GetStatus() const
Definition: resource.h:22
virtual void LoadFromDisk()=0
Resource(name_t name)
Definition: resource.h:20
Status
Definition: resource.h:14
@ LOADED
Definition: resource.h:16
@ READY
Definition: resource.h:17
@ UNLOADED
Definition: resource.h:15
bool IsLoadFailed() const
Definition: resource.h:25
size_t references
Definition: resource.h:40
virtual void LoadFromMemory()=0
Status status
Definition: resource.h:37
size_t GetReferences() const
Definition: resource.h:24
void AddReference()
Definition: resource.h:27
bool load_fail
Definition: resource.h:39
Definition: resource.h:47
T * operator->()
Definition: resource.h:70
Resource * resource
Definition: resource.h:75
void set(Resource *new_res)
Definition: resource.h:51
T & operator*()
Definition: resource.h:71
T * get()
Definition: resource.h:68
ResourceProxy(EntityComponent *parent)
Definition: resource.h:49
EntityComponent * parent
Definition: resource.h:74
~ResourceProxy()
Definition: resource.h:50
T * operator=(Resource *res)
Definition: resource.h:69
void CancelRequest(EntityComponent *requester, Resource *resource)
Cancels a resource load request.
Definition: async.cpp:53
void RequestResource(EntityComponent *requester, Resource *resource)
Adds a resource to the loading queue.
Definition: async.cpp:39