Mixed Data Coincidence Analysis Software 1.0
A program to analyze files produced by the EventMixer software.
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.hh>

List of all members.

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.

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.hh.


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 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.

Returns:
empty string if the element was not found.

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.

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

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

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

Created by Rikard Lundmark