TaPAS  0.2
Macros | Typedefs | Functions
ccl-stack.h File Reference

A generic stack implementation. More...

#include <ccl/ccl-common.h>

Go to the source code of this file.

Macros

#define ccl_stack_is_empty(_s)   (ccl_stack_get_size (_s) == 0)
 Checks is the stack s is empty. More...
 

Typedefs

typedef struct ccl_stack_st ccl_stack
 Abstract type of a stack.
 

Functions

ccl_stackccl_stack_create (void)
 Creates a new empty stack. More...
 
void ccl_stack_delete (ccl_stack *s)
 Deletion of the stack s. More...
 
int ccl_stack_get_size (const ccl_stack *s)
 Returns the number of elements on the stack s. More...
 
void * ccl_stack_get_top (ccl_stack *s)
 Returns the object at the top of the stack. More...
 
void ccl_stack_push (ccl_stack *s, void *obj)
 Put the object obj on the stack s. More...
 

Detailed Description

A generic stack implementation.

Definition in file ccl-stack.h.

Macro Definition Documentation

#define ccl_stack_is_empty (   _s)    (ccl_stack_get_size (_s) == 0)

Checks is the stack s is empty.

Parameters
_sthe stack
Precondition
_s != NULL
Returns
a non null value if s is empty

Definition at line 67 of file ccl-stack.h.

Function Documentation

ccl_stack* ccl_stack_create ( void  )

Creates a new empty stack.

Returns
a new empty stack
void ccl_stack_delete ( ccl_stack s)

Deletion of the stack s.

The resources allocated to this stack are released. Objects stacked on s are not deleted.

Parameters
sthe stack to delete
Precondition
s != NULL
int ccl_stack_get_size ( const ccl_stack s)

Returns the number of elements on the stack s.

Parameters
sthe stack
Precondition
s != NULL
Returns
the number of elements on the stack s
void* ccl_stack_get_top ( ccl_stack s)

Returns the object at the top of the stack.

If s is not an empty stack, the function returns the last stored object i.e. the one on the top of the stack.

Parameters
sthe stack
Precondition
! ccl_stack_is_empty (s)
Returns
the object contained in the cell on the top of the stack s
void ccl_stack_push ( ccl_stack s,
void *  obj 
)

Put the object obj on the stack s.

The function put the object obj on the top of the stack.

Parameters
sthe stack
objthe object put on the stack
Precondition
s != NULL
Postcondition
ccl_stack_get_top (s) == obj