TaPAS
0.2
|
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_stack * | ccl_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... | |
A generic stack implementation.
Definition in file ccl-stack.h.
#define ccl_stack_is_empty | ( | _s | ) | (ccl_stack_get_size (_s) == 0) |
Checks is the stack s is empty.
_s | the stack |
Definition at line 67 of file ccl-stack.h.
ccl_stack* ccl_stack_create | ( | void | ) |
Creates 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.
s | the stack to delete |
int ccl_stack_get_size | ( | const ccl_stack * | s | ) |
Returns the number of elements on the stack s.
s | the stack |
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.
s | the stack |
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.
s | the stack |
obj | the object put on the stack |