Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

NVlist Class Reference

#include <NVlist.h>

Inheritance diagram for NVlist:

NVcontainer NVHash NVList NVActiveDB List of all members.

Protected Member Functions

 NVlist (void)
 NVlist (const char *dbname, int flags=0)
Recordo2r (nvoff_t o)
nvoff_t r2o (Record *r)
int sis_empty (nvoff_t proot)
void sprepend (nvoff_t proot, const char *data, size_t szdata)
void sappend (nvoff_t proot, const char *data, size_t szdata)
void sremove (nvoff_t proot)
void sclear (nvoff_t proot)
void sprint (nvoff_t proot, std::ostream &os)

Detailed Description

Author:
Thomas Gschwind

Bug:
Documentation is missing.

Definition at line 14 of file NVlist.h.


Constructor & Destructor Documentation

NVlist::NVlist void   )  [inline, protected]
 

Definition at line 16 of file NVlist.h.

00016                     :NVcontainer() {
00017         } NVlist(const char *dbname, int flags =

NVlist::NVlist const char *  dbname,
int  flags = 0
[inline, protected]
 

Definition at line 17 of file NVlist.h.

00018                    :NVcontainer(dbname, flags) {
00019         }


Member Function Documentation

Record* NVlist::o2r nvoff_t  o  )  [inline, protected]
 

Definition at line 28 of file NVlist.h.

References nvoff_t.

Referenced by NVActiveDB_Iter::_skip_nulls(), NVListIter::attach(), NVListIter::first(), NVHashIter::first(), NVActiveDB::get(), NVActiveDB::hasgroup(), NVListIter::next(), NVHashIter::next(), sappend(), sprepend(), sprint(), sremove(), and NVActiveDB::sset().

00028                                {
00029                 return (Record *) (o ? mem_p + o : NULL);
00030         }

nvoff_t NVlist::r2o Record r  )  [inline, protected]
 

Definition at line 31 of file NVlist.h.

References nvoff_t.

Referenced by NVListIter::data(), NVHashIter::data(), NVActiveDB_Iter::get(), sappend(), sprepend(), sprint(), and sremove().

00031                                 {
00032                 return r ? (char *) r - mem_p : 0;
00033         }

void NVlist::sappend nvoff_t  proot,
const char *  data,
size_t  szdata
[protected]
 

Definition at line 28 of file NVlist.cc.

References NVlist::Record::datap(), NVlist::Record::next, NVcontainer::nvalloc(), nvoff_t, o2r(), r2o(), and NVlist::Record::szdata.

Referenced by NVList::append().

00029 {
00030         Record *tail;
00031         Record *nr;
00032         nr = o2r(nvalloc(szdata + sizeof(Record)));
00033         tail = o2r(*(nvoff_t *) (mem_p + proot));
00034 
00035         nr->szdata = szdata;
00036         memcpy(nr->datap(), data, szdata);
00037         if (tail) {
00038                 nr->next = tail->next;
00039                 *(nvoff_t *) (mem_p + proot) = tail->next = r2o(nr);
00040         } else {
00041                 *(nvoff_t *) (mem_p + proot) = nr->next = r2o(nr);
00042         }
00043 }

void NVlist::sclear nvoff_t  proot  )  [protected]
 

Definition at line 58 of file NVlist.cc.

References nvoff_t, and sremove().

Referenced by NVList::clear(), and NVHash::sclear().

00059 {
00060         while (*(nvoff_t *) (mem_p + proot))
00061                 sremove(proot);
00062 }

int NVlist::sis_empty nvoff_t  proot  )  [inline, protected]
 

Definition at line 35 of file NVlist.h.

References nvoff_t.

Referenced by NVList::is_empty().

00035                                      {
00036                 return *(nvoff_t *) (mem_p + proot) == 0;
00037         }

void NVlist::sprepend nvoff_t  proot,
const char *  data,
size_t  szdata
[protected]
 

Definition at line 11 of file NVlist.cc.

References NVlist::Record::datap(), NVlist::Record::next, NVcontainer::nvalloc(), nvoff_t, o2r(), r2o(), and NVlist::Record::szdata.

Referenced by NVList::prepend(), and NVHash::sadd().

00012 {
00013         Record *tail;
00014         Record *nr;
00015         nr = o2r(nvalloc(szdata + sizeof(Record)));
00016         tail = o2r(*(nvoff_t *) (mem_p + proot));
00017 
00018         nr->szdata = szdata;
00019         memcpy(nr->datap(), data, szdata);
00020         if (tail) {
00021                 nr->next = tail->next;
00022                 tail->next = r2o(nr);
00023         } else {
00024                 *(nvoff_t *) (mem_p + proot) = nr->next = r2o(nr);
00025         }
00026 }

void NVlist::sprint nvoff_t  proot,
std::ostream &  os
[protected]
 

Definition at line 64 of file NVlist.cc.

References NVlist::Record::datap(), NVlist::Record::next, nvoff_t, o2r(), and r2o().

Referenced by NVList::print(), and NVHash::sprint().

00065 {
00066         int i = 0;
00067         Record *head = o2r(*(nvoff_t *) (mem_p + proot));
00068         Record *r = head;
00069 
00070         while (r) {
00071                 r = o2r(r->next);
00072                 os << i++ << ": " << r2o(r) << "(" << r->
00073                     szdata << "): " << r->datap() << endl;
00074                 if (r == head)
00075                         r = NULL;
00076         }
00077 }

void NVlist::sremove nvoff_t  proot  )  [protected]
 

Definition at line 45 of file NVlist.cc.

References NVlist::Record::next, NVcontainer::nvfree(), nvoff_t, o2r(), and r2o().

Referenced by NVList::remove(), and sclear().

00046 {
00047         Record *tail = o2r(*(nvoff_t *) (mem_p + proot));
00048         Record *nr = o2r(tail->next);
00049 
00050         if (tail == nr) {
00051                 *(nvoff_t *) (mem_p + proot) = 0;
00052         } else {
00053                 tail->next = nr->next;
00054         }
00055         nvfree(r2o(nr));
00056 }


The documentation for this class was generated from the following files:
Generated on Sun Oct 24 21:08:24 2004 for NewsCache by doxygen 1.3.6-20040222