Zen API

- Home
- Topics
- Types
- Files

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
kMemory
Represents an in-memory stream.
k64u
Represents a 64-bit unsigned integer.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kMemory::kMemory_Allocate
kStatus kMemory_Allocate(kMemory memory, kSize initialCapacity)
Allocates an auto-sizing, internally-managed buffer for the memory stream.
kMemory::kMemory_Attach
kStatus kMemory_Attach(kMemory memory, void *buffer, kSize position, kSize length, kSize capacity)
Attaches the memory stream to an external, fixed-capacity buffer.
kMemory::kMemory_Capacity
kSize kMemory_Capacity(kMemory memory)
Returns the current capacity of the memory buffer.
kMemory::kMemory_At
void * kMemory_At(kMemory memory, kSize offset)
Returns a pointer to the memory buffer at the specified position.
kApiDef.h
Core Zen type declarations.
kMemory::kMemory_Construct
kStatus kMemory_Construct(kMemory *memory, kAlloc allocator)
Constructs a kMemory object.
kMemory::kMemory_Position
k64u kMemory_Position(kMemory memory)
Returns the current position of the read/write pointer, relative to the beginning of the buffer...
kStatus
Represents an error code.
kMemory::kMemory_Length
k64u kMemory_Length(kMemory memory)
Returns the current length of the memory buffer.
kMemory::kMemory_SetLength
kStatus kMemory_SetLength(kMemory memory, kSize length)
Sets the reported length of the memory buffer.