![]() |
ENSDF++ 1.1
An easy, fast and simple way to run querys towards the ENSDF database, written in C++.
|
Converts element designations (for example NA, Na, na) to atomic numbers (for example 11). More...
#include <ElementLookupTable.h>
Public Member Functions | |
ElementLookupTable () | |
Constructor, constructs the LookupTable. | |
unsigned short int | lookupElement (string 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. |
Converts element designations (for example NA, Na, na) to atomic numbers (for example 11).
Definition at line 27 of file ElementLookupTable.h.
unsigned short int ElementLookupTable::lookupElement | ( | string | elementToLookup | ) |
Look up a specific element.
Definition at line 126 of file ElementLookupTable.cpp.
References myTable, and stringToUpper().
Referenced by Nukleid::parseAtomicNumber().
{ stringToUpper(elementToLookup); if(myTable.find(elementToLookup)!=myTable.end()) return myTable[elementToLookup]; else return 0; }
void ElementLookupTable::stringToUpper | ( | string & | s | ) | [protected] |
Converts a string to upper case.
s | String to convert to uppercase. |
Definition at line 136 of file ElementLookupTable.cpp.
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; } }