MCPcopy Create free account
hub / github.com/couchbase/fleece / KeyTree

Class KeyTree

Experimental/KeyTree.hh:25–41  ·  view source on GitHub ↗

A very compact dictionary of strings (or arbitrary blobs) that bidirectionally maps each one to a small positive integer. Internally it's stored as a tree, so lookup time is O(log n). The total storage overhead (beyond the sizes of the strings themselves) is about 1.5n bytes, although this increases somewhat as the length of the strings or the total size of the dict

Source from the content-addressed store, hash-verified

23 about 1.5n bytes, although this increases somewhat as the length of the strings or the
24 total size of the dictionary increase. */
25 class KeyTree {
26 public:
27 KeyTree(const void *encodedDataStart);
28 KeyTree(alloc_slice encodedData);
29
30 static KeyTree fromSortedStrings(const std::vector<slice>&);
31 static KeyTree fromStrings(std::vector<slice>);
32
33 unsigned operator[] (slice str) const;
34 slice operator[] (unsigned id) const;
35
36 slice encodedData() const {return _ownedData;}
37
38 private:
39 alloc_slice _ownedData;
40 const void * _data;
41 };
42
43}

Callers 1

fromSortedStringsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected