#include <HashTableGeneric.h>
Inheritance diagram for HashTableView< T, SUBCLASS >:


Public Types | |
| typedef T | HitType |
| typedef const HitType * | iterator |
| typedef const HitType * | const_iterator |
Public Member Functions | |
| HashTableView (ostream &monitoringStream, string name, Allocator< HitType > &hitListAllocator, Allocator< PositionInHitList > &arrayAllocator) | |
| virtual | ~HashTableView () |
| virtual void | hashWords (SequenceAdapter &thisSeq, SequenceNumber seqNum)=0 |
| virtual void | countWords (SequenceAdapter &thisSeq)=0 |
| virtual int | getHitTypeSize (void) const |
| virtual char * | getHitListStart (void) const |
| virtual void | allocateHitList (unsigned long size) |
| virtual void | loadHitList (unsigned long size) |
| virtual void | saveHitList (void) |
| const_iterator | begin (Word w) const |
| const_iterator | last (Word w) const |
| const_iterator | end (Word w) const |
| const int | size (Word w) const |
| template<class HITLIST> | |
| void | matchWord (Word queryWord, HITLIST &hitsFound, int baseOffset=0) const |
| template<class HITLIST> | |
| void | matchWord (const WordSequence &queryWords, HITLIST &hitsFound, int baseOffset=0) const |
Protected Attributes | |
| HitType * | pHitListForAllWords_ |
| Allocator< HitType > * | pHitListAllocator_ |
Private Member Functions | |
| HashTableView (const HashTableView &) | |
| HashTableView & | operator= (const HashTableView &) |
Friends | |
| class | HashTableFactory |
Definition at line 499 of file HashTableGeneric.h.
| typedef T HashTableView< T, SUBCLASS >::HitType |
Definition at line 506 of file HashTableGeneric.h.
| typedef const HitType* HashTableView< T, SUBCLASS >::iterator |
Definition at line 563 of file HashTableGeneric.h.
| typedef const HitType* HashTableView< T, SUBCLASS >::const_iterator |
Definition at line 564 of file HashTableGeneric.h.
| HashTableView< T, SUBCLASS >::HashTableView | ( | ostream & | monitoringStream, | |
| string | name, | |||
| Allocator< HitType > & | hitListAllocator, | |||
| Allocator< PositionInHitList > & | arrayAllocator | |||
| ) | [inline] |
Definition at line 513 of file HashTableGeneric.h.
00516 : 00517 HashTableGeneric 00518 ( monitoringStream, name, arrayAllocator ) 00519 { 00520 pHitListAllocator_ = hitListAllocator.clone 00521 (&pHitListForAllWords_, name+(string)".body", monitoringStream_ ); 00522 // pHitListAllocator_->link(&pHitListForAllWords_,name_+(string)".body"); 00523 }
| virtual HashTableView< T, SUBCLASS >::~HashTableView | ( | ) | [inline, virtual] |
Definition at line 529 of file HashTableGeneric.h.
00530 { 00531 monitoringStream_ << "destructing HashTableView ...\n"; 00532 if ( isInitialized_ ) 00533 { 00534 monitoringStream_ << "... deallocating memory\n"; 00535 // pHitListAllocator_->deallocate(); 00536 delete pHitListAllocator_; // also deallocs hit list 00537 // delete [] pHitListForAllWords_; 00538 } // ~if 00539 else 00540 { 00541 monitoringStream_ 00542 << "... never initialized, no memory deallocation required\n"; 00543 } // ~else 00544 } // destructor
| HashTableView< T, SUBCLASS >::HashTableView | ( | const HashTableView< T, SUBCLASS > & | ) | [private] |
| virtual void HashTableView< T, SUBCLASS >::hashWords | ( | SequenceAdapter & | thisSeq, | |
| SequenceNumber | seqNum | |||
| ) | [pure virtual] |
| virtual void HashTableView< T, SUBCLASS >::countWords | ( | SequenceAdapter & | thisSeq | ) | [pure virtual] |
| virtual int HashTableView< T, SUBCLASS >::getHitTypeSize | ( | void | ) | const [inline, virtual] |
Implements HashTableGeneric.
Definition at line 566 of file HashTableGeneric.h.
00567 { 00568 return sizeof(HitType); 00569 }
| virtual char* HashTableView< T, SUBCLASS >::getHitListStart | ( | void | ) | const [inline, virtual] |
Implements HashTableGeneric.
Definition at line 571 of file HashTableGeneric.h.
00572 { 00573 return (char*) pHitListForAllWords_; 00574 }
| virtual void HashTableView< T, SUBCLASS >::allocateHitList | ( | unsigned long | size | ) | [inline, virtual] |
Implements HashTableGeneric.
Definition at line 576 of file HashTableGeneric.h.
00577 { 00578 // pHitListForAllWords_=new HitType[size]; 00579 pHitListAllocator_->allocate(size); 00580 }
| virtual void HashTableView< T, SUBCLASS >::loadHitList | ( | unsigned long | size | ) | [inline, virtual] |
Implements HashTableGeneric.
Reimplemented in HashTablePacked.
Definition at line 582 of file HashTableGeneric.h.
Referenced by HashTablePacked::loadHitList().
00583 { 00584 pHitListAllocator_->load(size); 00585 }
Here is the caller graph for this function:

| virtual void HashTableView< T, SUBCLASS >::saveHitList | ( | void | ) | [inline, virtual] |
Implements HashTableGeneric.
Reimplemented in HashTablePacked.
Definition at line 587 of file HashTableGeneric.h.
Referenced by HashTablePacked::saveHitList().
00588 { 00589 pHitListAllocator_->save(); 00590 }
Here is the caller graph for this function:

| const_iterator HashTableView< T, SUBCLASS >::begin | ( | Word | w | ) | const [inline] |
Definition at line 595 of file HashTableGeneric.h.
Referenced by HashTableView< PositionInDatabase, HashTable >::end(), HashTableView< PositionInDatabase, HashTable >::matchWord(), and HashTableView< PositionInDatabase, HashTable >::size().
00596 { 00597 return pHitListForAllWords_ + 00598 ( ( w == 0 ) ? 0 : pWordPositionInHitList_[ w - 1 ] ); 00599 } // ~const_iterator begin( Word w ) const
Here is the caller graph for this function:

| const_iterator HashTableView< T, SUBCLASS >::last | ( | Word | w | ) | const [inline] |
Definition at line 601 of file HashTableGeneric.h.
Referenced by HashTableView< PositionInDatabase, HashTable >::end(), HashTableView< PositionInDatabase, HashTable >::matchWord(), and HashTableView< PositionInDatabase, HashTable >::size().
00602 { 00603 return pHitListForAllWords_ + ( pWordPositionInHitList_[ w ] ); 00604 } // ~const_iterator last( Word w ) const
Here is the caller graph for this function:

| const_iterator HashTableView< T, SUBCLASS >::end | ( | Word | w | ) | const [inline] |
Definition at line 606 of file HashTableGeneric.h.
Referenced by HashTableView< PositionInDatabase, HashTable >::matchWord().
00607 { 00608 return( (size(w) > maxNumHits_) ? begin(w) : last(w) ); 00609 } // ~const_iterator end( Word w ) const
Here is the caller graph for this function:

| const int HashTableView< T, SUBCLASS >::size | ( | Word | w | ) | const [inline] |
Definition at line 611 of file HashTableGeneric.h.
Referenced by HashTableView< PositionInDatabase, HashTable >::end(), and main().
Here is the caller graph for this function:

| void HashTableView< T, SUBCLASS >::matchWord | ( | Word | queryWord, | |
| HITLIST & | hitsFound, | |||
| int | baseOffset = 0 | |||
| ) | const [inline] |
Definition at line 621 of file HashTableGeneric.h.
Referenced by doSearch(), main(), HashTableView< PositionInDatabase, HashTable >::matchWord(), HashTablePacked::matchWordStandard(), and HashTablePacked::matchWordSubstitute().
00622 { 00623 // About 1/2 the exec time of a matchWord is spent calling end() 00624 // so bung it in a const variable TC 12.3.2 00625 // for( iterator i( begin( queryWord ) ); 00626 // i != end( queryWord ); i++ ) 00627 if ((queryWord&gCursedWord)!=(Word)0) return; 00628 const_iterator endWord(end(queryWord)); 00629 for( iterator i( begin( queryWord ) ); i != endWord; ++i ) 00630 { 00631 hitsFound.addHit 00632 ( *i, baseOffset ); 00633 } // ~for i 00634 00635 } // ~template< class HITLIST > void matchWord
Here is the caller graph for this function:

| void HashTableView< T, SUBCLASS >::matchWord | ( | const WordSequence & | queryWords, | |
| HITLIST & | hitsFound, | |||
| int | baseOffset = 0 | |||
| ) | const [inline] |
Definition at line 640 of file HashTableGeneric.h.
00643 { 00644 // printf("HashTable::matchWord (multiple)\n"); 00645 if (queryWords.size()==0) return; 00646 00647 // WordSequenceIterator last 00648 // = const_cast<WordSequenceIterator>(queryWords.end()); 00649 // last--; 00650 WordSequence::const_iterator last(&queryWords.back()); 00651 00652 for ( WordSequence::const_iterator thisWord(queryWords.begin()); 00653 thisWord != last ; ++thisWord ) 00654 { 00655 matchWord( *thisWord, hitsFound, baseOffset ); 00656 baseOffset += wordLength_; 00657 } // ~for 00658 00659 } // ~ template< class HITLIST > void matchWord
| HashTableView& HashTableView< T, SUBCLASS >::operator= | ( | const HashTableView< T, SUBCLASS > & | ) | [private] |
friend class HashTableFactory [friend] |
HitType* HashTableView< T, SUBCLASS >::pHitListForAllWords_ [protected] |
Definition at line 685 of file HashTableGeneric.h.
Referenced by HashTableView< PositionInDatabase, HashTable >::begin(), HashTableView< PositionInDatabase, HashTable >::getHitListStart(), HashTableView< PositionInDatabase, HashTable >::HashTableView(), and HashTableView< PositionInDatabase, HashTable >::last().
Allocator<HitType>* HashTableView< T, SUBCLASS >::pHitListAllocator_ [protected] |
Definition at line 686 of file HashTableGeneric.h.
Referenced by HashTableView< PositionInDatabase, HashTable >::allocateHitList(), HashTableView< PositionInDatabase, HashTable >::HashTableView(), HashTableView< PositionInDatabase, HashTable >::loadHitList(), HashTableView< PositionInDatabase, HashTable >::saveHitList(), and HashTableView< PositionInDatabase, HashTable >::~HashTableView().
1.5.2