libusual  0.1
Data Structures | Defines | Functions
usual/statlist.h File Reference

Circular list that keep track of stats about the list. More...

Data Structures

struct  StatList
 Header structure for StatList. More...

Defines

#define STATLIST(var)
 Define and initialize StatList head.
#define statlist_for_each(item, list)
 Loop over list.
#define statlist_for_each_reverse(item, list)
 Loop over list backwards.
#define statlist_for_each_safe(item, list, tmp)
 Loop over list safely, so that elements can be removed during.
#define statlist_for_each_reverse_safe(item, list, tmp)
 Loop over list backwards safely, so that elements can be removed during.

Functions

static void statlist_prepend (struct StatList *list, struct List *item)
 Add to the start of the list.
static void statlist_append (struct StatList *list, struct List *item)
 Add to the end of the list.
static void statlist_remove (struct StatList *list, struct List *item)
 Remove element from the list.
static void statlist_init (struct StatList *list, const char *name)
 Initialize StatList head.
static int statlist_count (const struct StatList *list)
 return number of elements currently in list
static struct Liststatlist_pop (struct StatList *list)
 remove and return first element
static struct Liststatlist_first (const struct StatList *list)
 Return first element.
static struct Liststatlist_last (const struct StatList *list)
 Return last element.
static bool statlist_empty (const struct StatList *list)
 Is list empty.
static void statlist_put_before (struct StatList *list, struct List *item, struct List *pos)
 Put intem before another.
static void statlist_put_after (struct StatList *list, struct List *item, struct List *pos)
 Put item after another.

Detailed Description

Circular list that keep track of stats about the list.

Currenly only count of abjects currently in list is kept track of. The plan was to track more, like max, but it was not useful enough.


Define Documentation

#define STATLIST (   var)

Define and initialize StatList head.

#define statlist_for_each (   item,
  list 
)

Loop over list.

#define statlist_for_each_reverse (   item,
  list 
)

Loop over list backwards.

#define statlist_for_each_safe (   item,
  list,
  tmp 
)

Loop over list safely, so that elements can be removed during.

#define statlist_for_each_reverse_safe (   item,
  list,
  tmp 
)

Loop over list backwards safely, so that elements can be removed during.


Function Documentation

static void statlist_prepend ( struct StatList list,
struct List item 
) [inline, static]

Add to the start of the list.

References StatList::cur_count, StatList::head, and list_prepend().

static void statlist_append ( struct StatList list,
struct List item 
) [inline, static]

Add to the end of the list.

References StatList::cur_count, StatList::head, and list_append().

static void statlist_remove ( struct StatList list,
struct List item 
) [inline, static]

Remove element from the list.

References StatList::cur_count, and list_del().

static void statlist_init ( struct StatList list,
const char *  name 
) [inline, static]

Initialize StatList head.

References StatList::cur_count, StatList::head, and list_init().

static int statlist_count ( const struct StatList list) [inline, static]

return number of elements currently in list

References StatList::cur_count.

static struct List* statlist_pop ( struct StatList list) [static, read]

remove and return first element

References StatList::cur_count, StatList::head, and list_pop().

static struct List* statlist_first ( const struct StatList list) [static, read]

Return first element.

References StatList::head, and list_first().

static struct List* statlist_last ( const struct StatList list) [static, read]

Return last element.

References StatList::head, and list_last().

static bool statlist_empty ( const struct StatList list) [inline, static]

Is list empty.

References StatList::head, and list_empty().

static void statlist_put_before ( struct StatList list,
struct List item,
struct List pos 
) [inline, static]

Put intem before another.

References StatList::cur_count, and list_append().

static void statlist_put_after ( struct StatList list,
struct List item,
struct List pos 
) [inline, static]

Put item after another.

References StatList::cur_count, and list_prepend().