PrintFromWord Class Reference

#include <GlobalDefinitions.h>

Inheritance diagram for PrintFromWord:

Inheritance graph
[legend]
Collaboration diagram for PrintFromWord:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PrintFromWord (const Word word, int wordLength, int bitsPerSymbol, const char *tt)
 PrintFromWord (const Word word, const HashTableGeneric &hashTable, int bitsPerSymbol, const char *tt)
 PrintFromWord (const WordSequence &wordSeq, int wordLength, int bitsPerSymbol, const char *tt)
 PrintFromWord (const WordSequence &wordSeq, const HashTableGeneric &hashTable, int bitsPerSymbol, const char *tt)
void doPrint (ostream &os)
void doWord (ostream &os, const Word word)
void doWord (ostream &os, const Word word, int length)

Protected Attributes

const WordSequencepWordSeq_
Word word_
int length_
int bitsPerSymbol_
const char * tt_
Word mask_

Friends

ostream & operator<< (ostream &os, PrintFromWord pw)

Detailed Description

Definition at line 558 of file GlobalDefinitions.h.


Constructor & Destructor Documentation

PrintFromWord::PrintFromWord ( const Word  word,
int  wordLength,
int  bitsPerSymbol,
const char *  tt 
) [inline]

Definition at line 561 of file GlobalDefinitions.h.

00563   : pWordSeq_(0), word_( word ), length_( wordLength ),
00564     bitsPerSymbol_( bitsPerSymbol ), tt_(tt), 
00565     mask_( (1 << bitsPerSymbol) - 1 ) 
00566   {}

PrintFromWord::PrintFromWord ( const Word  word,
const HashTableGeneric hashTable,
int  bitsPerSymbol,
const char *  tt 
)

Definition at line 49 of file GlobalDefinitions.cpp.

00051   : pWordSeq_(0), word_( word ), length_( hashTable.getWordLength() ),
00052     bitsPerSymbol_( bitsPerSymbol ), tt_( tt ),
00053     mask_( (1 << bitsPerSymbol) - 1 ) 
00054 {}

PrintFromWord::PrintFromWord ( const WordSequence wordSeq,
int  wordLength,
int  bitsPerSymbol,
const char *  tt 
) [inline]

Definition at line 571 of file GlobalDefinitions.h.

00573   : pWordSeq_( &wordSeq ), length_( wordLength ), 
00574     bitsPerSymbol_( bitsPerSymbol ), tt_( tt ),
00575    mask_( (1 << bitsPerSymbol) - 1 ) 
00576   {}

PrintFromWord::PrintFromWord ( const WordSequence wordSeq,
const HashTableGeneric hashTable,
int  bitsPerSymbol,
const char *  tt 
)

Definition at line 58 of file GlobalDefinitions.cpp.

00060   : pWordSeq_( &wordSeq ), length_( hashTable.getWordLength() ), 
00061     bitsPerSymbol_( bitsPerSymbol ), tt_( tt ),
00062     mask_( (1 << bitsPerSymbol) - 1 ) 
00063 {}


Member Function Documentation

void PrintFromWord::doPrint ( ostream &  os  ) 

Definition at line 68 of file GlobalDefinitions.cpp.

References bitsPerSymbol_, doWord(), WordSequence::getNumBasesInLast(), length_, pWordSeq_, and word_.

00069   {
00070     if ( pWordSeq_ )
00071     {       
00072       for 
00073       ( 
00074         WordSequence::const_iterator
00075         i (pWordSeq_->begin() );
00076         i != static_cast<WordSequence::const_iterator>(&pWordSeq_->back());
00077         ++i 
00078       ) 
00079       {
00080         doWord( os, *i ); 
00081       } // ~for
00082       if (pWordSeq_->size() != 0)
00083       {
00084         if (pWordSeq_->getNumBasesInLast()==0) 
00085         {
00086           doWord(os, pWordSeq_->back());
00087         }
00088         else
00089         {
00090           doWord( os, 
00091                   (pWordSeq_->back() >> 
00092                    (bitsPerSymbol_*(   length_
00093                                      - pWordSeq_->getNumBasesInLast())) ), 
00094                   pWordSeq_->getNumBasesInLast() );
00095         }
00096       }
00097     } // ~if
00098     else 
00099     {
00100       doWord( os, word_ );
00101     } // ~else
00102   } // ~PrintFromWord::doPrint

Here is the call graph for this function:

void PrintFromWord::doWord ( ostream &  os,
const Word  word 
) [inline]

Definition at line 584 of file GlobalDefinitions.h.

References length_.

Referenced by doPrint().

00585     { doWord(os, word, length_ ); }

Here is the caller graph for this function:

void PrintFromWord::doWord ( ostream &  os,
const Word  word,
int  length 
)

Definition at line 104 of file GlobalDefinitions.cpp.

References bitsPerSymbol_, mask_, and tt_.

00105   { 
00106     for ( int i( length - 1 ) ; i >= 0 ; i-- )
00107     {
00108 
00109       //      os << &tt_ << " " <<
00110       //    ( ( word & ( mask_ << (bitsPerSymbol_*i) ) ) 
00111       //                       >> (bitsPerSymbol_*i) ) << endl;
00112 
00113       os << tt_
00114     [ ( word & ( mask_ << (bitsPerSymbol_*i) ) ) 
00115     >> (bitsPerSymbol_*i) ];
00116     } 
00117   } // ~doWord


Friends And Related Function Documentation

ostream& operator<< ( ostream &  os,
PrintFromWord  pw 
) [friend]

Definition at line 588 of file GlobalDefinitions.h.

00589   {
00590     pw.doPrint(os);
00591     return os;
00592   } // ~operator<<


Member Data Documentation

const WordSequence* PrintFromWord::pWordSeq_ [protected]

Definition at line 594 of file GlobalDefinitions.h.

Referenced by doPrint().

Word PrintFromWord::word_ [protected]

Definition at line 595 of file GlobalDefinitions.h.

Referenced by doPrint().

int PrintFromWord::length_ [protected]

Definition at line 596 of file GlobalDefinitions.h.

Referenced by doPrint(), and doWord().

int PrintFromWord::bitsPerSymbol_ [protected]

Definition at line 597 of file GlobalDefinitions.h.

Referenced by doPrint(), and doWord().

const char* PrintFromWord::tt_ [protected]

Definition at line 598 of file GlobalDefinitions.h.

Referenced by doWord().

Word PrintFromWord::mask_ [protected]

Definition at line 599 of file GlobalDefinitions.h.

Referenced by doWord().


The documentation for this class was generated from the following files:
Generated on Fri Dec 21 13:19:27 2007 for ssaha by  doxygen 1.5.2