Public Member Functions

RawHashTable Class Reference

#include <RawHashTable.h>

Public Member Functions

inkcoreapi RawHashTable (RawHashTable_KeyType key_type, bool deallocate_values_on_destruct=false)
virtual ~RawHashTable ()
bool getValue (RawHashTable_Key key, RawHashTable_Value *value_ptr)
 This routine gets the value associated with key.
void setValue (RawHashTable_Key key, RawHashTable_Value value_ptr)
 This routine sets the value associated with key to the value.
bool isBound (RawHashTable_Key key)
 This routine sets the value associated with key to the value pointed to by value_ptr.
bool unbindKey (RawHashTable_Key key)
 This routine removes any association for key from the hash table.
void replaceString (char *key, char *string)
 This rather specialized routine binds a malloc-allocated string value to the key, freeing any previous value.
RawHashTable_BindinggetCurrentBinding (RawHashTable_Key key)
 This function looks up a binding for key in the hash table, and returns a pointer to the binding data structure directly inside the hash table, or NULL if there is no binding.
RawHashTable_BindinggetOrCreateBinding (RawHashTable_Key key, bool *was_new=NULL)
 This function looks up a binding for key in the hash table, creates a binding if one doesn't exist, and returns a pointer to the binding data structure directly inside the hash table.
void setBindingValue (RawHashTable_Binding *binding, RawHashTable_Value value)
 This function looks up a binding for key in the hash table, creates a binding if one doesn't exist, and returns a pointer to the binding data structure directly inside the hash table.
RawHashTable_Key getKeyFromBinding (RawHashTable_Binding *binding)
 This function takes a binding and extracts the key.
RawHashTable_Value getValueFromBinding (RawHashTable_Binding *binding)
 This function takes a binding and extracts the value.
RawHashTable_BindingfirstBinding (RawHashTable_IteratorState *state_ptr)
 This function takes a hash table, initializes an interator data structure to point to the first binding in the hash table, and returns the first binding, or NULL if there are none.
RawHashTable_BindingnextBinding (RawHashTable_IteratorState *state_ptr)
 This function takes a hash table and a pointer to iterator state, and advances to the next binding in the hash table, if any.

Detailed Description

Definition at line 61 of file RawHashTable.h.


Constructor & Destructor Documentation

RawHashTable::RawHashTable ( RawHashTable_KeyType  key_type,
bool  deallocate_values_on_destruct = false 
) [inline]

Definition at line 285 of file RawHashTable.h.

References ink_hash_table_create().

RawHashTable::~RawHashTable (  )  [inline, virtual]

Member Function Documentation

RawHashTable_Binding * RawHashTable::firstBinding ( RawHashTable_IteratorState state_ptr  )  [inline]

This function takes a hash table, initializes an interator data structure to point to the first binding in the hash table, and returns the first binding, or NULL if there are none.

Definition at line 276 of file RawHashTable.h.

References ink_hash_table_iterator_first().

Referenced by HttpCompat::determine_set_by_language(), HttpBodyFactory::dump_template_tables(), and RawHashTableIter::RawHashTableIter().

RawHashTable_Binding * RawHashTable::getCurrentBinding ( RawHashTable_Key  key  )  [inline]

This function looks up a binding for key in the hash table, and returns a pointer to the binding data structure directly inside the hash table, or NULL if there is no binding.

Definition at line 198 of file RawHashTable.h.

References ink_hash_table_lookup_entry().

RawHashTable_Key RawHashTable::getKeyFromBinding ( RawHashTable_Binding binding  )  [inline]

This function takes a binding and extracts the key.

Definition at line 248 of file RawHashTable.h.

References ink_hash_table_entry_key().

Referenced by HttpCompat::determine_set_by_language(), and HttpBodyFactory::dump_template_tables().

RawHashTable_Binding * RawHashTable::getOrCreateBinding ( RawHashTable_Key  key,
bool *  was_new = NULL 
) [inline]

This function looks up a binding for key in the hash table, creates a binding if one doesn't exist, and returns a pointer to the binding data structure directly inside the hash table.

If was_new is not NULL, true is stored through was_new. If no binding previously existed, false is stored through was_new if a binding previously existed.

Definition at line 217 of file RawHashTable.h.

References ink_hash_table_get_entry().

bool RawHashTable::getValue ( RawHashTable_Key  key,
RawHashTable_Value value_ptr 
) [inline]

This routine gets the value associated with key.

If the key has a binding, the value is stored through value_ptr and true is returned. If the key DOES NOT have a binding, false is returned.

Definition at line 114 of file RawHashTable.h.

References ink_hash_table_lookup().

Referenced by HttpBodySet::get_template_by_name().

RawHashTable_Value RawHashTable::getValueFromBinding ( RawHashTable_Binding binding  )  [inline]

This function takes a binding and extracts the value.

Definition at line 261 of file RawHashTable.h.

References ink_hash_table_entry_value().

Referenced by HttpCompat::determine_set_by_language(), and HttpBodyFactory::dump_template_tables().

bool RawHashTable::isBound ( RawHashTable_Key  key  )  [inline]

This routine sets the value associated with key to the value pointed to by value_ptr.

If a value is previously bound to the key, the previous value is left dangling. The caller is responsible to freeing any previous value before setValue.

If the key has a binding, the value is stored through value_ptr and true is returned. If the key DOES NOT have a binding, false is returned.

Definition at line 149 of file RawHashTable.h.

References ink_hash_table_isbound().

RawHashTable_Binding * RawHashTable::nextBinding ( RawHashTable_IteratorState state_ptr  )  [inline]

This function takes a hash table and a pointer to iterator state, and advances to the next binding in the hash table, if any.

If there in a next binding, a pointer to the binding is returned, else NULL.

Definition at line 309 of file RawHashTable.h.

References ink_hash_table_iterator_next().

Referenced by HttpCompat::determine_set_by_language(), HttpBodyFactory::dump_template_tables(), and RawHashTableIter::operator++().

void RawHashTable::replaceString ( char *  key,
char *  string 
) [inline]

This rather specialized routine binds a malloc-allocated string value to the key, freeing any previous value.

The key must be a string, and the hash table must have been constructed as having key_type RawHashTable_KeyType_String.

Definition at line 181 of file RawHashTable.h.

References ink_hash_table_replace_string().

void RawHashTable::setBindingValue ( RawHashTable_Binding binding,
RawHashTable_Value  value 
) [inline]

This function looks up a binding for key in the hash table, creates a binding if one doesn't exist, and returns a pointer to the binding data structure directly inside the hash table.

If was_new is not NULL, true is stored through was_new. If no binding previously existed, false is stored through was_new if a binding previously existed.

Definition at line 238 of file RawHashTable.h.

References ink_hash_table_set_entry().

void RawHashTable::setValue ( RawHashTable_Key  key,
RawHashTable_Value  value 
) [inline]

This routine sets the value associated with key to the value.

If a value is previously bound to the key, the previous value is left dangling. The caller is responsible to freeing any previous binding values needing freeing before calling setValue.

If the key has a binding, the value is stored through value_ptr and true is returned. If the key DOES NOT have a binding, false is returned.

Definition at line 133 of file RawHashTable.h.

References ink_hash_table_insert().

Referenced by HttpBodySet::set_template_by_name().

bool RawHashTable::unbindKey ( RawHashTable_Key  key  )  [inline]

This routine removes any association for key from the hash table.

If data was bound to key, the binding will be deleted, but the value will not be deallocated. The caller is responsible to freeing any previous value before unbindKey.

Returns:
true if the key was previously bound, false otherwise.

Definition at line 165 of file RawHashTable.h.

References ink_hash_table_delete().


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