Blender  V2.93
BLI_memiter.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
23 #include "BLI_compiler_attrs.h"
24 #include "BLI_compiler_compat.h"
25 #include "BLI_sys_types.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /* 512kb, good default for small elems. */
32 #define BLI_MEMITER_DEFAULT_SIZE (1 << 19)
33 
34 struct BLI_memiter;
35 
36 typedef struct BLI_memiter BLI_memiter;
37 
38 /* warning, ATTR_MALLOC flag on BLI_memiter_alloc causes crash, see: D2756 */
42  ATTR_NONNULL(1);
43 void BLI_memiter_alloc_from(BLI_memiter *mi, uint elem_size, const void *data_from)
44  ATTR_NONNULL(1, 3);
47  ATTR_NONNULL(1);
51 
52 /* utils */
54 void *BLI_memiter_elem_first_size(BLI_memiter *mi, unsigned int *r_size);
55 
56 /* private structure */
57 typedef struct BLI_memiter_handle {
61 
66  ATTR_NONNULL();
67 
68 #ifdef __cplusplus
69 }
70 #endif
struct Object ATTR_RETURNS_NONNULL
Definition: BKE_object.h:138
#define ATTR_MALLOC
#define ATTR_NONNULL(...)
void BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() ATTR_WARN_UNUSED_RESULT
void BLI_memiter_destroy(BLI_memiter *mi) ATTR_NONNULL(1)
Definition: BLI_memiter.c:241
void BLI_memiter_iter_init(BLI_memiter *mi, BLI_memiter_handle *iter) ATTR_NONNULL()
Definition: BLI_memiter.c:299
struct BLI_memiter_handle BLI_memiter_handle
void BLI_memiter_alloc_from(BLI_memiter *mi, uint elem_size, const void *data_from) ATTR_NONNULL(1
unsigned int BLI_memiter_count(const BLI_memiter *mi) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_memiter.c:253
void * BLI_memiter_iter_step_size(BLI_memiter_handle *iter, uint *r_size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: BLI_memiter.c:319
void void * BLI_memiter_calloc(BLI_memiter *mi, unsigned int size) ATTR_RETURNS_NONNULL ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_memiter.c:214
void * BLI_memiter_iter_step(BLI_memiter_handle *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: BLI_memiter.c:336
BLI_memiter * BLI_memiter_create(unsigned int chunk_size) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition: BLI_memiter.c:137
void * BLI_memiter_alloc(BLI_memiter *mi, unsigned int size) ATTR_RETURNS_NONNULL ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_memiter.c:154
void * BLI_memiter_elem_first(BLI_memiter *mi)
Definition: BLI_memiter.c:265
bool BLI_memiter_iter_done(const BLI_memiter_handle *iter) ATTR_NONNULL()
Definition: BLI_memiter.c:305
void BLI_memiter_clear(BLI_memiter *mi) ATTR_NONNULL(1)
Definition: BLI_memiter.c:247
void * BLI_memiter_elem_first_size(BLI_memiter *mi, unsigned int *r_size)
Definition: BLI_memiter.c:275
unsigned int uint
Definition: BLI_sys_types.h:83
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
struct BLI_memiter_elem * elem
Definition: BLI_memiter.h:58