26 #ifndef NFD_DAEMON_TABLE_NAME_TREE_HASHTABLE_HPP 27 #define NFD_DAEMON_TABLE_NAME_TREE_HASHTABLE_HPP 48 computeHash(
const Name& name,
size_t prefixLen = std::numeric_limits<size_t>::max());
54 computeHashes(
const Name& name,
size_t prefixLen = std::numeric_limits<size_t>::max());
92 template<
typename N,
typename F>
97 while (node !=
nullptr) {
127 float expandLoadFactor = 0.5;
131 float expandFactor = 2.0;
135 float shrinkLoadFactor = 0.1;
139 float shrinkFactor = 0.5;
174 return m_buckets.size();
182 return h % this->getNBuckets();
191 BOOST_ASSERT(bucket < this->getNBuckets());
192 return m_buckets[bucket];
199 find(
const Name& name,
size_t prefixLen)
const;
206 find(
const Name& name,
size_t prefixLen,
const HashSequence& hashes)
const;
212 std::pair<const Node*, bool>
213 insert(
const Name& name,
size_t prefixLen,
const HashSequence& hashes);
225 attach(
size_t bucket,
Node* node);
230 detach(
size_t bucket,
Node* node);
232 std::pair<const Node*, bool>
233 findOrInsert(
const Name& name,
size_t prefixLen,
HashValue h,
bool allowInsert);
239 resize(
size_t newNBuckets);
242 std::vector<Node*> m_buckets;
245 size_t m_expandThreshold;
246 size_t m_shrinkThreshold;
252 #endif // NFD_DAEMON_TABLE_NAME_TREE_HASHTABLE_HPP size_t initialSize
initial number of buckets
size_t HashValue
a single hash value
void foreachNode(N *head, const F &func)
invoke a function for each node in a doubly linked list
size_t getNBuckets() const
HashSequence computeHashes(const Name &name, size_t prefixLen)
computes hash values for each prefix of name.getPrefix(prefixLen)
Node(HashValue h, const Name &name)
HashValue computeHash(const Name &name, size_t prefixLen)
computes hash value of name.getPrefix(prefixLen)
size_t computeBucketIndex(HashValue h) const
std::vector< HashValue > HashSequence
a sequence of hash values
const Node * getBucket(size_t bucket) const
provides options for Hashtable
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Node * getNode(const Entry &entry)
An entry in the name tree.
size_t minSize
minimal number of buckets
a hashtable for fast exact name lookup