Classes | Files | Defines | Typedefs | Functions

Vset class

A dynamic set object. More...

Classes

struct  sVset
 Contains public data members for Vset class. More...

Files

file  vset.h
 

Class Vset: a dynamic set object.


Defines

#define Vset_num(thee)   ((thee)->numT)
 the global "T" counter -- how many "T"s in list
#define Vset_access(thee, i)
 Access an object in an arbitrary place in the list.
#define Vset_create(thee)
 Create an object on the end of the list.
#define Vset_first(thee)
 Return the first object in the set.
#define Vset_last(thee)
 Return the last object in the set.
#define Vset_next(thee)
 Return the next object in the set.
#define Vset_prev(thee)
 Return the prev object in the set.
#define Vset_peekFirst(thee)
 Return the first object in the set.
#define Vset_peekLast(thee)
 Return the last object in the set.
#define Vset_destroy(thee)
 Free up the object currently on the end of the list.

Typedefs

typedef struct sVset Vset
 Declaration of the Vset class as the Vset structure.

Functions

VsetVset_ctor (Vmem *vmem, const char *tname, int tsize, int tmaxNum, int ioKey)
 Construct the set object.
void Vset_dtor (Vset **thee)
 Destroy the set object.
char * Vset_createLast (Vset *thee)
 Create an object on the end of the list.
void Vset_destroyLast (Vset *thee)
 Free up the object currently on the end of the list.
void Vset_initData (Vset *thee)
 Initialize the Vset data (thee).
void Vset_reset (Vset *thee)
 Release all Ram controlled by this (thee) and re-initialize.
void Vset_check (Vset *thee, int *tnum, int *tsize, int *tVecUse, int *tVecMal, int *tVecOhd)
 Get and return the RAM Control Block (thee) information.
void Vset_memChk (Vset *thee)
 Print the exact current malloc usage.

Detailed Description

A dynamic set object.


Define Documentation

#define Vset_access (   thee,
  i 
)
Value:
( \
        ((i >= 0) && (i < thee->numT)) \
        ? &((thee)->table[ (i)>>(thee)->blockPower                 ] \
                         [ (thee)->sizeT*((i)&(thee)->blockModulo) ]) \
        : VNULL \
    )

Access an object in an arbitrary place in the list.

Author:
Michael Holst
Note:
Class Vset: Inlineable method (vset.c)
Returns:
list of pointers to blocks of storage we manage
Parameters:
thee Pointer to the Vset object
i index of the object
#define Vset_create (   thee  ) 
Value:
( \
        (  ((((thee)->numT)>>(thee)->blockPower) >= (thee)->numBlocks) \
        || ((((thee)->numT+1)%(thee)->prtT) == 0) ) \
        ? (Vset_createLast((thee))) \
        : (++((thee)->numT), (Vset_access((thee),(thee)->numT-1))) \
    )

Create an object on the end of the list.

Author:
Michael Holst
Note:
Class Vset: Inlineable method (vset.c)
Returns:
Pointer to a created Vset object on the end of the list
Parameters:
thee Pointer to the Vset object
#define Vset_destroy (   thee  ) 
Value:
( \
        ( ((((thee)->numT-1)>>(thee)->blockPower) < (thee)->numBlocks-1) \
          || ((thee)->numT == 1) || ((((thee)->numT)%(thee)->prtT) == 0) ) \
        ? (Vset_destroyLast((thee))) : (void)(((thee)->numT)--) \
    )

Free up the object currently on the end of the list.

Author:
Michael Holst
Note:
Class Vset: Inlineable method (vset.c)
Returns:
no return
Parameters:
thee Pointer to the Vset object
#define Vset_first (   thee  ) 
Value:
( \
        (thee)->curT = 0, \
        Vset_access((thee), (thee)->curT) \
    )

Return the first object in the set.

Author:
Michael Holst
Note:
Class Vset: Inlineable method (vset.c)
Returns:
the first object in the set
Parameters:
thee Pointer to the Vset object
#define Vset_last (   thee  ) 
Value:
( \
        (thee)->curT = (thee)->numT-1, \
        Vset_access((thee), (thee)->curT) \
    )

Return the last object in the set.

Author:
Michael Holst
Note:
Class Vset: Inlineable method (vset.c)
Returns:
the last object in the set
Parameters:
thee Pointer to the Vset object
#define Vset_next (   thee  ) 
Value:
( \
        (thee)->curT++, \
        ((thee)->curT < (thee)->numT) \
        ? Vset_access((thee), (thee)->curT) \
        : VNULL \
    )

Return the next object in the set.

Author:
Michael Holst
Note:
Class Vset: Inlineable method (vset.c)
Returns:
the next object in the set
Parameters:
thee Pointer to the Vset object
#define Vset_num (   thee  )     ((thee)->numT)

the global "T" counter -- how many "T"s in list

Author:
Michael Holst
Note:
Class Vset: Inlineable method (vset.c)
Returns:
None
Parameters:
thee Pointer to the Vset object
#define Vset_peekFirst (   thee  ) 
Value:
( \
        Vset_access((thee), 0) \
    )

Return the first object in the set.

Author:
Michael Holst
Note:
Class Vset: Inlineable method (vset.c)
Returns:
the first object in the set.
Parameters:
thee Pointer to the Vset object
#define Vset_peekLast (   thee  ) 
Value:
( \
        Vset_access((thee), (thee)->numT-1) \
    )

Return the last object in the set.

Author:
Michael Holst
Note:
Class Vset: Inlineable method (vset.c)
Returns:
the last object in the set
Parameters:
thee Pointer to the Vset object
#define Vset_prev (   thee  ) 
Value:
( \
        (thee)->curT--, \
        ((thee)->curT >= 0) \
        ? Vset_access((thee), (thee)->curT) \
        : VNULL \
    )

Return the prev object in the set.

Author:
Michael Holst
Note:
Class Vset: Inlineable method (vset.c)
Returns:
the prev object in the set
Parameters:
thee Pointer to the Vset object

Typedef Documentation

typedef struct sVset Vset

Declaration of the Vset class as the Vset structure.

Author:
Michael Holst

Function Documentation

void Vset_check ( Vset thee,
int *  tnum,
int *  tsize,
int *  tVecUse,
int *  tVecMal,
int *  tVecOhd 
)

Get and return the RAM Control Block (thee) information.

Author:
Michael Holst
Note:
Class Vset: Non-Inlineable method (vset.c)
Returns:
None
Parameters:
thee Pointer to the Vset object
tnum the global "T" counter -- how many "T"s in list
tsize size of the object in bytes
tVecUse size of the total objects
tVecMal size of the total RAM Control Block
tVecOhd maximal size of RAM Control Block
char* Vset_createLast ( Vset thee  ) 

Create an object on the end of the list.

Author:
Michael Holst
Note:
Class Vset: Non-Inlineable method (vset.c)
Returns:
Pointer to the created Vset object
Parameters:
thee Pointer to the Vset object
Vset* Vset_ctor ( Vmem vmem,
const char *  tname,
int  tsize,
int  tmaxNum,
int  ioKey 
)

Construct the set object.

Author:
Michael Holst
Note:
Class Vset: Non-Inlineable method (vset.c)
Returns:
Pointer to a new allocated Vset object
Parameters:
vmem Memory management object
tname name of object we are managing
tsize size of the object in bytes
tmaxNum number of objects to manage (user specified)
ioKey index for i/o
void Vset_destroyLast ( Vset thee  ) 

Free up the object currently on the end of the list.

Author:
Michael Holst
Note:
Class Vset: Non-Inlineable method (vset.c)
Returns:
None
Parameters:
thee Pointer to the Vset object
void Vset_dtor ( Vset **  thee  ) 

Destroy the set object.

Author:
Michael Holst
Note:
Class Vset: Non-Inlineable method (vset.c)
Returns:
None
Parameters:
thee Pointer to the Vset object
void Vset_initData ( Vset thee  ) 

Initialize the Vset data (thee).

Author:
Michael Holst
Note:
Class Vset: Non-Inlineable method (vset.c)
Returns:
None
Parameters:
thee Pointer to the Vset object
void Vset_memChk ( Vset thee  ) 

Print the exact current malloc usage.

Author:
Michael Holst
Note:
Class Vset: Non-Inlineable method (vset.c)
Returns:
None
Parameters:
thee Pointer to the Vset object
void Vset_reset ( Vset thee  ) 

Release all Ram controlled by this (thee) and re-initialize.

Author:
Michael Holst
Note:
Class Vset: Non-Inlineable method (vset.c)
Returns:
None
Parameters:
thee Pointer to the Vset object