Point Cloud Library (PCL)  1.9.1
opennurbs_memory.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #if !defined(OPENNURBS_MEMORY_INC_)
18 #define OPENNURBS_MEMORY_INC_
19 
20 #if defined (cplusplus) || defined(_cplusplus) || defined(__cplusplus)
21 extern "C" {
22 #endif
23 
24 ON_DECL
25 size_t ON_MemoryPageSize();
26 
27 #define ON_MEMORY_POOL void
28 
29 ON_DECL
30 ON_MEMORY_POOL* ON_MainMemoryPool(void);
31 
32 ON_DECL
33 ON_MEMORY_POOL* ON_WorkerMemoryPool(void);
34 
35 ON_DECL
36 void* onmalloc( size_t );
37 
38 ON_DECL
39 void* onmalloc_from_pool( ON_MEMORY_POOL*, size_t );
40 
41 ON_DECL
42 void* oncalloc( size_t, size_t );
43 
44 ON_DECL
45 void* oncalloc_from_pool( ON_MEMORY_POOL*, size_t, size_t );
46 
47 ON_DECL
48 void onfree( void* );
49 
50 ON_DECL
51 void* onrealloc( void*, size_t );
52 
53 ON_DECL
54 void* onrealloc_from_pool( ON_MEMORY_POOL*, void*, size_t );
55 
56 ON_DECL
57 size_t onmsize( const void* );
58 
59 ON_DECL
60 void* onmemdup( const void*, size_t );
61 
62 ON_DECL
63 char* onstrdup( const char* );
64 
65 #if defined(_WCHAR_T_DEFINED)
66 ON_DECL
67 wchar_t* onwcsdup( const wchar_t* );
68 #endif
69 
70 ON_DECL
71 unsigned char* onmbsdup( const unsigned char* );
72 
73 ON_DECL
74 size_t onmemoryusecount(
75  size_t* malloc_count,
76  size_t* realloc_count,
77  size_t* free_count,
78  size_t* pool_count
79  );
80 
81 ON_DECL
82 size_t onmemoryusecountex(
83  size_t* malloc_count,
84  size_t* realloc_count,
85  size_t* free_count,
86  size_t* pool_count,
87  size_t* malloc_zero_count,
88  size_t* free_null_count
89  );
90 
91 /* define to handle _TCHAR* ontcsdup( const _TCHAR* ) */
92 #if defined(_UNICODE)
93 #define ontcsdup onwcsdup
94 #elif defined(_MBCS)
95 #define ontcsdup onmbsdup
96 #else
97 #define ontcsdup onstrdup
98 #endif
99 
100 #if defined (cplusplus) || defined(_cplusplus) || defined(__cplusplus)
101 }
102 #endif
103 
104 #endif