Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kMsgQueue.h
Go to the documentation of this file.
1
10 #ifndef K_API_MSG_QUEUE_H
11 #define K_API_MSG_QUEUE_H
12
13 #include <kApi/kApiDef.h>
14
20 typedef struct kMsgQueueDropArgs
21 {
22 void* item;
23 } kMsgQueueDropArgs;
24
31 typedef k32s kMsgQueuePurgeOption;
32
34 #define kMSG_QUEUE_PURGE_OPTION_NULL (0x0)
35 #define kMSG_QUEUE_PURGE_OPTION_PRESERVE_CRITICAL (0x1)
36 #define kMSG_QUEUE_PURGE_OPTION_USE_HANDLER (0x2)
37 #define kMSG_QUEUE_PURGE_OPTION_DISPOSE_ITEMS (0x4)
38 #define kMSG_QUEUE_PURGE_OPTION_COUNT_DROPS (0x8)
39
47 typedef k32s kMsgQueueItemOption;
48
50 #define kMSG_QUEUE_ITEM_OPTION_NULL (0x0)
51 #define kMSG_QUEUE_ITEM_OPTION_CRITICAL (0x1)
52
55 typedef kStatus (kCall *kMsgQueueDropFx) (kPointer receiver, kMsgQueue queue, kMsgQueueDropArgs* args);
56
57 #include <kApi/Threads/kMsgQueue.x.h>
58
151 //typedef kObject kMsgQueue; // --forward-declared in kApiDef.x.h
152
162 kFx(kStatus) kMsgQueue_Construct(kMsgQueue* queue, kType itemType, kAlloc allocator);
163
176 kFx(kStatus) kMsgQueue_SetMaxSize(kMsgQueue queue, kSize size);
177
190 kFx(kStatus) kMsgQueue_SetMaxCount(kMsgQueue queue, kSize count);
191
206 kFx(kStatus) kMsgQueue_Reserve(kMsgQueue queue, kSize count);
207
222 kFx(kStatus) kMsgQueue_SetDropHandler(kMsgQueue queue, kMsgQueueDropFx onDrop, kPointer receiver);
223
242 kFx(kStatus) kMsgQueue_Add(kMsgQueue queue, void* item);
243
256 #define kMsgQueue_AddT(kMsgQueue_queue, TPtr_item) \
257 xkMsgQueue_AddT(kMsgQueue_queue, TPtr_item, sizeof(*TPtr_item))
258
273 kFx(kStatus) kMsgQueue_AddEx(kMsgQueue queue, void* item, kMsgQueueItemOption options);
274
288 #define kMsgQueue_AddExT(kMsgQueue_queue, TPtr_item, kMsgQueueItemOption_options) \
289 xkMsgQueue_AddExT(kMsgQueue_queue, TPtr_item, kMsgQueueItemOption_options, sizeof(*TPtr_item))
290
306 kFx(kStatus) kMsgQueue_Remove(kMsgQueue queue, void* item, k64u timeout);
307
320 #define kMsgQueue_RemoveT(kMsgQueue_queue, TPtr_item, k64u_timeout) \
321 xkMsgQueue_RemoveT(kMsgQueue_queue, TPtr_item, k64u_timeout, sizeof(*TPtr_item))
322
336 kFx(kStatus) kMsgQueue_Clear(kMsgQueue queue);
337
351 kFx(kStatus) kMsgQueue_Purge(kMsgQueue queue);
352
367 kFx(kStatus) kMsgQueue_PurgeEx(kMsgQueue queue, kMsgQueuePurgeOption options);
368
378 kFx(kSize) kMsgQueue_Count(kMsgQueue queue);
379
389 kFx(kSize) kMsgQueue_MaxSize(kMsgQueue queue);
390
400 kFx(kSize) kMsgQueue_MaxCount(kMsgQueue queue);
401
411 kFx(kType) kMsgQueue_ItemType(kMsgQueue queue);
412
422 kFx(kSize) kMsgQueue_ItemSize(kQueue queue);
423
433 kFx(kSize) kMsgQueue_DataSize(kMsgQueue queue);
434
444 kFx(k64u) kMsgQueue_DropCount(kMsgQueue queue);
445
446 #endif
kMsgQueue::kMsgQueue_Remove
kStatus kMsgQueue_Remove(kMsgQueue queue, void *item, k64u timeout)
Removes an item from the queue.
kMsgQueue::kMsgQueue_SetDropHandler
kStatus kMsgQueue_SetDropHandler(kMsgQueue queue, kMsgQueueDropFx onDrop, kPointer receiver)
Sets the callback used when dropping an item.
kMsgQueue::kMsgQueue_AddEx
kStatus kMsgQueue_AddEx(kMsgQueue queue, void *item, kMsgQueueItemOption options)
Adds an item to the queue with the specified options.
kMsgQueueItemOption
Represents a set of options describing a kMsgQueue item.
k64u
Represents a 64-bit unsigned integer.
kPointer
Represents a void pointer.
kMsgQueuePurgeOption
Represents a set of kMsgQueue purge options.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kMsgQueue::kMsgQueue_Count
kSize kMsgQueue_Count(kMsgQueue queue)
Reports the current count of queue items.
kMsgQueue::kMsgQueue_Reserve
kStatus kMsgQueue_Reserve(kMsgQueue queue, kSize count)
Reserves memory for the specified number of items.
kMsgQueue::kMsgQueue_Purge
kStatus kMsgQueue_Purge(kMsgQueue queue)
Removes and disposes all items from the queue.
kMsgQueue::kMsgQueue_MaxCount
kSize kMsgQueue_MaxCount(kMsgQueue queue)
Reports the maximum count of items in the queue.
kMsgQueue::kMsgQueue_SetMaxSize
kStatus kMsgQueue_SetMaxSize(kMsgQueue queue, kSize size)
Sets the maximum amount of data retained by the queue.
kMsgQueue::kMsgQueue_ItemSize
kSize kMsgQueue_ItemSize(kQueue queue)
Returns the queue element size.
kApiDef.h
Core Zen type declarations.
k32s
Represents a 32-bit signed integer.
kMsgQueue
Represents a synchronized FIFO queue with an optional maximum content size and/or item capacity...
kMsgQueueDropArgs
Represents arguments passed in a kMsgQueue drop callback.
Definition: kMsgQueue.h:20
kMsgQueue::kMsgQueue_DropCount
k64u kMsgQueue_DropCount(kMsgQueue queue)
Reports the count of dropped items.
kMsgQueue::kMsgQueue_DataSize
kSize kMsgQueue_DataSize(kMsgQueue queue)
Reports the current amount of data stored in the queue (in bytes).
kType
Represents metadata about a type (class, interface, or value).
kQueue
Represents a FIFO queue implemented with a dynamic array.
kStatus
Represents an error code.
kMsgQueue::kMsgQueue_Clear
kStatus kMsgQueue_Clear(kMsgQueue queue)
Removes all items from the queue.
kMsgQueue::kMsgQueue_SetMaxCount
kStatus kMsgQueue_SetMaxCount(kMsgQueue queue, kSize count)
Sets the maximum count of items retained by the queue.
kMsgQueue::kMsgQueue_MaxSize
kSize kMsgQueue_MaxSize(kMsgQueue queue)
Reports the maximum total data size of all items in the queue.
kMsgQueueDropArgs::item
void * item
Pointer to the item to be dropped.
Definition: kMsgQueue.h:22
kMsgQueue::kMsgQueue_Add
kStatus kMsgQueue_Add(kMsgQueue queue, void *item)
Adds an item to the queue.
kMsgQueue::kMsgQueue_ItemType
kType kMsgQueue_ItemType(kMsgQueue queue)
Reports the type of element stored in the queue.
kMsgQueue::kMsgQueue_Construct
kStatus kMsgQueue_Construct(kMsgQueue *queue, kType itemType, kAlloc allocator)
Constructs a kMsgQueue object.
kMsgQueue::kMsgQueue_PurgeEx
kStatus kMsgQueue_PurgeEx(kMsgQueue queue, kMsgQueuePurgeOption options)
Removes items from the queue using the specified options.