1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 */ 16 17 #pragma once 18 19 /** \file 20 * \ingroup bli 21 */ 22 23 #include "BLI_compiler_attrs.h" 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 typedef struct BLI_Stack BLI_Stack; 30 31 BLI_Stack *BLI_stack_new_ex(const size_t elem_size, 32 const char *description, 33 const size_t chunk_size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); 34 BLI_Stack *BLI_stack_new(const size_t elem_size, const char *description) ATTR_WARN_UNUSED_RESULT 35 ATTR_NONNULL(); 36 37 void BLI_stack_free(BLI_Stack *stack) ATTR_NONNULL(); 38 39 void *BLI_stack_push_r(BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); 40 void BLI_stack_push(BLI_Stack *stack, const void *src) ATTR_NONNULL(); 41 42 void BLI_stack_pop_n(BLI_Stack *stack, void *dst, unsigned int n) ATTR_NONNULL(); 43 void BLI_stack_pop_n_reverse(BLI_Stack *stack, void *dst, unsigned int n) ATTR_NONNULL(); 44 void BLI_stack_pop(BLI_Stack *stack, void *dst) ATTR_NONNULL(); 45 46 void *BLI_stack_peek(BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); 47 void BLI_stack_discard(BLI_Stack *stack) ATTR_NONNULL(); 48 void BLI_stack_clear(BLI_Stack *stack) ATTR_NONNULL(); 49 50 size_t BLI_stack_count(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); 51 52 bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); 53 54 #ifdef __cplusplus 55 } 56 #endif 57