Blender
V3.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, unsigned int n) |
void | BLI_stack_pop_n_reverse (BLI_Stack *stack, void *dst, unsigned int 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) |
Discards all elements without freeing.
Definition at line 193 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 BKE_lnor_space_define(), and TEST().
size_t BLI_stack_count | ( | const BLI_Stack * | stack | ) |
Definition at line 225 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(), gpencil_points_from_stack(), TEST(), and view3d_preselect_mesh_edgering_update_edges_from_edge().
Removes the top element from the stack.
Definition at line 173 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 BKE_lnor_space_define(), BLI_stack_pop(), bmo_subdivide_edges_exec(), filelist_readjob_recursive_dir_add_items(), knifetool_undo(), and TEST().
Free the stack's data and the stack itself
Definition at line 94 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(), bm_mesh_loops_calc_normals__single_threaded(), bm_mesh_loops_calc_normals_for_vert_free_fn(), bmo_collapse_exec(), bmo_collapsecon_do_layer(), bmo_subdivide_edges_exec(), build_edge_mats(), contract_shape(), blender::deg::deg_graph_flush_visibility_flags(), dilate_shape(), edbm_face_split_by_edges_exec(), filelist_readjob_recursive_dir_add_items(), gpencil_boundaryfill_area(), gpencil_do_frame_fill(), knifetool_exit_ex(), loop_split_generator(), loop_split_worker(), paint_2d_bucket_fill(), TEST(), and view3d_preselect_mesh_edgering_update_edges_from_edge().
Returns true if the stack is empty, false otherwise
Definition at line 247 of file stack.c.
References BLI_assert, BLI_Stack::chunk_curr, BLI_Stack::elem_num, and NULL.
Referenced by BKE_lnor_space_define(), BLI_stack_discard(), BLI_stack_peek(), BLI_stack_pop(), bm_face_split(), bm_mesh_loops_calc_normals_for_loop(), bmo_collapse_exec(), bmo_collapsecon_do_layer(), bmo_subdivide_edges_exec(), build_edge_mats(), contract_shape(), blender::deg::deg_graph_flush_visibility_flags(), dilate_shape(), edbm_face_split_by_edges_exec(), filelist_readjob_recursive_dir_add_items(), gpencil_boundaryfill_area(), gpencil_points_from_stack(), knifetool_modal(), loop_split_worker_do(), paint_2d_bucket_fill(), 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 80 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 66 of file stack.c.
References BLI_Stack::chunk_elem_max, BLI_Stack::chunk_index, blender::io::obj::chunk_size, BLI_Stack::elem_size, MEM_callocN, and stack_chunk_elem_max_calc().
Referenced by BLI_stack_new().
Definition at line 166 of file stack.c.
References BLI_assert, BLI_stack_is_empty(), and stack_get_last_elem().
Referenced by BKE_lnor_space_define(), 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().
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 135 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(), contract_shape(), blender::deg::deg_graph_flush_visibility_flags(), dilate_shape(), edbm_face_split_by_edges_exec(), gpencil_boundaryfill_area(), gpencil_get_outline_points(), gpencil_points_from_stack(), knifetool_undo(), paint_2d_bucket_fill(), 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 144 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 154 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().
Copies the source value onto the stack
src | source data to be copied to the stack. |
Definition at line 129 of file stack.c.
References BLI_stack_push_r(), BLI_Stack::elem_size, and src.
Referenced by bm_face_split(), BM_mesh_edgeloops_find(), BM_mesh_edgeloops_find_path(), bm_mesh_loops_calc_normals_for_loop(), bmo_collapse_exec(), bmo_collapsecon_do_layer(), build_edge_mats(), build_emats_stack(), contract_shape(), blender::deg::deg_graph_flush_visibility_flags(), dilate_shape(), edbm_face_split_by_edges_exec(), gpencil_boundaryfill_area(), gpencil_get_outline_points(), knife_split_edge(), paint_2d_bucket_fill(), paint_2d_fill_add_pixel_byte(), paint_2d_fill_add_pixel_float(), split_loop_nor_fan_do(), TEST(), and view3d_preselect_mesh_edgering_update_edges_from_edge().
Push a new item onto the stack.
Definition at line 101 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 49 of file stack.c.
References BLI_assert, CHUNK_ELEM_MIN, blender::io::obj::chunk_size, MEM_SIZE_OVERHEAD, and UNLIKELY.
Referenced by BLI_stack_new_ex().
|
static |
Definition at line 85 of file stack.c.
References data, and MEM_freeN.
Referenced by BLI_stack_free().
Definition at line 41 of file stack.c.
Referenced by BLI_stack_peek(), BLI_stack_pop(), and BLI_stack_push_r().