#include <si_std/queue.h>
Go to the source code of this file.
Defines | |
#define | sm_queueDecl(T) |
A macro that declares a queue containing items of user defined type T. | |
#define | sm_queueImpl(T) |
Macro that implements type-safe wrappers for the generic queue object. |
#define sm_queueDecl | ( | T | ) |
Value:
typedef sc_queue T##Queue;\ typedef sc_queueNode* T##QueueIterator;\ sc_status T##Queue_construct(T##Queue*,\ s_int32 initialCapacity);\ sc_status T##Queue_pushBack(T##Queue*, T* pt);\ sc_status T##Queue_popFront(T##Queue*, T* pt);\ sc_status T##Queue_destruct(T##Queue* pq);\ static T* T##QueueIterator_get(T##QueueIterator* it)\ { return (T*)((*it)+1); }
The following new types are declared:
#define sm_queueImpl | ( | T | ) |
Value:
sc_status T##Queue_construct(T##Queue* q,\ s_int32 c)\ { \ static const sc_queueNodeDesc d = { sizeof(T),\ (sc_queueNode_constructCopy_f)T##_constructCopy,\ (sc_queueNode_assign_f)T##_assign,\ (sc_queueNode_destruct_f)T##_destruct }; \ return sc_queue_construct(q,&d,c); \ } \ sc_status T##Queue_pushBack(T##Queue* q, T* v) \ { return sc_queue_pushBack(q,v); }\ sc_status T##Queue_popFront(T##Queue* q, T* v) \ { return sc_queue_popFront(q,v); }\ sc_status T##Queue_destruct(T##Queue* q) \ { return sc_queue_destruct(q); }
This would typically appear in the implemenation file for the type T, and implements the functions declared in sm_queueDecl.