Kohi Game Engine
khandle.h
Go to the documentation of this file.
1 
13 #ifndef _khandle_H_
14 #define _khandle_H_
15 
16 #include "defines.h"
17 #include "identifiers/identifier.h"
18 
19 #define INVALID_khandle INVALID_ID_U64
20 
25 typedef struct khandle {
31 
36 
39 
42 
45 
48 
51 
54 
56 KAPI b8 khandle_is_stale(khandle handle, u64 uniqueid);
57 
60 
67 typedef struct khandle16 {
76 
81 
84 
87 
90 
93 
96 
99 
102 
105 
106 #endif
This file contains global type definitions which are used throughout the entire engine and applicatio...
#define KAPI
Import/export qualifier.
Definition: defines.h:205
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:25
_Bool b8
8-bit boolean type
Definition: defines.h:58
unsigned short u16
Unsigned 16-bit integer.
Definition: defines.h:22
unsigned long long u64
Unsigned 64-bit integer.
Definition: defines.h:28
Contains a system for creating numeric identifiers.
KAPI khandle khandle_create_with_u64_identifier(u32 handle_index, u64 uniqueid)
Creates and returns a handle based on the handle index provided, using the given u64 to create an ide...
KAPI khandle16 khandle16_invalid(void)
Creates and returns an invalid handle.
KAPI b8 khandle16_is_pristine(khandle16 handle, u16 uniqueid)
Indicates if the handle is pristine (i.e. not stale/outdated).
KAPI b8 khandle16_is_valid(khandle16 handle)
Indicates if the provided handle is valid.
KAPI void khandle_invalidate(khandle *handle)
Invalidates the provided handle.
KAPI b8 khandle16_is_stale(khandle16 handle, u16 uniqueid)
Indicates if the handle is stale/outdated).
KAPI b8 khandle_is_stale(khandle handle, u64 uniqueid)
Indicates if the handle is stale/outdated).
KAPI khandle khandle_invalid(void)
Creates and returns an invalid handle.
KAPI khandle khandle_create(u32 handle_index)
Creates and returns a handle with the given handle index. Also creates a new unique identifier.
KAPI khandle16 khandle16_create_with_u16_generation(u16 handle_index, u16 generation)
Creates and returns a handle based on the handle index provided, using the given u64 to create an ide...
KAPI khandle khandle_create_with_identifier(u32 handle_index, identifier id)
Creates and returns a handle based on the handle index and identifier provided.
KAPI b8 khandle_is_valid(khandle handle)
Indicates if the provided handle is valid.
KAPI void khandle16_update(khandle16 *handle)
Updates the provided handle, incrementing the generation.
struct khandle16 khandle16
KAPI b8 khandle_is_pristine(khandle handle, u64 uniqueid)
Indicates if the handle is pristine (i.e. not stale/outdated).
KAPI void khandle16_invalidate(khandle16 *handle)
Invalidates the provided handle.
KAPI b8 khandle_is_invalid(khandle handle)
Indicates if the provided handle is invalid.
KAPI b8 khandle16_is_invalid(khandle16 handle)
Indicates if the provided handle is invalid.
KAPI khandle16 khandle16_create(u16 handle_index)
Creates and returns a handle with the given handle index. Also creates a new unique identifier.
struct khandle khandle
A handle is a unique identifier used a system in the engine to avoid using raw pointers where possibl...
Definition: identifier.h:20
Definition: khandle.h:67
u16 handle_index
Index into a resource table. Considered invalid if == INVALID_ID_U16.
Definition: khandle.h:69
u16 generation
A generation used to indicate if a handle is stale. Typically incremented when a resource is updated....
Definition: khandle.h:74
A handle is a unique identifier used a system in the engine to avoid using raw pointers where possibl...
Definition: khandle.h:25
u32 handle_index
Index into a resource table. Considered null if == INVALID_ID.
Definition: khandle.h:27
identifier unique_id
A globally unique identifier.
Definition: khandle.h:29