Plan 9 from Bell Labs’s /usr/web/sources/contrib/de0u/root/sys/src/cmd/divergefs/collection.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



enum
{
  COLLECTION_DEFAULT_SIZE = 10
};

typedef enum collection_do_ret
{
  COLLECTION_DO_STOP = false,
  COLLECTION_DO_CONTINUE = true
} collection_do_ret;

/** 
 * each function accepts element p from the array and user defined arg pointer.
 */
typedef collection_do_ret (*collectioneach)(void *p, void *arg);

/** 
 * detect function accepts element p and user defined arg pointer. 
 * @return true if p is the item searching for, and false otherwise 
 */
typedef bool (*collectiondetect)(void *p, void *arg);


/** 
 * @return an uint hash value for p.
 */
typedef uint (*collectionhash)(void *p);

/** default hash function that returns the pointer's addess */
uint collection_address_hash(void *p);

/** hash function for string p */
uint collection_string_hash(void *p);

/**
 * @return true if p1 equals p2, false otherwise.
 */
typedef bool (*collectionisequal)(void *p1, void *p2);

/** default freeing functor that calls free on each p */
collection_do_ret collection_free_each(void *p, void *);


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.