idep_NameIndexMap_i Struct Reference

List of all members.

Public Member Functions

 idep_NameIndexMap_i (int size)
 ~idep_NameIndexMap_i ()
idep_NameIndexMapLink *& findSlot (const char *name)
int insert (idep_NameIndexMapLink *&slot, const char *name)

Public Attributes

idep_NameArray d_array
idep_NameIndexMapLink ** d_table_p
int d_tableSize

Detailed Description

Definition at line 54 of file idep_nimap.cxx.


Constructor & Destructor Documentation

idep_NameIndexMap_i::idep_NameIndexMap_i ( int  size  ) 

Definition at line 71 of file idep_nimap.cxx.

References d_table_p, and d_tableSize.

00072 : d_array(size)
00073 , d_tableSize(size > 0 ? size : DEFAULT_TABLE_SIZE)
00074 { 
00075     d_table_p = new idep_NameIndexMapLink *[d_tableSize];
00076     assert(d_table_p);
00077     memset(d_table_p, 0, d_tableSize * sizeof *d_table_p);
00078 }

idep_NameIndexMap_i::~idep_NameIndexMap_i (  ) 

Definition at line 80 of file idep_nimap.cxx.

References idep_NameIndexMapLink::d_next_p, d_table_p, and d_tableSize.

00081 { 
00082     for (int i = 0; i < d_tableSize; ++i) {
00083         idep_NameIndexMapLink *p = d_table_p[i];
00084         while (p) {
00085         idep_NameIndexMapLink *q = p;
00086             p = p->d_next_p;
00087             delete q;
00088         }
00089     }
00090     delete [] d_table_p;
00091 }


Member Function Documentation

idep_NameIndexMapLink *& idep_NameIndexMap_i::findSlot ( const char *  name  ) 

Definition at line 93 of file idep_nimap.cxx.

References d_table_p, d_tableSize, and hash().

Referenced by idep_NameIndexMap::add(), idep_NameIndexMap::entry(), and idep_NameIndexMap::lookup().

00094 {
00095     int index = hash(name) % d_tableSize;
00096     assert(index >= 0 && index < d_tableSize);
00097     return d_table_p[index];
00098 }

int idep_NameIndexMap_i::insert ( idep_NameIndexMapLink *&  slot,
const char *  name 
)

Definition at line 100 of file idep_nimap.cxx.

References idep_NameArray::append(), and d_array.

Referenced by idep_NameIndexMap::add(), and idep_NameIndexMap::entry().

00101 {
00102     int index = d_array.append(nm); // index is into a managed string array
00103     slot = new idep_NameIndexMapLink(d_array[index], index, slot);
00104     return index;
00105 }


Member Data Documentation

Definition at line 55 of file idep_nimap.cxx.

Referenced by insert(), idep_NameIndexMap::length(), and idep_NameIndexMap::operator[]().

Definition at line 56 of file idep_nimap.cxx.

Referenced by findSlot(), idep_NameIndexMap_i(), and ~idep_NameIndexMap_i().

Definition at line 57 of file idep_nimap.cxx.

Referenced by findSlot(), idep_NameIndexMap_i(), and ~idep_NameIndexMap_i().


The documentation for this struct was generated from the following file:

Generated on 3 Oct 2018 for loon by  doxygen 1.6.1