Took Ingos considerations into account and added a simple hashtable implementation.

It's currently really broken so don't even try to test it, but you can still review it ;-).
Message2.cpp is not yet cleaned - more to come...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13784 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2005-07-20 21:11:27 +00:00
parent eddf2adc8a
commit bbe759b31b
5 changed files with 191 additions and 39 deletions
+10 -1
View File
@@ -59,11 +59,20 @@ public:
void PrintToStream() const;
// hash table support
void HashInsert(BMessageField *field);
BMessageField *HashLookup(const char *name) const;
BMessageField *HashRemove(const char *name);
uint32 HashString(const char *string) const;
void HashClear();
private:
BMessageField *FindData(const char *name, type_code type,
status_t &error) const;
BList fFields;
BList fFieldList;
BMessageField **fFieldTable;
int32 fFieldTableSize;
};
} // namespace BPrivate
+12
View File
@@ -27,9 +27,13 @@ namespace BPrivate {
class BMessageField {
public:
BMessageField();
BMessageField(const char *name, type_code type);
BMessageField(const BMessageField &other);
~BMessageField();
BMessageField &operator=(const BMessageField &other);
uint8 Flags();
void SetName(const char *name);
@@ -45,11 +49,17 @@ public:
size_t SizeAt(int32 index) const;
const void *BufferAt(int32 index) const;
void MakeEmpty();
bool IsFixedSize() const { return fFixedSize; };
size_t TotalSize() const { return fTotalSize; };
void PrintToStream() const;
// hash table support
void SetNext(BMessageField *next) { fNext = next; };
BMessageField *Next() const { return fNext; };
private:
bool IsFixedSize(type_code type);
@@ -58,6 +68,8 @@ private:
BList fItems;
bool fFixedSize;
size_t fTotalSize;
BMessageField *fNext;
};
} // namespace BPrivate