ENSDF++ 1.1
An easy, fast and simple way to run querys towards the ENSDF database, written in C++.
Public Member Functions | Protected Member Functions | Protected Attributes
ElementLookupTable Class Reference

Converts element designations (for example NA, Na, na) to atomic numbers (for example 11). More...

#include <ElementLookupTable.h>

List of all members.

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.

Detailed Description

Converts element designations (for example NA, Na, na) to atomic numbers (for example 11).

Author:
Rikard Lundmark
Note:
The elements are hard-coded.

Definition at line 27 of file ElementLookupTable.h.


Member Function Documentation

unsigned short int ElementLookupTable::lookupElement ( string  elementToLookup)

Look up a specific element.

Returns:
the atomic number of the element, or 0 if the element was not found.

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.

Parameters:
sString 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;
  }
}

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator Defines

Back to the main page of the Precalibrated Ion Beam Identification Detector project

Created by Rikard Lundmark