/usr/include/hat-trie/hat-trie.h is in libhat-trie-dev 0.1.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | /*
* This file is part of hat-trie
*
* Copyright (c) 2011 by Daniel C. Jones <dcjones@cs.washington.edu>
*
*
* This is an implementation of the HAT-trie data structure described in,
*
* Askitis, N., & Sinha, R. (2007). HAT-trie: a cache-conscious trie-based data
* structure for strings. Proceedings of the thirtieth Australasian conference on
* Computer science-Volume 62 (pp. 97–105). Australian Computer Society, Inc.
*
* The HAT-trie is in essence a hybrid data structure, combining tries and hash
* tables in a clever way to try to get the best of both worlds.
*
*/
#ifndef HATTRIE_HATTRIE_H
#define HATTRIE_HATTRIE_H
#ifdef __cplusplus
extern "C" {
#endif
#include "common.h"
#include <stdlib.h>
#include <stdbool.h>
typedef struct hattrie_t_ hattrie_t;
hattrie_t* hattrie_create (void); // Create an empty hat-trie.
void hattrie_free (hattrie_t*); // Free all memory used by a trie.
void hattrie_clear (hattrie_t*); // Remove all entries.
size_t hattrie_size (const hattrie_t*); // Number of stored keys.
size_t hattrie_sizeof (const hattrie_t*); // Memory used in structure in bytes.
/** Find the given key in the trie, inserting it if it does not exist, and
* returning a pointer to it's key.
*
* This pointer is not guaranteed to be valid after additional calls to
* hattrie_get, hattrie_del, hattrie_clear, or other functions that modifies the
* trie.
*/
value_t* hattrie_get (hattrie_t*, const char* key, size_t len);
/** Find a given key in the table, returning a NULL pointer if it does not
* exist. */
value_t* hattrie_tryget (hattrie_t*, const char* key, size_t len);
/** Delete a given key from trie. Returns 0 if successful or -1 if not found.
*/
int hattrie_del(hattrie_t* T, const char* key, size_t len);
typedef struct hattrie_iter_t_ hattrie_iter_t;
hattrie_iter_t* hattrie_iter_begin (const hattrie_t*, bool sorted);
void hattrie_iter_next (hattrie_iter_t*);
bool hattrie_iter_finished (hattrie_iter_t*);
void hattrie_iter_free (hattrie_iter_t*);
const char* hattrie_iter_key (hattrie_iter_t*, size_t* len);
value_t* hattrie_iter_val (hattrie_iter_t*);
/* Return true if two iterators are equal. */
bool hattrie_iter_equal (const hattrie_iter_t* a,
const hattrie_iter_t* b);
#ifdef __cplusplus
}
#endif
#endif
|