Files Classes Functions Hierarchy
#include <cfcontainerhash.h>
Public Member Functions | |
| cfcontainerhash (uintc size=200) | |
| Constructor. | |
| void | construct (uintc size) |
| Resize the container - invalidates previous memory. | |
| compilationfile * | operator[] (stringc &filename) const |
| Search. | |
| boolc | add (compilationfile *cf) |
| Looks before adding the compilation file. | |
| boolc | remove (stringc &filename) |
| Remove the element. | |
| void | reset () |
| Reset the iterator. | |
| boolc | operator! () |
| Are there more elements? | |
| void | operator++ () |
| Increment. | |
| compilationfile * | operator() () const |
| Access the current iterator element. | |
Implements interface
// Resize the container. void construct(uintc size); // Search. compilationfile* operator [] (stringc & filename) const; // Looks before adding the compilation file. boolc add(compilationfile* cf); // Remove the element. boolc remove(stringc & filename); // Reset the iterator. void reset(); // Are there more elements? boolc operator ! (); // Increment. void operator ++ (); // Access the current iterator element. compilationfile* operator() () const;
Definition at line 33 of file cfcontainerhash.h.
| cfcontainerhash::cfcontainerhash | ( | uintc | size = 200 |
) |
| boolc cfcontainerhash::add | ( | compilationfile * | cf | ) |
Looks before adding the compilation file.
Definition at line 38 of file cfcontainerhash.cpp.
References hashtable< T, HFN >::contains(), compilationfile::filename, and hashtable< T, HFN >::insert().
Referenced by cfcontainerhashtest::test01().
00039 { 00040 assert(cf); 00041 00042 vsp.push_back( sp(cf->filename,cf) ); 00043 sp* x = & vsp[vsp.size()-1]; 00044 00045 00046 if (ht.contains(*x)) 00047 return false; 00048 00049 vbl.push_back( blink( x ) ); 00050 blink* x2 = & vbl[vbl.size()-1]; 00051 00052 ht.insert(x2); 00053 00054 return true; 00055 }
| void cfcontainerhash::construct | ( | uintc | size | ) |
Resize the container - invalidates previous memory.
Definition at line 15 of file cfcontainerhash.cpp.
References hashtable< T, HFN >::construct().
00016 { 00017 vbl.reserve(size); 00018 vsp.reserve(size); 00019 ht.construct(size); 00020 }
| boolc cfcontainerhash::operator! | ( | ) |
| compilationfile * cfcontainerhash::operator() | ( | ) | const |
Access the current iterator element.
Definition at line 84 of file cfcontainerhash.cpp.
References bucketlink< T >::data.
00085 { 00086 #ifndef NDEBUG 00087 blink* bl = hti(); 00088 assert(bl); 00089 #endif 00090 //assert(hti()); 00091 //cout << SHOW(bl) << endl; 00092 //cout << SHOW(bl->data) << " " << SHOW(bl->next) << endl; 00093 //sp* x = bl->data; 00094 assert(bl->data); 00095 //cout << SHOW(x->data); 00096 //assert(hti()->data); 00097 return hti()->data->data; 00098 }
| void cfcontainerhash::operator++ | ( | ) |
| compilationfile * cfcontainerhash::operator[] | ( | stringc & | filename | ) | const |
Search.
Definition at line 22 of file cfcontainerhash.cpp.
References stringpair< T >::data, bucketlink< T >::data, and hashtable< T, HFN >::insertInverse().
00023 { 00024 sp x1(filename,0); 00025 00026 blink* p = ht.insertInverse(x1); 00027 00028 if (!p) 00029 { 00030 //cout << "could not find " << filename << endl; 00031 return 0; 00032 } 00033 00034 return p->data->data; 00035 }
Remove the element.
Definition at line 58 of file cfcontainerhash.cpp.
References hashtable< T, HFN >::remove().
Referenced by cfcontainerhashtest::test01().
00059 { 00060 //cout << filename << endl; 00061 //if (filename=="main.h") 00062 // cout << "* main.h" << endl; 00063 00064 sp x1(filename,0); 00065 return ht.remove(x1); 00066 }
| void cfcontainerhash::reset | ( | ) |
Reset the iterator.
Definition at line 69 of file cfcontainerhash.cpp.
References hashtableiterator< H >::reset().
Referenced by cfcontainerhashtest::test01().
00070 { 00071 hti.reset(); 00072 }
1.5.8