123456789101112131415161718192021222324252627282930313233343536373839 |
- #ifndef CORE_QUEUE_H
- #define CORE_QUEUE_H
- #include "core/Types.h"
- struct CoreQueueT {
- size_t writeIndex;
- size_t readIndex;
- size_t length;
- size_t capacity;
- size_t dataSize;
- void* data;
- };
- typedef struct CoreQueueT CoreQueue;
- void coreInitQueue(CoreQueue* r, size_t capacity, size_t dataSize);
- void coreDestroyQueue(CoreQueue* r);
- void corePushQueueData(CoreQueue* r, const void* data);
- #define corePushQueueType(l, type, ...) \
- corePushQueueData(l, &(type){__VA_ARGS__})
- void* coreGetQueueIndex(const CoreQueue* r, size_t index);
- #define coreGetTypedQueueIndex(r, index, type) \
- (*(type*)coreGetQueueIndex(r, index))
- void coreClearQueue(CoreQueue* r);
- void corePopQueueData(CoreQueue* r);
- #ifdef IMPORT_CORE
- #define Queue CoreQueue
- #define initQueue coreInitQueue
- #define destroyQueue coreDestroyQueue
- #define pushQueueData corePushQueueData
- #define pushQueueType corePushQueueType
- #define getQueueIndex coreGetQueueIndex
- #define getTypedQueueIndex coreGetTypedQueueIndex
- #define clearQueue coreClearQueue
- #define popQueueData corePopQueueData
- #endif
- #endif
|