Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kMemory.h
Go to the documentation of this file.
1 
10 #ifndef K_API_MEMORY_H
11 #define K_API_MEMORY_H
12 
13 #include <kApi/kApiDef.h>
14 
15 kBeginHeader()
16 
17 
23 //typedef kStream kMemory; --forward-declared in kApiDef.x.h
24 
25 
35 kFx(kStatus) kMemory_Construct(kMemory* memory, kAlloc allocator);
36 
48 kFx(kStatus) kMemory_Attach(kMemory memory, void* buffer, kSize position, kSize length, kSize capacity);
49 
58 kFx(kStatus) kMemory_Allocate(kMemory memory, kSize initialCapacity);
59 
67 kFx(k64u) kMemory_Length(kMemory memory);
68 
76 kFx(k64u) kMemory_Position(kMemory memory);
77 
85 kFx(kSize) kMemory_Capacity(kMemory memory);
86 
95 kFx(kStatus) kMemory_SetLength(kMemory memory, kSize length);
96 
105 kFx(void*) kMemory_At(kMemory memory, kSize offset);
106 
107 kEndHeader()
108 
109 #include <kApi/Io/kMemory.x.h>
110 
111 #endif
Represents an in-memory stream.
Represents a 64-bit unsigned integer.
Represents an unsigned integer that can store a pointer address.
Abstract base class for memory allocator types.
kStatus kMemory_Allocate(kMemory memory, kSize initialCapacity)
Allocates an auto-sizing, internally-managed buffer for the memory stream.
kStatus kMemory_Attach(kMemory memory, void *buffer, kSize position, kSize length, kSize capacity)
Attaches the memory stream to an external, fixed-capacity buffer.
kSize kMemory_Capacity(kMemory memory)
Returns the current capacity of the memory buffer.
void * kMemory_At(kMemory memory, kSize offset)
Returns a pointer to the memory buffer at the specified position.
Core Zen type declarations.
kStatus kMemory_Construct(kMemory *memory, kAlloc allocator)
Constructs a kMemory object.
k64u kMemory_Position(kMemory memory)
Returns the current position of the read/write pointer, relative to the beginning of the buffer...
Represents an error code.
k64u kMemory_Length(kMemory memory)
Returns the current length of the memory buffer.
kStatus kMemory_SetLength(kMemory memory, kSize length)
Sets the reported length of the memory buffer.