Lines Matching full:oset
3 /*--- OSet: a fast data structure with no dups. pub_tool_oset.h ---*/
37 // duplicate to an OSet.
50 // (eg. in an OSet of integers, each integer serves both as an element and
58 // element. This fast comparison is suitable for an OSet containing
61 // Each OSet interface also has an iterator, which makes it simple to
65 // Note that once you insert an element into an OSet, if you modify any part
73 typedef struct _OSet OSet;
87 // * Create: allocates and initialises the OSet. Arguments:
89 // OSet and all its nodes.
102 extern OSet* VG_(OSetWord_Create) ( OSetAlloc_t alloc, HChar* cc,
104 extern void VG_(OSetWord_Destroy) ( OSet* os );
124 // * ResetIter: Each OSet has an iterator. This resets it to point to the
125 // first element in the OSet.
127 // * Next: Copies the next value according to the OSet's iterator into &val,
135 // VG_(OSetWord_ResetIter)(oset);
136 // while ( VG_(OSetWord_Next)(oset, &val) ) {
141 // removed from the OSet, to avoid possible mayhem caused by the iterator
142 // getting out of sync with the OSet's contents. "Cleared" means that
146 extern Word VG_(OSetWord_Size) ( OSet* os );
147 extern void VG_(OSetWord_Insert) ( OSet* os, UWord val );
148 extern Bool VG_(OSetWord_Contains) ( OSet* os, UWord val );
149 extern Bool VG_(OSetWord_Remove) ( OSet* os, UWord val );
150 extern void VG_(OSetWord_ResetIter) ( OSet* os );
151 extern Bool VG_(OSetWord_Next) ( OSet* os, /*OUT*/UWord* val );
155 /*--- Creating and destroying OSets and OSet members (Gen) ---*/
158 // * Create: allocates and initialises the OSet. Arguments:
161 // if the OSet should use fast comparisons.
162 // - alloc The allocation function used for allocating the OSet itself;
183 // * AllocNode: Allocate and zero memory for a node to go into the OSet.
186 // allocate a node which is big enough for both an element and the OSet
188 // Not all elements in one OSet have to be the same size.
199 extern OSet* VG_(OSetGen_Create) ( PtrdiffT keyOff, OSetCmp_t cmp,
204 extern OSet* VG_(OSetGen_Create_With_Pool) ( PtrdiffT keyOff, OSetCmp_t cmp,
209 // Same as VG_(OSetGen_Create) but created OSet will use a pool allocator to
211 // The node size is the sum of a fixed small meta data size needed for OSet
214 // (if poolSize is 0, maxEltSize is not relevant for the OSet).
215 // It is interesting to use a pool allocator when an OSet has many elements,
225 // If there are several OSet managing similar such elements, it might be
226 // interesting to use a shared pool for these OSet.
227 // To have multiple OSets sharing a pool allocator, create the first OSet
228 // with VG_(OSetGen_Create). Create subsequent OSet with
231 extern void VG_(OSetGen_Destroy) ( OSet* os );
232 extern void* VG_(OSetGen_AllocNode) ( OSet* os, SizeT elemSize );
233 extern void VG_(OSetGen_FreeNode) ( OSet* os, void* elem );
235 extern OSet* VG_(OSetGen_EmptyClone) (OSet* os);
236 // Creates a new empty OSet.
237 // The new OSet will have the same characteristics as os.
239 // the new OSet. A shared pool allocator is only deleted (and its memory is
240 // released) when the last OSet using the shared pool is destroyed.
257 // * Contains: Determines if any element in the OSet matches the key.
263 // which overrides the OSet's normal one.
268 // * ResetIter: Each OSet has an iterator. This resets it to point to the
269 // first element in the OSet.
276 // * Next: Returns a pointer to the element pointed to by the OSet's
278 // in order. Or, returns NULL if the iterator has reached the OSet's end.
282 // VG_(OSetGen_ResetIter)(oset);
283 // while ( (elem = VG_(OSetGen_Next)(oset)) ) {
288 // removed from the OSet, to avoid possible mayhem caused by the iterator
289 // getting out of sync with the OSet's contents. "Cleared" means that
293 extern Word VG_(OSetGen_Size) ( const OSet* os );
294 extern void VG_(OSetGen_Insert) ( OSet* os, void* elem );
295 extern Bool VG_(OSetGen_Contains) ( const OSet* os, const void* key );
296 extern void* VG_(OSetGen_Lookup) ( const OSet* os, const void* key );
297 extern void* VG_(OSetGen_LookupWithCmp)( OSet* os,
299 extern void* VG_(OSetGen_Remove) ( OSet* os, const void* key );
300 extern void VG_(OSetGen_ResetIter) ( OSet* os );
301 extern void VG_(OSetGen_ResetIterAt) ( OSet* os, const void* key );
302 extern void* VG_(OSetGen_Next) ( OSet* os );