#include <NVHash.h>
Inheritance diagram for NVHash:

Public Member Functions | |
| NVHash () | |
| NVHash (const char *dbname, unsigned long hashsz=97, int flags=0) | |
| void | open (const char *dbname, unsigned long hashsz=97, int flags=0) |
| unsigned long | gethashsz (void) |
| void | clear (void) |
| int | is_empty (void) |
| void | add (unsigned long h, const char *data, size_t szdata) |
| void | print (std::ostream &os) |
Protected Member Functions | |
| void | make_current (void) |
| int | sis_empty (void) |
| void | sclear (void) |
| void | sadd (unsigned long h, const char *data, size_t szdata) |
| void | sprint (std::ostream &os) |
Protected Attributes | |
| nvoff_t * | hashtab |
| unsigned long | hashsz |
Definition at line 15 of file NVHash.h.
|
|
Definition at line 29 of file NVHash.h.
|
|
||||||||||||||||
|
Definition at line 56 of file NVHash.cc. References open().
|
|
||||||||||||||||
|
Definition at line 105 of file NVHash.cc. References NVcontainer::lock(), and sadd(). Referenced by NVActiveDB::add(), and NVActiveDB::sset().
|
|
|
Reimplemented in NVActiveDB. Definition at line 89 of file NVHash.cc. References NVcontainer::lock(), and sclear(). Referenced by NVActiveDB::clear().
|
|
|
Returns the size of the has-table.
Definition at line 46 of file NVHash.h. References hashsz.
00046 {
00047 // No lock and make_current invocation necessary, since
00048 // the hash-size must not change
00049 return hashsz;
00050 }
|
|
|
Reimplemented in NVActiveDB. Definition at line 96 of file NVHash.cc. References NVcontainer::lock(), and sis_empty(). Referenced by NVActiveDB::is_empty().
|
|
|
Reimplemented from NVcontainer. Definition at line 10 of file NVHash.cc. References NVcontainer::getdata(), hashsz, hashtab, NVcontainer::is_current(), NVcontainer::make_current(), and nvoff_t.
00011 {
00012 nvoff_t hdata;
00013
00014 if (mem_p && is_current())
00015 return;
00016
00017 NVlist::make_current();
00018 if ((hdata = getdata()) == 0) {
00019 hashtab = NULL;
00020 hashsz = 0;
00021 } else {
00022 hashtab =
00023 (nvoff_t *) (mem_p + hdata + sizeof(unsigned long));
00024 hashsz = *(unsigned long *) (mem_p + hdata);
00025 }
00026 }
|
|
||||||||||||||||
|
Open an NVHash object.
Definition at line 62 of file NVHash.cc. References hashsz, hashtab, NVcontainer::lock(), NVcontainer::nvalloc(), nvoff_t, NVcontainer::open(), and NVcontainer::setdata(). Referenced by NVHash(), and NVActiveDB::open().
00063 {
00064 NVlist::open(dbname, flags);
00065 if (!hashtab) {
00066 lock(ExclLock);
00067 if (!hashtab) {
00068 nvoff_t ht =
00069 nvalloc(sizeof(unsigned long) +
00070 nhashsz * sizeof(nvoff_t));
00071 unsigned long i;
00072 setdata(ht);
00073
00074 hashsz = (*(unsigned long *) (mem_p + ht)) =
00075 nhashsz;
00076 hashtab =
00077 (nvoff_t *) (mem_p + ht +
00078 sizeof(unsigned long));
00079
00080 for (i = 0; i < hashsz; i++)
00081 hashtab[i] = 0;
00082 }
00083 lock(UnLock);
00084 }
00085 // The hashsz and hashtab variables will be updated at the next
00086 // make_current method-invocation
00087 }
|
|
|
Definition at line 112 of file NVHash.cc. References NVcontainer::lock(), and sprint().
|
|
||||||||||||||||
|
Definition at line 44 of file NVHash.cc. References hashtab, and NVlist::sprepend(). Referenced by add().
00045 {
00046 NVlist::sprepend((char *) &(hashtab[h]) - mem_p, data, szdata);
00047 }
|
|
|
Definition at line 28 of file NVHash.cc. References hashsz, hashtab, and NVlist::sclear(). Referenced by clear().
00029 {
00030 unsigned long i;
00031 for (i = 0; i < hashsz; i++)
00032 NVlist::sclear((char *) &(hashtab[i]) - mem_p);
00033 }
|
|
|
Definition at line 35 of file NVHash.cc. References hashsz, and hashtab. Referenced by is_empty().
|
|
|
Definition at line 49 of file NVHash.cc. References hashsz, hashtab, and NVlist::sprint(). Referenced by print().
00050 {
00051 unsigned long i;
00052 for (i = 0; i < hashsz; i++)
00053 NVlist::sprint((char *) &(hashtab[i]) - mem_p, os);
00054 }
|
|
|
Definition at line 21 of file NVHash.h. Referenced by NVActiveDB_Iter::_skip_nulls(), NVHashIter::first(), gethashsz(), make_current(), NVHashIter::next(), NVActiveDB_Iter::next(), NVActiveDB_Iter::NVActiveDB_Iter(), open(), sclear(), sis_empty(), and sprint(). |
|
|
Definition at line 20 of file NVHash.h. Referenced by NVActiveDB_Iter::_skip_nulls(), NVHashIter::first(), make_current(), NVHashIter::next(), open(), sadd(), sclear(), sis_empty(), and sprint(). |
1.3.6-20040222