|
Blender V5.0
|
Efficient in-memory storage of multiple similar arrays. More...
#include "BLI_sys_types.h"Go to the source code of this file.
Typedefs | |
| typedef struct BArrayState | BArrayState |
| typedef struct BArrayStore | BArrayStore |
Efficient in-memory storage of multiple similar arrays.
Definition in file BLI_array_store.h.
| typedef struct BArrayState BArrayState |
Definition at line 14 of file BLI_array_store.h.
| typedef struct BArrayStore BArrayStore |
Definition at line 15 of file BLI_array_store.h.
| size_t BLI_array_store_calc_size_compacted_get | ( | const BArrayStore * | bs | ) |
Definition at line 1607 of file array_store.cc.
References BLI_assert, BLI_mempool_iternew(), BLI_mempool_iterstep(), BArrayMemory::chunk, BChunk::data_len, BArrayStore::memory, and BChunk::users.
Referenced by BLI_array_store_at_size_calc_memory_usage(), random_chunk_mutate_helper(), TEST(), TEST(), TEST(), and text_undosys_step_encode_to_state().
| size_t BLI_array_store_calc_size_expanded_get | ( | const BArrayStore * | bs | ) |
Find the memory used by all states (expanded & real).
Definition at line 1598 of file array_store.cc.
References LISTBASE_FOREACH, state, and BArrayStore::states.
Referenced by BLI_array_store_at_size_calc_memory_usage(), TEST(), and TEST().
| void BLI_array_store_clear | ( | BArrayStore * | bs | ) |
Clear all contents, allowing reuse of bs.
Definition at line 1581 of file array_store.cc.
References array_store_free_data(), BLI_listbase_clear(), BLI_mempool_clear(), BArrayMemory::chunk, BArrayMemory::chunk_list, BArrayMemory::chunk_ref, BArrayStore::memory, and BArrayStore::states.
| BArrayStore * BLI_array_store_create | ( | unsigned int | stride, |
| unsigned int | chunk_count ) |
Create a new array store, which can store any number of arrays as long as their stride matches.
| stride | sizeof() each element, |
| chunk_count | Number of elements to split each chunk into.
|
Definition at line 1493 of file array_store.cc.
References BArrayInfo::accum_read_ahead_bytes, BArrayInfo::accum_read_ahead_len, BArrayInfo::accum_steps, BCHUNK_HASH_TABLE_ACCUMULATE_STEPS_16BITS, BCHUNK_HASH_TABLE_ACCUMULATE_STEPS_32BITS, BCHUNK_HASH_TABLE_ACCUMULATE_STEPS_8BITS, BCHUNK_HASH_TABLE_ACCUMULATE_STEPS_DEFAULT, BCHUNK_SIZE_MAX_MUL, BCHUNK_SIZE_MIN_DIV, BLI_assert, BLI_MEMPOOL_ALLOW_ITER, BLI_mempool_create(), BLI_MEMPOOL_NOP, BArrayMemory::chunk, BArrayInfo::chunk_byte_size, BArrayInfo::chunk_byte_size_max, BArrayInfo::chunk_byte_size_min, BArrayMemory::chunk_list, BArrayMemory::chunk_ref, BArrayInfo::chunk_stride, BArrayStore::info, MEM_callocN(), BArrayStore::memory, and UNLIKELY.
Referenced by BLI_array_store_at_size_ensure(), random_chunk_mutate_helper(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), testbuffer_run_tests_simple(), and text_undosys_step_encode_to_state().
| void BLI_array_store_destroy | ( | BArrayStore * | bs | ) |
Free the BArrayStore, including all states and chunks.
Definition at line 1570 of file array_store.cc.
References array_store_free_data(), BLI_mempool_destroy(), BArrayMemory::chunk, BArrayMemory::chunk_list, BArrayMemory::chunk_ref, MEM_freeN(), and BArrayStore::memory.
Referenced by BLI_array_store_at_size_clear(), random_chunk_mutate_helper(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), testbuffer_run_tests_simple(), and text_undosys_step_free().
| bool BLI_array_store_is_valid | ( | BArrayStore * | bs | ) |
Definition at line 1733 of file array_store.cc.
References bchunk_list_size(), BLI_ghash_free(), BLI_ghash_len(), BLI_ghash_ptr_new(), BLI_ghashIterator_getKey(), BLI_ghashIterator_getValue(), BLI_listbase_count(), BLI_mempool_iternew(), BLI_mempool_iterstep(), BLI_mempool_len(), BArrayMemory::chunk, BArrayInfo::chunk_byte_size_min, BArrayMemory::chunk_list, BArrayMemory::chunk_ref, BChunkList::chunk_refs, BChunkList::chunk_refs_len, BChunk::data, BChunk::data_len, GHASH_ITER, GHASH_PTR_ADD_USER, BArrayStore::info, BChunkRef::link, LISTBASE_FOREACH, MEM_allocN_len, BArrayStore::memory, POINTER_AS_INT, state, BArrayStore::states, BChunkList::total_expanded_size, BChunk::users, BChunkList::users, and users.
Referenced by TEST(), and testbuffer_run_tests_single().
| void BLI_array_store_rle_decode | ( | const uint8_t * | data_enc, |
| const size_t | data_enc_len, | ||
| void * | data_dec_v, | ||
| const size_t | data_dec_len ) |
Decode a run-length encoded array, writing the result into data_dec_v.
| data_enc | The data to encode (returned by BLI_array_store_rle_encode). |
| data_enc_len | The size of data_enc. |
| data_dec | The destination for the decoded data to be written to. |
| data_dec_len | The size of the destination (as passed to BLI_array_store_rle_encode). |
Definition at line 380 of file array_store_rle.cc.
References BLI_assert, e, and UNUSED_VARS_NDEBUG.
Referenced by rle_encode_decode_test(), and um_arraystore_cd_expand().
| uint8_t * BLI_array_store_rle_encode | ( | const uint8_t * | data_dec, |
| size_t | data_dec_len, | ||
| size_t | data_enc_extra_size, | ||
| size_t * | r_data_enc_len ) |
Return a run-length encoded copy of data_dec.
| data_dec | The data to encode. |
| data_dec_len | The size of the data to encode. |
| data_enc_extra_size | Allocate extra memory at the beginning of the array.
|
| r_data_enc_len | The size of the resulting RLE encoded data. |
Definition at line 244 of file array_store_rle.cc.
References BLI_assert, e, find_byte_not_equal_to(), LIKELY, MEM_malloc_arrayN(), rle_link_chunk_elem_new(), rle_link_chunk_free_all(), rle_link_chunk_iter_new(), rle_link_chunk_iter_step(), rle_link_chunk_new(), UNLIKELY, and value_start.
Referenced by rle_encode_decode_test(), and um_arraystore_cd_compact().
| BArrayState * BLI_array_store_state_add | ( | BArrayStore * | bs, |
| const void * | data, | ||
| size_t | data_len, | ||
| const BArrayState * | state_reference ) |
| data | Data used to create |
| state_reference | The state to use as a reference when adding the new state, typically this is the previous state, however it can be any previously created state from this bs. |
Definition at line 1626 of file array_store.cc.
References bchunk_list_fill_from_array(), bchunk_list_from_data_merge(), bchunk_list_new(), BLI_addtail(), BLI_array_store_state_data_get_alloc(), BLI_assert, BLI_findindex(), BArrayState::chunk_list, BArrayInfo::chunk_stride, data, BArrayStore::info, MEM_callocN(), MEM_freeN(), BArrayStore::memory, state, BArrayStore::states, and BChunkList::users.
Referenced by TEST(), TEST(), TEST(), TEST(), testbuffer_list_store_populate(), text_state_encode(), and um_arraystore_cd_compact().
| void BLI_array_store_state_data_get | ( | const BArrayState * | state, |
| void * | data ) |
Fill in existing allocated memory with the contents of state.
Definition at line 1691 of file array_store.cc.
References BLI_assert, BChunk::data, data, BChunk::data_len, BChunkRef::link, LISTBASE_FOREACH, state, and BChunk::users.
Referenced by BLI_array_store_state_data_get_alloc().
| void * BLI_array_store_state_data_get_alloc | ( | const BArrayState * | state, |
| size_t * | r_data_len ) |
Allocate an array for state and return it.
Definition at line 1709 of file array_store.cc.
References BLI_array_store_state_data_get(), data, MEM_mallocN(), and state.
Referenced by BLI_array_store_state_add(), TEST(), TEST(), TEST(), testbuffer_item_validate(), text_state_decode(), um_arraystore_cd_expand(), and um_arraystore_expand().
| void BLI_array_store_state_remove | ( | BArrayStore * | bs, |
| BArrayState * | state ) |
Remove a state and free any unused BChunk data.
The states can be freed in any order.
Definition at line 1674 of file array_store.cc.
References bchunk_list_decref(), BLI_assert, BLI_findindex(), BLI_remlink(), MEM_freeN(), BArrayStore::memory, state, and BArrayStore::states.
Referenced by TEST(), testbuffer_list_store_clear(), text_undosys_step_free(), um_arraystore_cd_free(), and um_arraystore_free().
| size_t BLI_array_store_state_size_get | ( | const BArrayState * | state | ) |
Definition at line 1686 of file array_store.cc.
References state.
Referenced by TEST().