Support WITH_CXX_GUARDEDALLOC for dualcon library

This commit is contained in:
Campbell Barton 2013-08-04 17:58:17 +00:00
parent d2dbc0b85e
commit 35db9c5e70
13 changed files with 76 additions and 31 deletions

@ -23,6 +23,10 @@
#ifndef __DUALCON_H__ #ifndef __DUALCON_H__
#define __DUALCON_H__ #define __DUALCON_H__
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

@ -20,8 +20,8 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef GEOCOMMON_H #ifndef __GEOCOMMON_H__
#define GEOCOMMON_H #define __GEOCOMMON_H__
#define UCHAR unsigned char #define UCHAR unsigned char
#define USHORT unsigned short #define USHORT unsigned short
@ -61,4 +61,4 @@ typedef struct {
} BoundingBoxf; } BoundingBoxf;
#endif #endif /* __GEOCOMMON_H__ */

@ -20,8 +20,8 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef MEMORYALLOCATOR_H #ifndef __MEMORYALLOCATOR_H__
#define MEMORYALLOCATOR_H #define __MEMORYALLOCATOR_H__
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -53,6 +53,11 @@ virtual void printInfo( ) = 0;
virtual int getAllocated( ) = 0; virtual int getAllocated( ) = 0;
virtual int getAll( ) = 0; virtual int getAll( ) = 0;
virtual int getBytes( ) = 0; virtual int getBytes( ) = 0;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:VirtualMemoryAllocator")
#endif
}; };
/** /**
@ -216,6 +221,11 @@ int getBytes( )
{ {
return N; return N;
}; };
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:MemoryAllocator")
#endif
}; };
#endif #endif /* __MEMORYALLOCATOR_H__ */

@ -20,8 +20,8 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef MODELREADER_H #ifndef __MODELREADER_H__
#define MODELREADER_H #define __MODELREADER_H__
#include "GeoCommon.h" #include "GeoCommon.h"
@ -59,7 +59,11 @@ virtual int getNumVertices( ) = 0;
virtual void getNextVertex(float v[3]) = 0; virtual void getNextVertex(float v[3]) = 0;
virtual void printInfo( ) = 0; virtual void printInfo( ) = 0;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:ModelReader")
#endif
}; };
#endif /* __MODELREADER_H__ */
#endif

@ -20,6 +20,10 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
#include <math.h> #include <math.h>
#include "Projections.h" #include "Projections.h"

@ -20,8 +20,8 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef PROJECTIONS_H #ifndef __PROJECTIONS_H__
#define PROJECTIONS_H #define __PROJECTIONS_H__
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -125,6 +125,11 @@ public:
int isIntersectingPrimary(int edgeInd) const; int isIntersectingPrimary(int edgeInd) const;
float getIntersectionPrimary(int edgeInd) const; float getIntersectionPrimary(int edgeInd) const;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:CubeTriangleIsect")
#endif
}; };
#endif #endif /* __PROJECTIONS_H__ */

@ -20,8 +20,8 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef QUEUE_H #ifndef __QUEUE_H__
#define QUEUE_H #define __QUEUE_H__
struct gridQueueEle { struct gridQueueEle {
int x, y, z; int x, y, z;
@ -99,10 +99,10 @@ int popQueue(int st[3], int& dir)
return 1; return 1;
} }
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:GridQueue")
#endif
}; };
#endif /* __QUEUE_H__ */
#endif

@ -20,8 +20,8 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef CUBES_H #ifndef __CUBES_H__
#define CUBES_H #define __CUBES_H__
#include "marching_cubes_table.h" #include "marching_cubes_table.h"
@ -41,6 +41,11 @@ void getTriangle(int mask, int index, int indices[3])
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
indices[i] = marching_cubes_tris[mask][index][i]; indices[i] = marching_cubes_tris[mask][index][i];
} }
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:Cubes")
#endif
}; };
#endif #endif /* __CUBES_H__ */

@ -185,6 +185,11 @@ void printInfo() {
int getMemory() { int getMemory() {
return sizeof(DualConInputReader); return sizeof(DualConInputReader);
} }
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:DualConInputReader")
#endif
}; };
void *dualcon(const DualConInput *input_mesh, void *dualcon(const DualConInput *input_mesh,

@ -20,8 +20,8 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef MANIFOLD_TABLE_H #ifndef __MANIFOLD_TABLE_H__
#define MANIFOLD_TABLE_H #define __MANIFOLD_TABLE_H__
typedef struct { typedef struct {
int comps; int comps;
@ -30,4 +30,4 @@ typedef struct {
extern const ManifoldIndices manifold_table[256]; extern const ManifoldIndices manifold_table[256];
#endif #endif /* __MANIFOLD_TABLE_H__ */

@ -20,8 +20,8 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef MARCHING_CUBES_TABLE_H #ifndef __MARCHING_CUBES_TABLE_H__
#define MARCHING_CUBES_TABLE_H #define __MARCHING_CUBES_TABLE_H__
/* number of configurations */ /* number of configurations */
#define TOTCONF 256 #define TOTCONF 256

@ -20,6 +20,10 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
#include "octree.h" #include "octree.h"
#include <Eigen/Dense> #include <Eigen/Dense>
#include <limits> #include <limits>

@ -20,8 +20,8 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef OCTREE_H #ifndef __OCTREE_H__
#define OCTREE_H #define __OCTREE_H__
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
@ -1388,6 +1388,10 @@ class Octree
removeInternal(num - 1, par); removeInternal(num - 1, par);
return npar; return npar;
} }
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:Octree")
#endif
}; };
#endif #endif /* __OCTREE_H__ */