idep_AliasTable Class Reference

#include <idep_aliastable.h>

List of all members.

Public Member Functions

 idep_AliasTable (int sizeHint=0)
 ~idep_AliasTable ()
int add (const char *alias, const char *originalName)
const char * lookup (const char *alias) const

Private Member Functions

 idep_AliasTable (const idep_AliasTable &)
idep_AliasTableoperator= (const idep_AliasTable &)

Private Attributes

idep_AliasTableLink ** d_table_p
int d_size

Friends

class idep_AliasTableIter

Detailed Description

Definition at line 14 of file idep_aliastable.h.


Constructor & Destructor Documentation

idep_AliasTable::idep_AliasTable ( const idep_AliasTable  )  [private]
idep_AliasTable::idep_AliasTable ( int  sizeHint = 0  ) 

Definition at line 60 of file idep_altab.cxx.

References d_size, and d_table_p.

00061 : d_size(size > 0 ? size : DEFAULT_TABLE_SIZE)
00062 {
00063     d_table_p = new idep_AliasTableLink *[d_size];
00064     assert (d_table_p);
00065     memset (d_table_p, 0, d_size * sizeof *d_table_p);
00066 }

idep_AliasTable::~idep_AliasTable (  ) 

Definition at line 68 of file idep_altab.cxx.

References idep_AliasTableLink::d_next_p, d_size, and d_table_p.

00069 {
00070     for (int i = 0; i < d_size; ++i) {
00071         idep_AliasTableLink *p = d_table_p[i];
00072         while (p) {
00073             idep_AliasTableLink *q = p;
00074             p = p->d_next_p;
00075             delete q;
00076         }
00077     }
00078     delete [] d_table_p;
00079 }


Member Function Documentation

int idep_AliasTable::add ( const char *  alias,
const char *  originalName 
)

Definition at line 81 of file idep_altab.cxx.

References idep_AliasTableLink::d_alias_p, idep_AliasTableLink::d_next_p, idep_AliasTableLink::d_originalName_p, d_size, d_table_p, and hash().

Referenced by idep_AliasDep::addAlias(), idep_LinkDep::addAlias(), and tryToAlias().

00082 {
00083     enum { FOUND_DIFFERENT = -1, NOT_FOUND = 0, FOUND_IDENTICAL = 1 }; 
00084 
00085     idep_AliasTableLink *&slot = d_table_p[hash(alias) % d_size];
00086     idep_AliasTableLink *p = slot;
00087 
00088     while (p && 0 != strcmp(p->d_alias_p, alias)) {
00089         p = p->d_next_p;
00090     }
00091     if (!p) {
00092         slot = new idep_AliasTableLink(alias, originalName, slot);
00093         return NOT_FOUND;
00094     } 
00095     else if (0 == strcmp(p->d_originalName_p, originalName)) {
00096         return FOUND_IDENTICAL;
00097     }
00098     else {
00099         return FOUND_DIFFERENT;
00100     }
00101 }

const char * idep_AliasTable::lookup ( const char *  alias  )  const
idep_AliasTable& idep_AliasTable::operator= ( const idep_AliasTable  )  [private]

Friends And Related Function Documentation

friend class idep_AliasTableIter [friend]

Definition at line 17 of file idep_aliastable.h.


Member Data Documentation

int idep_AliasTable::d_size [private]

The documentation for this class was generated from the following files:

Generated on 15 Jul 2018 for loon by  doxygen 1.6.1