Main Page | Modules | Namespace List | Data Structures | File List | Data Fields | Globals

StringMap Class Reference
[Global Functions]

A data structure that acts as a two-way one-to-one mapping from integers to strings Optimized for SPAM to quickly retrieve customer IDs, transaction IDs, and item IDs from their corresponding string names, and vice versa. More...

#include <StringMap.h>


Public Member Functions

 StringMap ()
 Allocate the memory for the default initial size of the array.

 ~StringMap ()
 Destructor.

void Add (int key, const char *value)
 Add an item to the StringMap.

const char * GetValue (int key)
 Return the value associated with a given key, or null if the key/value pair is not in the StringMap.

const int * GetKey (const char *value)
 Return the key associated with a given value, or null if the key/value pair is not in the StringMap.


Private Attributes

int * _keyMem
const char ** _valueMem
int memSize
int length

Static Private Attributes

const int DEFAULT_INITIAL_SIZE = 16


Detailed Description

A data structure that acts as a two-way one-to-one mapping from integers to strings Optimized for SPAM to quickly retrieve customer IDs, transaction IDs, and item IDs from their corresponding string names, and vice versa.

Definition at line 51 of file StringMap.h.


Constructor & Destructor Documentation

StringMap::StringMap  )  [inline]
 

Allocate the memory for the default initial size of the array.

Definition at line 58 of file StringMap.h.

StringMap::~StringMap  )  [inline]
 

Destructor.

Definition at line 69 of file StringMap.h.


Member Function Documentation

void StringMap::Add int  key,
const char *  value
[inline]
 

Add an item to the StringMap.

Parameters:
key The integer key of this item
value The string value of this item

Definition at line 81 of file StringMap.h.

Referenced by CollectASCIIInfo().

const int* StringMap::GetKey const char *  value  )  [inline]
 

Return the key associated with a given value, or null if the key/value pair is not in the StringMap.

Parameters:
value The value to look up
Returns:
The key associated with this value, or null if the key/value pair is not in the StringMap

Definition at line 134 of file StringMap.h.

Referenced by CollectASCIIInfo().

const char* StringMap::GetValue int  key  )  [inline]
 

Return the value associated with a given key, or null if the key/value pair is not in the StringMap.

Parameters:
key The key to look up
Returns:
The value associated with this key, or null if the key/value pair is not in the StringMap

Definition at line 117 of file StringMap.h.

Referenced by LogFileSequence(), and LogStdoutSequence().


Field Documentation

int* StringMap::_keyMem [private]
 

Definition at line 152 of file StringMap.h.

Referenced by Add(), GetKey(), GetValue(), StringMap(), and ~StringMap().

const char** StringMap::_valueMem [private]
 

Definition at line 153 of file StringMap.h.

Referenced by Add(), GetKey(), GetValue(), StringMap(), and ~StringMap().

const int StringMap::DEFAULT_INITIAL_SIZE = 16 [static, private]
 

Definition at line 149 of file StringMap.h.

Referenced by StringMap().

int StringMap::length [private]
 

Definition at line 155 of file StringMap.h.

Referenced by Add(), GetKey(), GetValue(), and StringMap().

int StringMap::memSize [private]
 

Definition at line 154 of file StringMap.h.

Referenced by Add(), and StringMap().


The documentation for this class was generated from the following file:
Generated on Thu Mar 11 12:01:54 2004 for SPAM by doxygen 1.3.4