Lines Matching defs:OSet

3 /*--- OSet: a fast data structure with no dups.    pub_tool_oset.h ---*/
39 // duplicate to an OSet.
52 // (eg. in an OSet of integers, each integer serves both as an element and
60 // element. This fast comparison is suitable for an OSet containing
66 // Each OSet interface also has an iterator, which makes it simple to
70 // Note that once you insert an element into an OSet, if you modify any part
78 typedef struct _OSet OSet;
92 // * Create: allocates and initialises the OSet. Never returns NULL.
95 // OSet and all its nodes. It must not return NULL (that is,
106 extern OSet* VG_(OSetWord_Create) ( OSetAlloc_t alloc_fn, const HChar* cc,
108 extern void VG_(OSetWord_Destroy) ( OSet* os );
128 // * ResetIter: Each OSet has an iterator. This resets it to point to the
129 // first element in the OSet.
131 // * Next: Copies the next value according to the OSet's iterator into &val,
145 // removed from the OSet, to avoid possible mayhem caused by the iterator
146 // getting out of sync with the OSet's contents. "Cleared" means that
150 extern Word VG_(OSetWord_Size) ( const OSet* os );
151 extern void VG_(OSetWord_Insert) ( OSet* os, UWord val );
152 extern Bool VG_(OSetWord_Contains) ( const OSet* os, UWord val );
153 extern Bool VG_(OSetWord_Remove) ( OSet* os, UWord val );
154 extern void VG_(OSetWord_ResetIter) ( OSet* os );
155 extern Bool VG_(OSetWord_Next) ( OSet* os, /*OUT*/UWord* val );
159 /*--- Creating and destroying OSets and OSet members (Gen) ---*/
162 // * Create: allocates and initialises the OSet. Never returns NULL.
166 // if the OSet should use fast comparisons.
167 // - alloc_fn The allocation function used for allocating the OSet itself;
190 // * AllocNode: Allocate and zero memory for a node to go into the OSet.
193 // allocate a node which is big enough for both an element and the OSet
195 // Not all elements in one OSet have to be the same size.
206 extern OSet* VG_(OSetGen_Create) ( PtrdiffT keyOff, OSetCmp_t cmp,
211 extern OSet* VG_(OSetGen_Create_With_Pool) ( PtrdiffT keyOff, OSetCmp_t cmp,
217 // Same as VG_(OSetGen_Create) but created OSet will use a pool allocator to
219 // The node size is the sum of a fixed small meta data size needed for OSet
222 // (if poolSize is 0, maxEltSize is not relevant for the OSet).
223 // It is interesting to use a pool allocator when an OSet has many elements,
233 // If there are several OSet managing similar such elements, it might be
234 // interesting to use a shared pool for these OSet.
235 // To have multiple OSets sharing a pool allocator, create the first OSet
236 // with VG_(OSetGen_Create_With_Pool). Create subsequent OSet with
239 extern void VG_(OSetGen_Destroy) ( OSet* os );
240 extern void* VG_(OSetGen_AllocNode) ( const OSet* os, SizeT elemSize );
241 extern void VG_(OSetGen_FreeNode) ( const OSet* os, void* elem );
243 extern OSet* VG_(OSetGen_EmptyClone) (const OSet* os);
244 // Creates a new empty OSet.
245 // The new OSet will have the same characteristics as os.
247 // the new OSet. A shared pool allocator is only deleted (and its memory is
248 // released) when the last OSet using the shared pool is destroyed.
265 // * Contains: Determines if any element in the OSet matches the key.
271 // which overrides the OSet's normal one.
276 // * ResetIter: Each OSet has an iterator. This resets it to point to the
277 // first element in the OSet.
284 // * Next: Returns a pointer to the element pointed to by the OSet's
286 // in order. Or, returns NULL if the iterator has reached the OSet's end.
296 // removed from the OSet, to avoid possible mayhem caused by the iterator
297 // getting out of sync with the OSet's contents. "Cleared" means that
301 extern UInt VG_(OSetGen_Size) ( const OSet* os );
302 extern void VG_(OSetGen_Insert) ( OSet* os, void* elem );
303 extern Bool VG_(OSetGen_Contains) ( const OSet* os, const void* key );
304 extern void* VG_(OSetGen_Lookup) ( const OSet* os, const void* key );
305 extern void* VG_(OSetGen_LookupWithCmp)( OSet* os,
307 extern void* VG_(OSetGen_Remove) ( OSet* os, const void* key );
308 extern void VG_(OSetGen_ResetIter) ( OSet* os );
309 extern void VG_(OSetGen_ResetIterAt) ( OSet* os, const void* key );
310 extern void* VG_(OSetGen_Next) ( OSet* os );