|
Blender V4.3
|
#include <stdlib.h>#include <string.h>#include "BLI_utildefines.h"#include "MEM_guardedalloc.h"#include "BLI_stack.h"#include "BLI_strict_flags.h"Go to the source code of this file.
Classes | |
| struct | StackChunk |
| struct | BLI_Stack |
Macros | |
| #define | USE_TOTELEM |
| #define | CHUNK_EMPTY ((size_t)-1) |
| #define | CHUNK_SIZE_DEFAULT (1 << 16) |
| #define | CHUNK_ELEM_MIN 32 |
Functions | |
| static void * | stack_get_last_elem (BLI_Stack *stack) |
| static size_t | stack_chunk_elem_max_calc (const size_t elem_size, size_t chunk_size) |
| BLI_Stack * | BLI_stack_new_ex (const size_t elem_size, const char *description, const size_t chunk_size) |
| BLI_Stack * | BLI_stack_new (const size_t elem_size, const char *description) |
| static void | stack_free_chunks (struct StackChunk *data) |
| void | BLI_stack_free (BLI_Stack *stack) |
| void * | BLI_stack_push_r (BLI_Stack *stack) |
| void | BLI_stack_push (BLI_Stack *stack, const void *src) |
| void | BLI_stack_pop (BLI_Stack *stack, void *dst) |
| void | BLI_stack_pop_n (BLI_Stack *stack, void *dst, uint n) |
| void | BLI_stack_pop_n_reverse (BLI_Stack *stack, void *dst, uint n) |
| void * | BLI_stack_peek (BLI_Stack *stack) |
| void | BLI_stack_discard (BLI_Stack *stack) |
| void | BLI_stack_clear (BLI_Stack *stack) |
| size_t | BLI_stack_count (const BLI_Stack *stack) |
| bool | BLI_stack_is_empty (const BLI_Stack *stack) |
| #define CHUNK_ELEM_MIN 32 |
Definition at line 25 of file stack.c.
Referenced by stack_chunk_elem_max_calc().
| #define CHUNK_EMPTY ((size_t)-1) |
Definition at line 21 of file stack.c.
Referenced by BLI_stack_discard().
| #define CHUNK_SIZE_DEFAULT (1 << 16) |
Definition at line 23 of file stack.c.
Referenced by BLI_stack_new().
| 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().
| size_t BLI_stack_count | ( | const BLI_Stack * | stack | ) |
Definition at line 227 of file stack.c.
References BLI_Stack::chunk_curr, BLI_Stack::chunk_elem_max, BLI_Stack::chunk_index, data, and BLI_Stack::elem_num.
Referenced by BLI_bvhtree_intersect_plane(), BLI_bvhtree_overlap_ex(), BLI_stack_pop_n(), BLI_stack_pop_n_reverse(), BM_mesh_edgeloops_find(), BM_mesh_edgeloops_find_path(), BM_mesh_intersect_edges(), TEST(), TEST(), TEST(), and view3d_preselect_mesh_edgering_update_edges_from_edge().
| void BLI_stack_discard | ( | BLI_Stack * | stack | ) |
Removes the top element from the stack.
Definition at line 175 of file stack.c.
References BLI_assert, BLI_stack_is_empty(), BLI_Stack::chunk_curr, BLI_Stack::chunk_elem_max, CHUNK_EMPTY, BLI_Stack::chunk_free, BLI_Stack::chunk_index, BLI_Stack::elem_num, StackChunk::next, and UNLIKELY.
Referenced by BLI_stack_pop(), bmo_subdivide_edges_exec(), filelist_readjob_recursive_dir_add_items(), knifetool_undo(), and TEST().
| void BLI_stack_free | ( | BLI_Stack * | stack | ) |
Free the stack's data and the stack itself
Definition at line 96 of file stack.c.
References BLI_Stack::chunk_curr, BLI_Stack::chunk_free, MEM_freeN(), and stack_free_chunks().
Referenced by BLI_bvhtree_intersect_plane(), BLI_bvhtree_overlap_ex(), bm_face_split(), BM_mesh_edgeloops_find(), BM_mesh_edgeloops_find_path(), BM_mesh_intersect_edges(), bmo_collapse_exec(), bmo_collapsecon_do_layer(), bmo_subdivide_edges_exec(), build_edge_mats(), blender::deg::deg_graph_flush_visibility_flags(), edbm_face_split_by_edges_exec(), filelist_readjob_recursive_dir_add_items(), knifetool_exit_ex(), paint_2d_bucket_fill(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and view3d_preselect_mesh_edgering_update_edges_from_edge().
| bool BLI_stack_is_empty | ( | const BLI_Stack * | stack | ) |
Returns true if the stack is empty, false otherwise
Definition at line 249 of file stack.c.
References BLI_assert, BLI_Stack::chunk_curr, BLI_Stack::elem_num, and NULL.
Referenced by BLI_stack_discard(), BLI_stack_peek(), BLI_stack_pop(), bm_face_split(), bmo_collapse_exec(), bmo_collapsecon_do_layer(), bmo_subdivide_edges_exec(), build_edge_mats(), blender::deg::deg_graph_flush_visibility_flags(), edbm_face_split_by_edges_exec(), filelist_readjob_recursive_dir_add_items(), knifetool_modal(), paint_2d_bucket_fill(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and view3d_preselect_mesh_edgering_update_edges_from_edge().
| 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 * BLI_stack_new_ex | ( | const size_t | elem_size, |
| const char * | description, | ||
| const size_t | chunk_size ) |
Definition at line 68 of file stack.c.
References BLI_Stack::chunk_elem_max, BLI_Stack::chunk_index, BLI_Stack::elem_size, MEM_callocN, and stack_chunk_elem_max_calc().
Referenced by BLI_stack_new().
| void * BLI_stack_peek | ( | BLI_Stack * | stack | ) |
Definition at line 168 of file stack.c.
References BLI_assert, BLI_stack_is_empty(), and stack_get_last_elem().
Referenced by bmo_collapse_exec(), bmo_subdivide_edges_exec(), filelist_readjob_recursive_dir_add_items(), knifetool_undo(), TEST(), and view3d_preselect_mesh_edgering_update_edges_from_edge().
| void BLI_stack_pop | ( | BLI_Stack * | stack, |
| void * | dst ) |
Retrieves and removes the top element from the stack. The value is copies to dst, which must be at least elem_size bytes.
Does not reduce amount of allocated memory.
Definition at line 137 of file stack.c.
References BLI_assert, BLI_stack_discard(), BLI_stack_is_empty(), BLI_Stack::elem_size, and stack_get_last_elem().
Referenced by BLI_stack_pop_n(), BLI_stack_pop_n_reverse(), bm_face_split(), bmo_collapse_exec(), bmo_collapsecon_do_layer(), build_emats_stack(), blender::deg::deg_graph_flush_visibility_flags(), edbm_face_split_by_edges_exec(), knifetool_undo(), paint_2d_bucket_fill(), TEST(), TEST(), TEST(), TEST(), TEST(), and view3d_preselect_mesh_edgering_update_edges_from_edge().
A version of BLI_stack_pop which fills in an array.
| dst | The destination array, must be at least (BLI_Stack.elem_size * n) bytes long. |
| n | The number of items to pop. |
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().
A version of BLI_stack_pop_n which fills in an array (in the reverse order).
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().
| void BLI_stack_push | ( | BLI_Stack * | stack, |
| const void * | src ) |
Copies the source value onto the stack
| src | source data to be copied to the stack. |
Definition at line 131 of file stack.c.
References BLI_stack_push_r(), and BLI_Stack::elem_size.
Referenced by bm_face_split(), BM_mesh_edgeloops_find(), BM_mesh_edgeloops_find_path(), bmo_collapse_exec(), bmo_collapsecon_do_layer(), build_edge_mats(), build_emats_stack(), blender::deg::deg_graph_flush_visibility_flags(), edbm_face_split_by_edges_exec(), knife_split_edge(), paint_2d_bucket_fill(), paint_2d_fill_add_pixel_byte(), paint_2d_fill_add_pixel_float(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and view3d_preselect_mesh_edgering_update_edges_from_edge().
| void * BLI_stack_push_r | ( | BLI_Stack * | stack | ) |
Push a new item onto the stack.
Definition at line 103 of file stack.c.
References BLI_assert, BLI_Stack::chunk_curr, BLI_Stack::chunk_elem_max, BLI_Stack::chunk_free, BLI_Stack::chunk_index, BLI_Stack::elem_num, BLI_Stack::elem_size, MEM_mallocN, StackChunk::next, stack_get_last_elem(), and UNLIKELY.
Referenced by BLI_stack_push(), bm_edgexedge_isect_cb(), bm_edgexvert_isect_cb(), bm_vertxvert_isect_cb(), bmo_subdivide_edges_exec(), bvhtree_intersect_plane_dfs_recursive(), filelist_readjob_recursive_dir_add_items(), knife_add_cut(), tree_overlap_traverse(), tree_overlap_traverse_cb(), and tree_overlap_traverse_num().
|
static |
Definition at line 51 of file stack.c.
References BLI_assert, CHUNK_ELEM_MIN, MEM_SIZE_OVERHEAD, and UNLIKELY.
Referenced by BLI_stack_new_ex().
|
static |
Definition at line 87 of file stack.c.
References MEM_freeN(), and StackChunk::next.
Referenced by BLI_stack_free().
|
static |
Definition at line 43 of file stack.c.
Referenced by BLI_stack_peek(), BLI_stack_pop(), and BLI_stack_push_r().