Blender V4.3
BLI_stack.h File Reference

Go to the source code of this file.

Typedefs

typedef struct BLI_Stack BLI_Stack
 

Functions

BLI_StackBLI_stack_new_ex (size_t elem_size, const char *description, size_t chunk_size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
BLI_StackBLI_stack_new (size_t elem_size, const char *description) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
void BLI_stack_free (BLI_Stack *stack) ATTR_NONNULL()
 
void * BLI_stack_push_r (BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
void BLI_stack_push (BLI_Stack *stack, const void *src) ATTR_NONNULL()
 
void BLI_stack_pop_n (BLI_Stack *stack, void *dst, unsigned int n) ATTR_NONNULL()
 
void BLI_stack_pop_n_reverse (BLI_Stack *stack, void *dst, unsigned int n) ATTR_NONNULL()
 
void BLI_stack_pop (BLI_Stack *stack, void *dst) ATTR_NONNULL()
 
void * BLI_stack_peek (BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
void BLI_stack_discard (BLI_Stack *stack) ATTR_NONNULL()
 
void BLI_stack_clear (BLI_Stack *stack) ATTR_NONNULL()
 
size_t BLI_stack_count (const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
bool BLI_stack_is_empty (const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 

Typedef Documentation

◆ BLI_Stack

typedef struct BLI_Stack BLI_Stack

Definition at line 17 of file BLI_stack.h.

Function Documentation

◆ BLI_stack_clear()

void BLI_stack_clear ( BLI_Stack * stack)

Discards all elements without freeing.

Definition at line 195 of file stack.c.

References BLI_Stack::chunk_curr, BLI_Stack::chunk_elem_max, BLI_Stack::chunk_free, BLI_Stack::chunk_index, BLI_Stack::elem_num, StackChunk::next, NULL, and UNLIKELY.

Referenced by TEST().

◆ BLI_stack_count()

◆ BLI_stack_discard()

◆ BLI_stack_free()

◆ BLI_stack_is_empty()

◆ BLI_stack_new()

BLI_Stack * BLI_stack_new ( size_t elem_size,
const char * description )

Create a new homogeneous stack with elements of 'elem_size' bytes.

Definition at line 82 of file stack.c.

References BLI_stack_new_ex(), and CHUNK_SIZE_DEFAULT.

◆ BLI_stack_new_ex()

BLI_Stack * BLI_stack_new_ex ( size_t elem_size,
const char * description,
size_t chunk_size )

◆ BLI_stack_peek()

◆ BLI_stack_pop()

void BLI_stack_pop ( BLI_Stack * stack,
void * dst )

◆ BLI_stack_pop_n()

void BLI_stack_pop_n ( BLI_Stack * stack,
void * dst,
unsigned int n )

A version of BLI_stack_pop which fills in an array.

Parameters
dstThe destination array, must be at least (BLI_Stack.elem_size * n) bytes long.
nThe number of items to pop.
Note
The first item in the array will be last item added to the stack.

Definition at line 146 of file stack.c.

References BLI_assert, BLI_stack_count(), BLI_stack_pop(), and BLI_Stack::elem_size.

Referenced by BLI_bvhtree_intersect_plane(), BLI_bvhtree_overlap_ex(), and TEST().

◆ BLI_stack_pop_n_reverse()

void BLI_stack_pop_n_reverse ( BLI_Stack * stack,
void * dst,
unsigned int n )

A version of BLI_stack_pop_n which fills in an array (in the reverse order).

Note
The first item in the array will be first item added to the stack.

Definition at line 156 of file stack.c.

References BLI_assert, BLI_stack_count(), BLI_stack_pop(), and BLI_Stack::elem_size.

Referenced by BM_mesh_edgeloops_find(), BM_mesh_edgeloops_find_path(), and BM_mesh_intersect_edges().

◆ BLI_stack_push()

◆ BLI_stack_push_r()