svn-gvsig-desktop / tags / v1_9_Build_1250 / libraries / libjni-ecwcompress / include / include-sdk / NCSMemPool.h @ 44644
History | View | Annotate | Download (2.16 KB)
1 | 3538 | nacho | /********************************************************
|
---|---|---|---|
2 | ** Copyright 1999 Earth Resource Mapping Ltd.
|
||
3 | ** This document contains proprietary source code of
|
||
4 | ** Earth Resource Mapping Ltd, and can only be used under
|
||
5 | ** one of the three licenses as described in the
|
||
6 | ** license.txt file supplied with this distribution.
|
||
7 | ** See separate license.txt file for license details
|
||
8 | ** and conditions.
|
||
9 | **
|
||
10 | ** This software is covered by US patent #6,442,298,
|
||
11 | ** #6,102,897 and #6,633,688. Rights to use these patents
|
||
12 | ** is included in the license agreements.
|
||
13 | **
|
||
14 | ** FILE: NCSMalloc.h
|
||
15 | ** CREATED: Thu Feb 25 09:19:00 WST 1999
|
||
16 | ** AUTHOR: Simon Cope
|
||
17 | ** PURPOSE: NCS Memory Pool types and protos.
|
||
18 | ** EDITS:
|
||
19 | *******************************************************/
|
||
20 | |||
21 | #ifndef NCSMEMPOOL_H
|
||
22 | #define NCSMEMPOOL_H
|
||
23 | |||
24 | #ifdef __cplusplus
|
||
25 | extern "C" { |
||
26 | #endif
|
||
27 | |||
28 | #ifndef NCSDEFS_H
|
||
29 | #include "NCSDefs.h" |
||
30 | #endif
|
||
31 | #ifndef NCSARRAY_H
|
||
32 | #include "NCSArray.h" |
||
33 | #endif
|
||
34 | #ifndef NCSMUTEX_H
|
||
35 | #include "NCSMutex.h" |
||
36 | #endif
|
||
37 | #ifndef NCSTIMESTAMP_H
|
||
38 | #include "NCSTimeStamp.h" |
||
39 | #endif
|
||
40 | #ifndef NCSTYPES_H
|
||
41 | #include "NCSTypes.h" |
||
42 | #endif
|
||
43 | |||
44 | /*
|
||
45 | ** Typedefs
|
||
46 | */
|
||
47 | |||
48 | typedef struct { |
||
49 | INT32 nElementsInUse; |
||
50 | INT32 iLastFreeElement; |
||
51 | void *pElements;
|
||
52 | BOOLEAN *pbElementInUse; |
||
53 | } NCSPoolNode; |
||
54 | |||
55 | typedef struct { |
||
56 | UINT32 iElementSize; |
||
57 | UINT32 nElementsPerNode; |
||
58 | UINT32 nNodes; |
||
59 | UINT32 nElementsInUse; |
||
60 | |||
61 | UINT32 nAddNodes; |
||
62 | NCSTimeStampMs tsAddNodeTime; |
||
63 | |||
64 | UINT32 nRemoveNodes; |
||
65 | NCSTimeStampMs tsRemoveNodeTime; |
||
66 | |||
67 | UINT32 nAllocElements; |
||
68 | NCSTimeStampMs tsAllocElementTime; |
||
69 | |||
70 | UINT32 nFreeElements; |
||
71 | NCSTimeStampMs tsFreeElementTime; |
||
72 | |||
73 | NCSMutexStats msPool; |
||
74 | } NCSPoolStats; |
||
75 | |||
76 | typedef struct { |
||
77 | NCSMutex mMutex; |
||
78 | NCSPoolStats psStats; |
||
79 | UINT32 nMaxElements; |
||
80 | BOOLEAN bCollectStats; |
||
81 | NCSPoolNode *pNodes; |
||
82 | } NCSPool; |
||
83 | |||
84 | /*
|
||
85 | ** Prototypes.
|
||
86 | */
|
||
87 | NCSPool *NCSPoolCreate(UINT32 iElementSize, UINT32 nElements); |
||
88 | void *NCSPoolAlloc(NCSPool *pPool, BOOLEAN bClear);
|
||
89 | void NCSPoolFree(NCSPool *pPool, void *pPtr); |
||
90 | void NCSPoolDestroy(NCSPool *pPool);
|
||
91 | void NCSPoolSetMaxSize(NCSPool *pPool, UINT32 nMaxElements);
|
||
92 | NCSPoolStats NCSPoolGetStats(NCSPool *pPool); |
||
93 | void NCSPoolEnableStats(NCSPool *pPool);
|
||
94 | void NCSPoolDisableStats(NCSPool *pPool);
|
||
95 | |||
96 | #ifdef __cplusplus
|
||
97 | } |
||
98 | #endif
|
||
99 | |||
100 | #endif /* NCSMEMPOOL_H */ |