BucketList Class Reference

#include <Index.h>

Collaboration diagram for BucketList:

Collaboration graph
[legend]

Public Member Functions

 BucketList ()
 BucketList (HashIndexNode *h)
DbRetVal insert (Chunk *chunk, Database *db, void *key, void *tuple)
DbRetVal remove (Chunk *chunk, Database *db, void *key)
BucketIter getIterator ()

Detailed Description

Definition at line 50 of file Index.h.


Constructor & Destructor Documentation

BucketList::BucketList (  )  [inline]

Definition at line 54 of file Index.h.

00054 { head = NULL;}

BucketList::BucketList ( HashIndexNode h  )  [inline]

Definition at line 55 of file Index.h.

00055 { head = h; }


Member Function Documentation

BucketIter BucketList::getIterator (  )  [inline]

Definition at line 58 of file Index.h.

References BucketIter::iter.

Referenced by HashIndex::insert().

00059     {
00060         BucketIter it;
00061         it.iter = head;
00062         return it;
00063     }

Here is the caller graph for this function:

DbRetVal BucketList::insert ( Chunk chunk,
Database db,
void *  key,
void *  tuple 
)

Definition at line 20 of file BucketList.cxx.

References Chunk::allocate(), DM_HashIndex, HashIndexNode::next_, OK, printDebug, printError, HashIndexNode::ptrToKey_, and HashIndexNode::ptrToTuple_.

Referenced by HashIndex::insert(), and HashIndex::update().

00021 {
00022     DbRetVal rv = OK;
00023     HashIndexNode *newNode;// (HashIndexNode*) chunk->allocate(db, &rv);
00024     newNode= (HashIndexNode*) chunk->allocate(db, &rv);
00025     if (NULL == newNode)
00026     {
00027         printError(rv, "Unable to allocate HashIndex node");
00028         return rv;
00029     }
00030     printDebug(DM_HashIndex,"Hash Index node allocated:%x", newNode);
00031     newNode->ptrToKey_ = key;
00032     newNode->ptrToTuple_ = tuple;
00033     newNode->next_ = NULL;
00034 
00035     //If this is the first node, set it as head
00036     if (NULL == head)
00037     {
00038         printDebug(DM_HashIndex, "BucketList:insert head is null key:%x",key);
00039         head = newNode;
00040         return OK;
00041     }
00042 
00043     HashIndexNode *it = head;
00044     while (NULL != it->next_) it = it->next_;
00045     it->next_ = newNode;
00046     printDebug(DM_HashIndex, "BucketList:insert adding it to the end of list key:%x", key);
00047     return rv;
00048 }

Here is the call graph for this function:

Here is the caller graph for this function:

DbRetVal BucketList::remove ( Chunk chunk,
Database db,
void *  key 
)

Definition at line 50 of file BucketList.cxx.

References ErrNotFound, Chunk::free(), HashIndexNode::next_, OK, printError, HashIndexNode::ptrToKey_, and SplCase.

Referenced by HashIndex::insert(), HashIndex::remove(), and HashIndex::update().

00051 {
00052     if (NULL == head) return ErrNotFound;
00053     HashIndexNode *ite = head, *prev = head;
00054     while (ite != NULL)
00055     {
00056         if (ite->ptrToKey_ ==  keyPtr)
00057         {
00058             prev->next_ = ite->next_;
00059             chunk->free(db, ite);
00060             if ( ite == head) { head = NULL; return SplCase; }
00061             return OK;
00062         }
00063         prev = ite;
00064         ite = ite->next_;
00065     }
00066     printError(ErrNotFound, "Node not found in the bucket list");
00067     return ErrNotFound;
00068 }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 22:43:47 2008 for csql by  doxygen 1.4.7