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

NVActiveDB_Iter Class Reference

#include <NVActiveDB.h>

Inheritance diagram for NVActiveDB_Iter:

_Iter< GroupInfo > List of all members.

Public Member Functions

_Iter< GroupInfo > * clone ()
GroupInfoget ()
void next ()
bool equals (_Iter< GroupInfo > *iter)

Private Member Functions

void _skip_nulls ()
 NVActiveDB_Iter (NVActiveDB *db, bool begin)

Private Attributes

NVActiveDBactive_database
unsigned long hash_val
NVActiveDB::Record * pos
NVActiveDB::Record * tail
GroupInfo newsgroup

Constructor & Destructor Documentation

NVActiveDB_Iter::NVActiveDB_Iter NVActiveDB db,
bool  begin
[inline, private]
 

Definition at line 170 of file NVActiveDB.h.

References _skip_nulls(), active_database, hash_val, NVHash::hashsz, and pos.

Referenced by clone().

00170                                                   :active_database(db)
00171         {
00172                 _type = 1;
00173 
00174                 pos = NULL;
00175                 hash_val = begin ? 0 : active_database->hashsz;
00176                 _skip_nulls();
00177         }


Member Function Documentation

void NVActiveDB_Iter::_skip_nulls  )  [inline, private]
 

Definition at line 156 of file NVActiveDB.h.

References active_database, hash_val, NVHash::hashsz, NVHash::hashtab, NVlist::o2r(), pos, and tail.

Referenced by NVActiveDB_Iter().

00156                            {
00157                 while (hash_val < active_database->hashsz) {
00158                         if (active_database->hashtab[hash_val]) {
00159                                 tail =
00160                                     active_database->o2r(active_database->
00161                                                          hashtab
00162                                                          [hash_val]);
00163                                 pos = active_database->o2r(tail->next);
00164                                 break;
00165                         }
00166                         hash_val++;
00167                 }
00168         }

_Iter< GroupInfo >* NVActiveDB_Iter::clone  )  [inline, virtual]
 

Implements _Iter< GroupInfo >.

Definition at line 180 of file NVActiveDB.h.

References NVActiveDB_Iter().

00180                                      {
00181                 return new NVActiveDB_Iter(*this);
00182         }

bool NVActiveDB_Iter::equals _Iter< GroupInfo > *  iter  )  [inline]
 

Definition at line 211 of file NVActiveDB.h.

References _Iter< GroupInfo >::_type, active_database, and pos.

00211                                                {
00212                 NVActiveDB_Iter *active_iter = (NVActiveDB_Iter *) iter;
00213 
00214                 return active_iter->_type == 1 &&
00215                     active_iter->active_database == this->active_database
00216                     && active_iter->pos == this->pos;
00217         }

GroupInfo* NVActiveDB_Iter::get  )  [inline, virtual]
 

Implements _Iter< GroupInfo >.

Definition at line 184 of file NVActiveDB.h.

References active_database, NVcontainer::mem_p, newsgroup, pos, NVlist::r2o(), and GroupInfo::setraw().

00184                          {
00185                 char *data;
00186                 int datasz;
00187 
00188                 data = active_database->mem_p +
00189                     active_database->r2o(pos) + sizeof(NVActiveDB::Record);
00190                 datasz = pos->szdata;
00191 
00192                 newsgroup.setraw(data, datasz);
00193                 return &newsgroup;
00194         }

void NVActiveDB_Iter::next  )  [inline, virtual]
 

Implements _Iter< GroupInfo >.

Definition at line 196 of file NVActiveDB.h.

References active_database, ASSERT, hash_val, NVHash::hashsz, Logger::p(), and slog.

00196                     {
00197                 ASSERT(if (hash_val == active_database->hashsz) {
00198                        slog.p(Logger::Critical) << "iterator past end\n";
00199                        return;}
00200                 );
00201 
00202                 if (pos == tail) {
00203                         pos = NULL;
00204                         hash_val++;
00205                         _skip_nulls();
00206                 } else {
00207                         pos = active_database->o2r(pos->next);
00208                 }
00209         }


Member Data Documentation

NVActiveDB* NVActiveDB_Iter::active_database [private]
 

Definition at line 147 of file NVActiveDB.h.

Referenced by _skip_nulls(), equals(), get(), next(), and NVActiveDB_Iter().

unsigned long NVActiveDB_Iter::hash_val [private]
 

Definition at line 149 of file NVActiveDB.h.

Referenced by _skip_nulls(), next(), and NVActiveDB_Iter().

GroupInfo NVActiveDB_Iter::newsgroup [private]
 

Definition at line 153 of file NVActiveDB.h.

Referenced by get().

NVActiveDB::Record* NVActiveDB_Iter::pos [private]
 

Definition at line 150 of file NVActiveDB.h.

Referenced by _skip_nulls(), equals(), get(), and NVActiveDB_Iter().

NVActiveDB::Record* NVActiveDB_Iter::tail [private]
 

Definition at line 151 of file NVActiveDB.h.

Referenced by _skip_nulls().


The documentation for this class was generated from the following file:
Generated on Fri Aug 20 10:58:11 2004 for NewsCache by doxygen 1.3.6-20040222