3 #ifndef __NAME_HASH_H__
4 #define __NAME_HASH_H__
7 #include "tools/ToolsConfig.h"
8 #include "tools/NoCopy.h"
11 #include "storage/FileAllocator.h"
56 void init(uint32_t ht_size=1009);
75 virtual const stdString &
getName()
const = 0;
80 virtual const stdString &
getIdTxt()
const = 0;
100 virtual bool isValid()
const = 0;
105 virtual void next() = 0;
119 friend class PrivateIterator;
129 uint32_t hash(
const stdString &name)
const;
134 FileOffset read_HT_entry(uint32_t hash_value)
const;
139 void write_HT_entry(uint32_t hash_value,
FileOffset offset)
const;
bool insert(const stdString &name, const stdString &ID_txt, FileOffset ID)
Insert name w/ ID.
static const uint32_t anchor_size
anchor size
Definition: NameHash.h:42
virtual const stdString & getIdTxt() const =0
ID string (for index file, that might be the data file name)
void init(uint32_t ht_size=1009)
Create a new hash table of given size.
Entry * find(const stdString &name)
Locate name and obtain its ID.
A file-based Hash table for strings.
Definition: NameHash.h:37
uint32_t FileOffset
FileOffset is used as a system independent type for, well, offsets into files.
Definition: StorageTypes.h:13
Maintains memory blocks within a file.
Definition: FileAllocator.h:22
One entry in the NameHash.
Definition: NameHash.h:69
virtual bool isValid() const =0
virtual void next()=0
Get next entry.
Iterator over names in the hash.
Definition: NameHash.h:94
void reattach()
Attach to existing hash table on error.
Iterator * iterator()
Start iterating over all entries (in table's order).
virtual FileOffset getId() const =0
ID code (for index file, that might be the file offset)
void showStats(FILE *f)
Generate info on table fill ratio and list length.
NameHash(FileAllocator &fa, FileOffset anchor)
Constructor.
virtual const stdString & getName() const =0
Channel Name.