![]() |
Mixed Data Coincidence Analysis Software 1.0
A program to analyze files produced by the EventMixer software.
|
Converts element designations (for example NA, Na, na) to atomic numbers (for example 11). More...
#include <ElementLookupTable.hh>
Public Member Functions | |
ElementLookupTable () | |
Constructor, constructs the LookupTable. | |
unsigned short int | lookupElement (string elementToLookup) |
Look up a specific element. | |
string | lookupElement (unsigned short int elementToLookup) |
Look up a specific element. | |
Protected Member Functions | |
void | stringToUpper (string &s) |
Converts a string to upper case. | |
Protected Attributes | |
map< string, unsigned short int > | myTable |
Maps the element strings to their atomic numbers. | |
map< unsigned short int, string > | myReversedTable |
Maps the element numbers to their strings. |
Converts element designations (for example NA, Na, na) to atomic numbers (for example 11).
Definition at line 27 of file ElementLookupTable.hh.
unsigned short int ElementLookupTable::lookupElement | ( | string | elementToLookup | ) |
Look up a specific element.
Definition at line 130 of file ElementLookupTable.cc.
References myTable, and stringToUpper().
{ stringToUpper(elementToLookup); if(myTable.find(elementToLookup)!=myTable.end()) return myTable[elementToLookup]; else return 0; }
string ElementLookupTable::lookupElement | ( | unsigned short int | elementToLookup | ) |
Look up a specific element.
Definition at line 139 of file ElementLookupTable.cc.
References myReversedTable.
{ if(myReversedTable.find(elementToLookup)!=myReversedTable.end()) return myReversedTable[elementToLookup]; else return ""; }
void ElementLookupTable::stringToUpper | ( | string & | s | ) | [protected] |
Converts a string to upper case.
s | String to convert to uppercase. |
Definition at line 148 of file ElementLookupTable.cc.
Referenced by lookupElement().
{ std::string::iterator i = s.begin(); std::string::iterator end = s.end(); while (i != end) { *i = std::toupper((unsigned char)*i); ++i; } }