177 size_t elements_to_allocate,
179 struct stack **id_of_stack);
Symbol visibility and compiler annotation macros.
#define TR_NODISCARD
Warns if the return value of a function is ignored.
Definition tr_export.h:217
#define TR_API
Marks a public API symbol for export or import.
Definition tr_export.h:129
Library wide error code definitions for the tr_datastructures library.
enum tr_result tr_result_t
Library wide error code returned by all API functions.
tr_result_t tr_stack_create(size_t size_of_datatype, size_t elements_to_allocate, tr_stack_type_t stack_type, struct stack **id_of_stack)
Allocates and initialises a new stack instance.
tr_stack_type
Selects the underlying implementation used by the stack.
Definition tr_stack.h:126
@ TR_STACK_LL
Definition tr_stack.h:129
@ TR_STACK_ARRAY_DYNAMIC
Definition tr_stack.h:127
@ TR_STACK_ARRAY_FIXED
Definition tr_stack.h:128
tr_result_t tr_stack_capacity(const struct stack *id_of_stack, size_t *capacity)
Returns the total allocated capacity of the stack.
tr_result_t tr_stack_size(const struct stack *id_of_stack, size_t *size)
Returns the current number of elements in the stack.
enum tr_stack_type tr_stack_type_t
Selects the underlying implementation used by the stack.
tr_result_t tr_stack_pop(struct stack *id_of_stack)
Removes the element at the top of the stack.
tr_result_t tr_stack_push(struct stack *id_of_stack, const void *data_to_push)
Pushes a deep copy of the data onto the top of the stack.
tr_result_t tr_stack_destroy(struct stack **id_of_stack)
Frees all memory associated with the stack instance.
tr_result_t tr_stack_top(const struct stack *id_of_stack, void *data_at_top)
Copies the element at the top of the stack into the provided buffer.
tr_result_t tr_stack_is_empty(const struct stack *id_of_stack, bool *is_empty)
Checks whether the stack contains no elements.
Portable type definitions for C89/C99/C11 compatibility.