9 #ifndef __ZEDA_RING_H__ 10 #define __ZEDA_RING_H__ 48 #define zRingClass(ring_t,cell_t) \ 53 ring_t(){ size=head=0; buf=NULL; };\ 54 ~ring_t(){ if( buf ) delete [] buf; };\ 57 #define zRingClass(ring_t,cell_t) \ 65 #define zRingSize(y) (y)->size 66 #define zRingBuf(y) ( (y)->buf ) 69 #define zRingElemSize(y) sizeof(*zRingBuf(y)) 71 #define zRingHead(y) ( &zRingBuf(y)[(y)->head] ) 72 #define zRingElem(y,i) ( &zRingBuf(y)[((y)->head+(i)) % (y)->size] ) 73 #define zRingSetElem(a,i,d) \ 74 memcpy( zRingElem(a,i), (d), zRingElemSize(a) ) 76 #define zRingReset(y) ( (y)->head = 0 ); 77 #define zRingInit(y) do{\ 78 zRingSize(y) = (y)->head = 0;\ 87 #define zRingAlloc(y,type,size) do{\ 89 if( !( zRingBuf(y) = zAlloc(type,size) ) )\ 92 zRingSize(y) = (size);\ 95 #define zRingFree(y) do{\ 96 zFree( zRingBuf(y) );\ 100 #define zRingIncHead(y) do{\ 101 if( ++(y)->head >= zRingSize(y) ) (y)->head = 0;\ 103 #define zRingDecHead(y) do{\ 104 if( --(y)->head < 0 ) (y)->head = zRingSize(y) - 1;\ #define __END_DECLS
Definition: zeda_defs.h:30
#define __BEGIN_DECLS
Definition: zeda_defs.h:26