2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Nicholas Bishop
20 * ***** END GPL LICENSE BLOCK *****
24 #ifndef __BLI_STACK_H__
25 #define __BLI_STACK_H__
31 #include "BLI_compiler_attrs.h"
33 typedef struct BLI_Stack BLI_Stack;
35 BLI_Stack *BLI_stack_new_ex(
36 const size_t elem_size, const char *description,
37 const size_t chunk_size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
38 BLI_Stack *BLI_stack_new(
39 const size_t elem_size, const char *description) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
41 void BLI_stack_free(BLI_Stack *stack) ATTR_NONNULL();
43 void *BLI_stack_push_r(BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
44 void BLI_stack_push(BLI_Stack *stack, const void *src) ATTR_NONNULL();
46 void BLI_stack_pop_n(BLI_Stack *stack, void *dst, unsigned int n) ATTR_NONNULL();
47 void BLI_stack_pop(BLI_Stack *stack, void *dst) ATTR_NONNULL();
49 size_t BLI_stack_count(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
51 bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
53 #endif /* __BLI_STACK_H__ */