• Main Page
  • Modules
  • Classes
  • Files
  • File List
  • File Members

vset.h

Go to the documentation of this file.
00001 
00038 #ifndef _VSET_H_
00039 #define _VSET_H_
00040 
00041 #include <maloc/maloc_base.h>
00042 
00043 #include <maloc/vnm.h>
00044 #include <maloc/vmem.h>
00045 
00046 /*
00047  * ***************************************************************************
00048  * Class Vset: Parameters and datatypes
00049  * ***************************************************************************
00050  */
00051 
00057 struct sVset {
00058 
00060     Vmem *vmem;      
00062     int  iMadeVmem;  
00063 
00065     int curT;
00066 
00068     char nameT[VMAX_ARGLEN];
00070     int sizeT;     
00071 
00073     int numBlocks;  
00075     int numT;       
00077     int prtT;        
00078 
00080     int maxObjects;   
00082     int blockPower;  
00084     int blockSize; 
00086     int blockMax;  
00088     int blockModulo;  
00089 
00091     char **table;    
00092 
00093 };
00094 
00100 typedef struct sVset Vset;
00101 
00102 /****************************************************************/
00103 /* Class Vset: Inlineable method (vset.c)                       */
00104 /****************************************************************/
00105 
00106 #if !defined(VINLINE_MALOC)
00107 
00115     int Vset_num(Vset *thee);
00116 
00126     char *Vset_access(Vset *thee, int i);
00127 
00136     char *Vset_create(Vset *thee);
00137 
00146     char *Vset_first(Vset *thee);
00147 
00156     char *Vset_last(Vset *thee);
00157 
00166     char *Vset_next(Vset *thee);
00167 
00176     char *Vset_prev(Vset *thee);
00177 
00186     char *Vset_peekFirst(Vset *thee);
00187 
00196     char *Vset_peekLast(Vset *thee);
00197 
00206     void Vset_destroy(Vset *thee);
00207 #else /* if defined(VINLINE_MALOC) */
00208 
00216 #   define Vset_num(thee) ((thee)->numT)
00217 
00227 #   define Vset_access(thee,i) ( \
00228         ((i >= 0) && (i < thee->numT)) \
00229         ? &((thee)->table[ (i)>>(thee)->blockPower                 ] \
00230                          [ (thee)->sizeT*((i)&(thee)->blockModulo) ]) \
00231         : VNULL \
00232     )
00233 
00242 #   define Vset_create(thee) ( \
00243         (  ((((thee)->numT)>>(thee)->blockPower) >= (thee)->numBlocks) \
00244         || ((((thee)->numT+1)%(thee)->prtT) == 0) ) \
00245         ? (Vset_createLast((thee))) \
00246         : (++((thee)->numT), (Vset_access((thee),(thee)->numT-1))) \
00247     )
00248 
00257 #   define Vset_first(thee) ( \
00258         (thee)->curT = 0, \
00259         Vset_access((thee), (thee)->curT) \
00260     )
00261 
00270 #   define Vset_last(thee) ( \
00271         (thee)->curT = (thee)->numT-1, \
00272         Vset_access((thee), (thee)->curT) \
00273     )
00274 
00283 #   define Vset_next(thee) ( \
00284         (thee)->curT++, \
00285         ((thee)->curT < (thee)->numT) \
00286         ? Vset_access((thee), (thee)->curT) \
00287         : VNULL \
00288     )
00289 
00298 #   define Vset_prev(thee) ( \
00299         (thee)->curT--, \
00300         ((thee)->curT >= 0) \
00301         ? Vset_access((thee), (thee)->curT) \
00302         : VNULL \
00303     )
00304 
00313 #   define Vset_peekFirst(thee) ( \
00314         Vset_access((thee), 0) \
00315     )
00316 
00325 #   define Vset_peekLast(thee) ( \
00326         Vset_access((thee), (thee)->numT-1) \
00327     )
00328 
00337 #   define Vset_destroy(thee) ( \
00338         ( ((((thee)->numT-1)>>(thee)->blockPower) < (thee)->numBlocks-1) \
00339           || ((thee)->numT == 1) || ((((thee)->numT)%(thee)->prtT) == 0) ) \
00340         ? (Vset_destroyLast((thee))) : (void)(((thee)->numT)--) \
00341     )
00342 #endif /* if !defined(VINLINE_MALOC) */
00343 
00356 Vset* Vset_ctor(Vmem *vmem,
00357     const char *tname, int tsize, int tmaxNum, int ioKey);
00358 
00367 void Vset_dtor(Vset **thee);
00368 
00377 char *Vset_createLast(Vset *thee);
00378 
00387 void Vset_destroyLast(Vset *thee);
00388 
00397 void Vset_initData(Vset *thee);
00398 
00407 void Vset_reset(Vset *thee);
00408 
00422 void Vset_check(Vset *thee,
00423     int *tnum, int *tsize, int *tVecUse, int *tVecMal, int *tVecOhd);
00424 
00433 void Vset_memChk(Vset *thee);
00434 
00435 #endif /* _VSET_H_ */
00436 
00437 

Generated on Sun Mar 20 2011 for MALOC by  doxygen 1.7.1