core::resource namespace

deals with resource creation, tracking, and managing.

classes

cache
represents a container of resources and their UID mappings
handle<...>
wraps around a resource for sharing and management purposes.

enums

state
represents the various states a resource can be in.
enum classclasspublicpublic

functions

create_shared<…>
public static
create<…>
creates a new resource based on the given UID resource.
public static
copy<…>
public static

Enum documentation

state { NOT_LOADED = 0, LOADING = 1, LOADED = 2, UNLOADING = 3, UNLOADED = 4, MISSING = -1, INVALID = -2 } represents the various states a resource can be in.

Function documentation

template<typename T>
static handle<T> core::resource::create_shared(cache& cache, const UID& uid)

Details

will either find the resource with the given UID, and return that, or create a new one using that UID. this function should be used for resources that might be shared (like gfx::material), co-owned in disconnected systems, or read-only.

The resulting resource keeps the UID you create it with, meaning it can be found again using this function.

template<typename T>
static handle<T> core::resource::create(cache& cache, const UID& uid)

Brief

creates a new resource based on the given UID resource.

Details

if this resource is disk-based it might speed up loading due to using the already cached value (todo) The resulting resource has a new UID.

template<typename T, typename... Args>
static handle<T> core::resource::copy(cache& cache, const handle<T>& source, Args && ... args)

Details

this will create a disconnected copy based on the source handle. This means that, for example, when the source gets destroyed, this copy will keep existing, and when changes happen to either the source or copy, the changes will not be applied to the other.