/Users/maurits/Documents/studie/afstuderen/biosphere/common/stack.h File Reference

#include <apr_pools.h>

Include dependency graph for stack.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bs_stack

Functions

bs_stacknew_stack (apr_pool_t *mp)
void delete_stack (bs_stack *stack)
void stack_push (bs_stack *stack, void *data)
void * stack_pop (bs_stack *stack)
void * stack_top (const bs_stack *stack)
int stack_empty (const bs_stack *stack)
void * stack_index (const bs_stack *stack, unsigned index)
unsigned stack_size (const bs_stack *stack)


Function Documentation

void delete_stack ( bs_stack stack  ) 

Delete the given stack. Also destroy its memory pool.

Parameters:
stack Stack to delete

Definition at line 64 of file stack.c.

References bs_stack::pool.

bs_stack* new_stack ( apr_pool_t *  mp  ) 

Create a new stack from the given memory pool.

Parameters:
mp Memory pool to allocate from
Returns:
A freshly created stack

Definition at line 43 of file stack.c.

References bs_stack::allocated, bs_stack::data, INITIAL_STACK_SIZE, bs_stack::pool, pool, runtestsuite::rv, and bs_stack::size.

int stack_empty ( const bs_stack stack  ) 

Determine if the stack is empty or not

Parameters:
stack Stack to examine
Returns:
True iff the stack is empty

Definition at line 113 of file stack.c.

References bs_stack::size.

void* stack_index ( const bs_stack stack,
unsigned  index 
)

Random access to the stack.

Parameters:
stack Stack to get index from index Index of the element to retrieve
Returns:
Indexed element

Definition at line 120 of file stack.c.

References bs_stack::data.

void* stack_pop ( bs_stack stack  ) 

Pop the top element from the stack.

Parameters:
stack Stack to pop from
Returns:
The top element or NULL if the stack is empty

Definition at line 91 of file stack.c.

References bs_stack::size, and stack_top().

Here is the call graph for this function:

void stack_push ( bs_stack stack,
void *  data 
)

Push a data object on the stack.

Definition at line 74 of file stack.c.

References bs_stack::allocated, bs_stack::data, bs_stack::pool, pool_realloc(), and bs_stack::size.

Here is the call graph for this function:

unsigned stack_size ( const bs_stack stack  )  [inline]

Returns the size of the stack.

Parameters:
stack The stack to get the size from.
Returns:
The size of the stack.

Definition at line 127 of file stack.c.

References bs_stack::size.

void* stack_top ( const bs_stack stack  ) 

Get the top element from the stack.

Parameters:
stack Stack to retrieve top element from
Returns:
The top element or NULL if the stack is empty

Definition at line 105 of file stack.c.

References bs_stack::data, and bs_stack::size.

Referenced by stack_pop().


Generated on Tue Jul 17 09:50:59 2007 for Bio-SPHERE by  doxygen 1.5.1