MakeIntoWord Class Reference

#include <GlobalDefinitions.h>

List of all members.

Public Member Functions

 MakeIntoWord (int bitsPerSymbol, const char *tt)
Word operator() (const string &s)

Protected Attributes

int bitsPerSymbol_
const char * tt_
map< char, Wordmap_


Detailed Description

Definition at line 640 of file GlobalDefinitions.h.


Constructor & Destructor Documentation

MakeIntoWord::MakeIntoWord ( int  bitsPerSymbol,
const char *  tt 
)

Definition at line 119 of file GlobalDefinitions.cpp.

References bitsPerSymbol_, and map_.

00119                                                              :
00120 bitsPerSymbol_( bitsPerSymbol ), tt_( tt ) 
00121 {
00122   for ( unsigned int i(0) ; i < (1<<bitsPerSymbol_) ; ++i )
00123   {
00124     map_.insert( make_pair( (static_cast<char>(tolower(tt[i]))),i ) );
00125     map_.insert( make_pair( (static_cast<char>(toupper(tt[i]))),i ) );
00126   };
00127 } // ~MakeIntoWord::MakeIntoWord( int bitsPerSymbol, const char* tt )


Member Function Documentation

Word MakeIntoWord::operator() ( const string &  s  ) 

Definition at line 144 of file GlobalDefinitions.cpp.

References bitsPerSymbol_, and map_.

00145 {
00146   Word w(0);
00147   if ( s.size()*bitsPerSymbol_ > (8*sizeof(Word)) ) return w;
00148   for ( unsigned int i(0) ; i < s.size() ; i++ )
00149   {
00150     w <<= bitsPerSymbol_;
00151     if (map_.find(s[i]) == map_.end() ) { w=0; break; }
00152     else w |= map_[s[i]];
00153   } // ~for
00154   return w;
00155   
00156 } // ~Word MakeIntoWord::operator()( const string& s )


Member Data Documentation

int MakeIntoWord::bitsPerSymbol_ [protected]

Definition at line 648 of file GlobalDefinitions.h.

Referenced by MakeIntoWord(), and operator()().

const char* MakeIntoWord::tt_ [protected]

Definition at line 649 of file GlobalDefinitions.h.

map< char, Word > MakeIntoWord::map_ [protected]

Definition at line 650 of file GlobalDefinitions.h.

Referenced by MakeIntoWord(), and operator()().


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