Blender  V2.93
BLI_mempool.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  * The Original Code is Copyright (C) 2008 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 #pragma once
21 
26 #include "BLI_compiler_attrs.h"
27 #include "BLI_utildefines.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct BLI_mempool;
34 struct BLI_mempool_chunk;
35 
36 typedef struct BLI_mempool BLI_mempool;
37 
39  unsigned int totelem,
40  unsigned int pchunk,
44 void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1, 2);
45 void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve) ATTR_NONNULL(1);
50  ATTR_NONNULL(1);
51 
54  const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
55  ATTR_NONNULL(1, 2);
58  const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
59  ATTR_NONNULL(1, 2);
60 
61 #ifndef NDEBUG
63 #endif
64 
66 /* private structure */
67 typedef struct BLI_mempool_iter {
70  unsigned int curindex;
71 
74 
75 /* flag */
76 enum {
86 };
87 
90 
92  const size_t num_iter) ATTR_WARN_UNUSED_RESULT
93  ATTR_NONNULL();
95 
96 #ifdef __cplusplus
97 }
98 #endif
#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_mempool_calloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_mempool.c:362
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) ATTR_NONNULL()
Definition: BLI_mempool.c:537
@ BLI_MEMPOOL_ALLOW_ITER
Definition: BLI_mempool.h:85
@ BLI_MEMPOOL_NOP
Definition: BLI_mempool.h:77
BLI_mempool_iter * BLI_mempool_iter_threadsafe_create(BLI_mempool *pool, const size_t num_iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: BLI_mempool.c:561
void void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve) ATTR_NONNULL(1)
Definition: BLI_mempool.c:694
void * BLI_mempool_iterstep(BLI_mempool_iter *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: BLI_mempool.c:645
void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1
void void void void void BLI_mempool_set_memory_debug(void)
Definition: BLI_mempool.c:769
void void void void * BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
BLI_mempool * BLI_mempool_create(unsigned int esize, unsigned int totelem, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition: BLI_mempool.c:268
void BLI_mempool_as_table(BLI_mempool *pool, void **data) ATTR_NONNULL(1
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_mempool.c:334
struct BLI_mempool_iter BLI_mempool_iter
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
Definition: BLI_mempool.c:757
void BLI_mempool_clear(BLI_mempool *pool) ATTR_NONNULL(1)
Definition: BLI_mempool.c:749
void * BLI_mempool_findelem(BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_mempool.c:459
int BLI_mempool_len(BLI_mempool *pool) ATTR_NONNULL(1)
Definition: BLI_mempool.c:454
void void void BLI_mempool_as_array(BLI_mempool *pool, void *data) ATTR_NONNULL(1
void void ** BLI_mempool_as_tableN(BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void BLI_mempool_iter_threadsafe_free(BLI_mempool_iter *iter_arr) ATTR_NONNULL()
Definition: BLI_mempool.c:583
struct BLI_mempool_chunk * curchunk
Definition: BLI_mempool.h:69
BLI_mempool * pool
Definition: BLI_mempool.h:68
unsigned int curindex
Definition: BLI_mempool.h:70
struct BLI_mempool_chunk ** curchunk_threaded_shared
Definition: BLI_mempool.h:72