djiparsetxt
Public Member Functions | Private Attributes
InterpretationTable Class Reference

#include <InterpretationTable.hh>

Collaboration diagram for InterpretationTable:
Collaboration graph
[legend]

Public Member Functions

 InterpretationTable (char const *defaultResultString=NULL)
 
virtual ~InterpretationTable ()
 
void add (u_int32_t intValue, char const *strValue)
 
char const * lookup (u_int32_t intValue)
 

Private Attributes

char const * fDefaultResultString
 
std::unordered_map< u_int32_t, char const * > fUMap
 

Detailed Description

Definition at line 32 of file InterpretationTable.hh.

Constructor & Destructor Documentation

◆ InterpretationTable()

InterpretationTable::InterpretationTable ( char const *  defaultResultString = NULL)

Definition at line 29 of file InterpretationTable.cpp.

30 : fDefaultResultString(strdup(defaultResultString == NULL ? "" : defaultResultString)) {
31 }
char const * fDefaultResultString

◆ ~InterpretationTable()

InterpretationTable::~InterpretationTable ( )
virtual

Definition at line 33 of file InterpretationTable.cpp.

33  {
34  delete[] fDefaultResultString;
35 }
char const * fDefaultResultString

References fDefaultResultString.

Member Function Documentation

◆ add()

void InterpretationTable::add ( u_int32_t  intValue,
char const *  strValue 
)

Definition at line 37 of file InterpretationTable.cpp.

37  {
38  fUMap[intValue] = strValue;
39 }
std::unordered_map< u_int32_t, char const * > fUMap

References fUMap.

Referenced by FieldDatabase::initializeInterpretationTables().

◆ lookup()

char const * InterpretationTable::lookup ( u_int32_t  intValue)

Definition at line 41 of file InterpretationTable.cpp.

41  {
42  char const* mapLookupResult = fUMap[intValue];
43  if (mapLookupResult == NULL) return fDefaultResultString;
44  return mapLookupResult;
45 }
char const * fDefaultResultString
std::unordered_map< u_int32_t, char const * > fUMap

References fDefaultResultString, and fUMap.

Referenced by FieldDatabase::outputFieldInterpreted().

Field Documentation

◆ fDefaultResultString

char const* InterpretationTable::fDefaultResultString
private

Definition at line 44 of file InterpretationTable.hh.

Referenced by lookup(), and ~InterpretationTable().

◆ fUMap

std::unordered_map<u_int32_t, char const*> InterpretationTable::fUMap
private

Definition at line 47 of file InterpretationTable.hh.

Referenced by add(), and lookup().


The documentation for this class was generated from the following files: