1/**
2 * \file
3 * \brief Barrelfish collections library stack
4 */
5
6/*
7 * Copyright (c) 2012, ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#ifndef _COLLECTIONS_STACK_H_
16#define _COLLECTIONS_STACK_H_
17
18#include <sys/cdefs.h>
19
20#include <collections/list.h>
21
22__BEGIN_DECLS
23
24struct collections_stack {
25    /**
26     * total number of elements
27     */
28    uint32_t num_elements;
29
30    /**
31     * elements of the stack kept in a linked list
32     */
33    collections_listnode *elements;
34};
35
36void  collections_stack_create(struct collections_stack **stack);
37
38void *collections_stack_pop(struct collections_stack *stack);
39
40void  collections_stack_push(struct collections_stack *stack, void *element);
41
42void *collections_stack_top(struct collections_stack *stack);
43
44void  collections_stack_release(struct collections_stack *stack);
45
46__END_DECLS
47
48#endif // _COLLECTIONS_STACK_H_
49