All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kzc_stack.h File Reference

Stack (Last-In-First-Out). More...

Functions

kzsError kzcStackCreate (const struct KzcMemoryManager *memoryManager, struct KzcStack **out_stack)
 Creates a new initially empty stack. More...
 
kzsError kzcStackDelete (struct KzcStack *stack)
 Frees the memory allocated for the stack. More...
 
kzsError kzcStackPush (struct KzcStack *stack, void *element)
 Pushes the specified element to the stack. More...
 
kzsError kzcStackPop (struct KzcStack *stack, void **out_element)
 Pops the last element from the stack. More...
 
kzsError kzcStackPeek (const struct KzcStack *stack, void **out_element)
 Gets the last element from the stack without removing it. More...
 
kzUint kzcStackGetSize (const struct KzcStack *stack)
 Returns the number of elements in the stack. More...
 
kzBool kzcStackIsEmpty (const struct KzcStack *stack)
 Checks if the stack is empty or not. More...
 
kzsError kzcStackClear (struct KzcStack *stack)
 Clears the stack by removing all items from it. More...
 

Detailed Description

Stack (Last-In-First-Out).

Copyright 2008-2020 by Rightware. All rights reserved.

Function Documentation

kzsError kzcStackCreate ( const struct KzcMemoryManager memoryManager,
struct KzcStack **  out_stack 
)

Creates a new initially empty stack.

kzsError kzcStackDelete ( struct KzcStack stack)

Frees the memory allocated for the stack.

kzsError kzcStackPush ( struct KzcStack stack,
void *  element 
)

Pushes the specified element to the stack.

kzsError kzcStackPop ( struct KzcStack stack,
void **  out_element 
)

Pops the last element from the stack.

Returns error if the stack is empty.

kzsError kzcStackPeek ( const struct KzcStack stack,
void **  out_element 
)

Gets the last element from the stack without removing it.

Returns error if the stack is empty.

kzUint kzcStackGetSize ( const struct KzcStack stack)

Returns the number of elements in the stack.

kzBool kzcStackIsEmpty ( const struct KzcStack stack)

Checks if the stack is empty or not.

kzsError kzcStackClear ( struct KzcStack stack)

Clears the stack by removing all items from it.