225 * the old map shall share the data pointers |
225 * the old map shall share the data pointers |
226 * @param data additional data for the copy function |
226 * @param data additional data for the copy function |
227 * @return the cloned map |
227 * @return the cloned map |
228 * @see ucx_map_copy() |
228 * @see ucx_map_copy() |
229 */ |
229 */ |
230 UcxMap *ucx_map_clone(UcxMap *map, copy_func fnc, void *data); |
230 UcxMap *ucx_map_clone(UcxMap const *map, copy_func fnc, void *data); |
|
231 |
|
232 /** |
|
233 * Clones the map and rehashes if necessary. |
|
234 * |
|
235 * <b>Note:</b> In contrast to ucx_map_rehash() the load factor is irrelevant. |
|
236 * This function <i>always</i> ensures a new UcxMap.size of at least |
|
237 * 2.5*UcxMap.count. |
|
238 * |
|
239 * @param allocator the allocator to use for the cloned map |
|
240 * @param map the map to clone |
|
241 * @param fnc the copy function to use or <code>NULL</code> if the new and |
|
242 * the old map shall share the data pointers |
|
243 * @param data additional data for the copy function |
|
244 * @return the cloned map |
|
245 * @see ucx_map_copy() |
|
246 */ |
|
247 UcxMap *ucx_map_clone_a(UcxAllocator *allocator, |
|
248 UcxMap const *map, copy_func fnc, void *data); |
231 |
249 |
232 /** |
250 /** |
233 * Increases size of the hash map, if necessary. |
251 * Increases size of the hash map, if necessary. |
234 * |
252 * |
235 * The load value is 0.75*UcxMap.size. If the element count exceeds the load |
253 * The load value is 0.75*UcxMap.size. If the element count exceeds the load |
424 * @return 1, if another element was found, 0 if all elements has been processed |
442 * @return 1, if another element was found, 0 if all elements has been processed |
425 * @see ucx_map_iterator() |
443 * @see ucx_map_iterator() |
426 */ |
444 */ |
427 int ucx_map_iter_next(UcxMapIterator *iterator, UcxKey *key, void **value); |
445 int ucx_map_iter_next(UcxMapIterator *iterator, UcxKey *key, void **value); |
428 |
446 |
|
447 /** |
|
448 * Returns the union of two maps. |
|
449 * |
|
450 * The union is a fresh map which is filled by two successive calls of |
|
451 * ucx_map_copy() on the two input maps. |
|
452 * |
|
453 * @param first the first source map |
|
454 * @param second the second source map |
|
455 * @param cpfnc a function to copy the elements |
|
456 * @param cpdata additional data for the copy function |
|
457 * @return a new map containing the union |
|
458 */ |
|
459 UcxMap* ucx_map_union(const UcxMap *first, const UcxMap *second, |
|
460 copy_func cpfnc, void* cpdata); |
|
461 |
|
462 /** |
|
463 * Returns the union of two maps. |
|
464 * |
|
465 * The union is a fresh map which is filled by two successive calls of |
|
466 * ucx_map_copy() on the two input maps. |
|
467 * |
|
468 * @param allocator the allocator that shall be used by the new map |
|
469 * @param first the first source map |
|
470 * @param second the second source map |
|
471 * @param cpfnc a function to copy the elements |
|
472 * @param cpdata additional data for the copy function |
|
473 * @return a new map containing the union |
|
474 */ |
|
475 UcxMap* ucx_map_union_a(UcxAllocator *allocator, |
|
476 const UcxMap *first, const UcxMap *second, |
|
477 copy_func cpfnc, void* cpdata); |
|
478 |
|
479 /** |
|
480 * Returns the intersection of two maps. |
|
481 * |
|
482 * The intersection is defined as a copy of the first map with every element |
|
483 * removed that has no valid key in the second map. |
|
484 * |
|
485 * @param first the first source map |
|
486 * @param second the second source map |
|
487 * @param cpfnc a function to copy the elements |
|
488 * @param cpdata additional data for the copy function |
|
489 * @return a new map containing the intersection |
|
490 */ |
|
491 UcxMap* ucx_map_intersection(const UcxMap *first, const UcxMap *second, |
|
492 copy_func cpfnc, void* cpdata); |
|
493 |
|
494 /** |
|
495 * Returns the intersection of two maps. |
|
496 * |
|
497 * The intersection is defined as a copy of the first map with every element |
|
498 * removed that has no valid key in the second map. |
|
499 * |
|
500 * @param allocator the allocator that shall be used by the new map |
|
501 * @param first the first source map |
|
502 * @param second the second source map |
|
503 * @param cpfnc a function to copy the elements |
|
504 * @param cpdata additional data for the copy function |
|
505 * @return a new map containing the intersection |
|
506 */ |
|
507 UcxMap* ucx_map_intersection_a(UcxAllocator *allocator, |
|
508 const UcxMap *first, const UcxMap *second, |
|
509 copy_func cpfnc, void* cpdata); |
|
510 |
|
511 /** |
|
512 * Returns the difference of two maps. |
|
513 * |
|
514 * The difference contains a copy of all elements of the first map |
|
515 * for which the corresponding keys cannot be found in the second map. |
|
516 * |
|
517 * @param first the first source map |
|
518 * @param second the second source map |
|
519 * @param cpfnc a function to copy the elements |
|
520 * @param cpdata additional data for the copy function |
|
521 * @return a new list containing the difference |
|
522 */ |
|
523 UcxMap* ucx_map_difference(const UcxMap *first, const UcxMap *second, |
|
524 copy_func cpfnc, void* cpdata); |
|
525 |
|
526 /** |
|
527 * Returns the difference of two maps. |
|
528 * |
|
529 * The difference contains a copy of all elements of the first map |
|
530 * for which the corresponding keys cannot be found in the second map. |
|
531 * |
|
532 * @param allocator the allocator that shall be used by the new map |
|
533 * @param first the first source map |
|
534 * @param second the second source map |
|
535 * @param cpfnc a function to copy the elements |
|
536 * @param cpdata additional data for the copy function |
|
537 * @return a new list containing the difference |
|
538 */ |
|
539 UcxMap* ucx_map_difference_a(UcxAllocator *allocator, |
|
540 const UcxMap *first, const UcxMap *second, |
|
541 copy_func cpfnc, void* cpdata); |
|
542 |
429 |
543 |
430 #ifdef __cplusplus |
544 #ifdef __cplusplus |
431 } |
545 } |
432 #endif |
546 #endif |
433 |
547 |