This is Unofficial EPICS BASE Doxygen Site
bucketLib.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
22 #ifndef INCbucketLibh
23 #define INCbucketLibh
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "errMdef.h"
30 #include "epicsTypes.h"
31 #include "libComAPI.h"
32 
34 typedef unsigned BUCKETID;
35 
38 
40 typedef struct item{
41  struct item *pItem;
42  const void *pId;
43  const void *pApp;
44  buckTypeOfId type;
45 }ITEM;
46 
48 typedef struct bucket{
50  void *freeListPVT;
51  unsigned hashIdMask;
52  unsigned hashIdNBits;
53  unsigned nInUse;
54 }BUCKET;
60 LIBCOM_API BUCKET * epicsStdCall bucketCreate (unsigned nHashTableEntries);
67 LIBCOM_API int epicsStdCall bucketFree (BUCKET *prb);
73 LIBCOM_API int epicsStdCall bucketShow (BUCKET *prb);
74 
82 LIBCOM_API int epicsStdCall bucketAddItemUnsignedId (BUCKET *prb,
83  const unsigned *pId, const void *pApp);
91 LIBCOM_API int epicsStdCall bucketAddItemPointerId (BUCKET *prb,
92  void * const *pId, const void *pApp);
100 LIBCOM_API int epicsStdCall bucketAddItemStringId (BUCKET *prb,
101  const char *pId, const void *pApp);
108 LIBCOM_API int epicsStdCall bucketRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId);
115 LIBCOM_API int epicsStdCall bucketRemoveItemPointerId (BUCKET *prb, void * const *pId);
122 LIBCOM_API int epicsStdCall bucketRemoveItemStringId (BUCKET *prb, const char *pId);
129 LIBCOM_API void * epicsStdCall bucketLookupItemUnsignedId (BUCKET *prb, const unsigned *pId);
136 LIBCOM_API void * epicsStdCall bucketLookupItemPointerId (BUCKET *prb, void * const *pId);
143 LIBCOM_API void * epicsStdCall bucketLookupItemStringId (BUCKET *prb, const char *pId);
144 
151 LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemUnsignedId (BUCKET *prb, const unsigned *pId);
158 LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemPointerId (BUCKET *prb, void * const *pId);
165 LIBCOM_API void * epicsStdCall bucketLookupAndRemoveItemStringId (BUCKET *prb, const char *pId);
166 
167 
175 #define BUCKET_SUCCESS S_bucket_success
176 
179 #define S_bucket_success 0
180 
183 #define S_bucket_noMemory (M_bucket | 1) /*Memory allocation failed*/
184 
187 #define S_bucket_idInUse (M_bucket | 2) /*Identifier already in use*/
188 
191 #define S_bucket_uknId (M_bucket | 3) /*Unknown identifier*/
192 
194 #ifdef __cplusplus
195 }
196 #endif
197 
198 #endif /*INCbucketLibh*/
const void * pId
Definition: bucketLib.h:42
struct item * pItem
Definition: bucketLib.h:41
buckTypeOfId type
Definition: bucketLib.h:44
unsigned nInUse
Definition: bucketLib.h:53
unsigned hashIdMask
Definition: bucketLib.h:51
LIBCOM_API int epicsStdCall bucketAddItemPointerId(BUCKET *prb, void *const *pId, const void *pApp)
Add an item identified by a pointer to the table.
Definition: bucketLib.c:313
unsigned hashIdNBits
Definition: bucketLib.h:52
const void * pApp
Definition: bucketLib.h:43
Internal: bucket item structure.
Definition: bucketLib.h:40
LIBCOM_API void *epicsStdCall bucketLookupAndRemoveItemPointerId(BUCKET *prb, void *const *pId)
Find and delete an item identified by a pointer from the table.
Definition: bucketLib.c:401
LIBCOM_API int epicsStdCall bucketRemoveItemUnsignedId(BUCKET *prb, const unsigned *pId)
Remove an item identified by a string from the table.
Definition: bucketLib.c:415
LIBCOM_API void *epicsStdCall bucketLookupAndRemoveItemStringId(BUCKET *prb, const char *pId)
Find and delete an item identified by a string from the table.
Definition: bucketLib.c:405
LIBCOM_API void *epicsStdCall bucketLookupItemPointerId(BUCKET *prb, void *const *pId)
Find an item identified by a pointer in the table.
Definition: bucketLib.c:440
ITEM ** pTable
Definition: bucketLib.h:49
buckTypeOfId
Internal: bucket key type.
Definition: bucketLib.h:37
void * freeListPVT
Definition: bucketLib.h:50
struct bucket BUCKET
Internal: Hash table structure.
struct item ITEM
Internal: bucket item structure.
LIBCOM_API void *epicsStdCall bucketLookupAndRemoveItemUnsignedId(BUCKET *prb, const unsigned *pId)
Find and delete an item identified by an unsigned int from the table.
Definition: bucketLib.c:397
LIBCOM_API void *epicsStdCall bucketLookupItemUnsignedId(BUCKET *prb, const unsigned *pId)
Find an item identified by an unsigned int in the table.
Definition: bucketLib.c:435
LIBCOM_API int epicsStdCall bucketRemoveItemStringId(BUCKET *prb, const char *pId)
Remove an item identified by a string from the table.
Definition: bucketLib.c:425
LIBCOM_API int epicsStdCall bucketFree(BUCKET *prb)
Release memory used by a hash table.
Definition: bucketLib.c:285
unsigned BUCKETID
Internal: bucket identifier.
Definition: bucketLib.h:34
LIBCOM_API int epicsStdCall bucketRemoveItemPointerId(BUCKET *prb, void *const *pId)
Remove an item identified by a pointer from the table.
Definition: bucketLib.c:420
LIBCOM_API int epicsStdCall bucketAddItemStringId(BUCKET *prb, const char *pId, const void *pApp)
Add an item identified by a string to the table.
Definition: bucketLib.c:318
LIBCOM_API int epicsStdCall bucketAddItemUnsignedId(BUCKET *prb, const unsigned *pId, const void *pApp)
Add an item identified by an unsigned int to the table.
Definition: bucketLib.c:308
LIBCOM_API BUCKET *epicsStdCall bucketCreate(unsigned nHashTableEntries)
Creates a new hash table.
Definition: bucketLib.c:218
LIBCOM_API void *epicsStdCall bucketLookupItemStringId(BUCKET *prb, const char *pId)
Find an item identified by a string in the table.
Definition: bucketLib.c:445
LIBCOM_API int epicsStdCall bucketShow(BUCKET *prb)
Display information about a hash table.
Definition: bucketLib.c:476
Internal: Hash table structure.
Definition: bucketLib.h:48