42 lines
641 B
C++
42 lines
641 B
C++
/*
|
|
Stack header
|
|
|
|
file: stack.h++
|
|
author: Jakob Klepp
|
|
date: 2017-03-09
|
|
*/
|
|
|
|
struct t_layer;
|
|
|
|
/** Points to the top of a stack */
|
|
typedef struct t_layer* Stack;
|
|
|
|
/**
|
|
* Creates a new Stack
|
|
*/
|
|
Stack Stack_new();
|
|
|
|
/**
|
|
* Destroys a Stack and all layers
|
|
*/
|
|
void Stack_destroy(Stack* stack);
|
|
|
|
/**
|
|
* Returns the top element of a Stack
|
|
*/
|
|
int Stack_peek(Stack* stack);
|
|
|
|
/**
|
|
* Checks whether a Stack contains any elements
|
|
*/
|
|
bool Stack_isEmpty(Stack* stack);
|
|
|
|
/**
|
|
* Removes the top element of a Stack and returns it
|
|
*/
|
|
int Stack_pop(Stack* stack);
|
|
|
|
/**
|
|
* Adds a new element to the top of a Stack
|
|
*/
|
|
void Stack_push(Stack* stack, int value);
|