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 #include <kApi/Io/kMemory.x.h>
15 
22 //typedef kStream kMemory; --forward-declared in kApiDef.x.h
23 
34 kFx(kStatus) kMemory_Construct(kMemory* memory, kAlloc allocator);
35 
47 kFx(kStatus) kMemory_Attach(kMemory memory, void* buffer, kSize position, kSize length, kSize capacity);
48 
57 kFx(kStatus) kMemory_Allocate(kMemory memory, kSize initialCapacity);
58 
69 kFx(kStatus) kMemory_Reserve(kMemory memory, kSize minimumCapacity);
70 
78 kFx(k64u) kMemory_Length(kMemory memory);
79 
87 kFx(k64u) kMemory_Position(kMemory memory);
88 
96 kFx(kSize) kMemory_Capacity(kMemory memory);
97 
106 kFx(kStatus) kMemory_SetLength(kMemory memory, kSize length);
107 
116 kFx(void*) kMemory_At(kMemory memory, kSize offset);
117 
118 
119 #endif
Represents an in-memory stream.
Represents a 64-bit unsigned integer.
kStatus kMemory_Reserve(kMemory memory, kSize minimumCapacity)
Ensures that capacity is reserved for at least the specified number of bytes.
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.