class that represents a lookup table More...
#include <lookupTable.h>
Classes | |
class | badConversion |
thrown when a found result cannot be converted to the requested type More... | |
class | fieldNameNotFound |
thrown when a specified field name cannot be found More... | |
class | keyNotFound |
thrown when a specified keyname cannot be found More... | |
class | lookupExceptions |
lookup table exception class More... | |
Public Member Functions | |
lookupTable (std::string fileName, std::string keyname) | |
constructs a lookupTable from a data file | |
template<class T > | |
T | find (std::string keyVal, std::string fieldName) |
class that represents a lookup table
campAnalysis.cpp, campVIRTTEXAnalysis.cpp, hmi04.cpp, and hmi04.h.
lookupTable::lookupTable | ( | std::string | fileName, | |
std::string | keyname | |||
) |
constructs a lookupTable from a data file
fileName | string containing the name of a tab-delimited data file | |
keyname | string containing the key field name that will be used to retrieve data from the table |
The data file must be a pre-existing tab-delimited file. The first row must contain labels for each data field
T lookupTable::find | ( | std::string | keyVal, | |
std::string | fieldName | |||
) | [inline] |
keyVal | a string containing the value of the key field that identifies the data record to be searched. If there are multiple records with the same keyVal, which record is returned is undefined. Therefore it is advisable to search only on unique keys. |
If the keyVal is not found, find throws lookupTable::keyNotFound
If the fieldName is not found, find throws lookupTable::fieldNameNotFound
fieldName | a string containing the name of the field to be retrieved |