GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

GATTableAnyKey.h File Reference

Header file for the GATTableAnyKey class. More...

#include "GAT.h"

Include dependency graph for GATTableAnyKey.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define _GATTABLEANYKEY_H_   1

Typedefs

typedef GATuint32(* GATTable_GetKeySizeProc )(GATTable_const, void const *)
typedef GATBool(* GATTable_EqualKeysProc )(GATTable_const, void const *, void const *)
typedef unsigned long(* GATTable_GetHashProc )(GATTable_const, void const *)
typedef int(* GATTable_CloneKeyProc )(GATTable_const, void const *, void **)
typedef void(* GATTable_DestroyKeyProc )(GATTable_const, void **)

Functions

GATBool GATTable_Default_Equal_Keys (GATTable_const table, void const *key1, const void *key2)
 GATTable_Default_Equal_Keys.

unsigned long GATTable_Default_Hash_sdbm (GATTable_const table, void const *key)
 GATTable_Default_Hash_sdbm.

GATResult GATTable_Default_Clone_Key (GATTable_const table, void const *src, void **dest)
 GATTable_Default_CloneKey.

void GATTable_Default_Destroy_Key (GATTable_const table, void **key)
 GATTable_Default_Destroy_Key.

GATTable GATTable_CreateAnyKey (GATTable_GetKeySizeProc get_keysize, GATTable_EqualKeysProc equalkeys, GATTable_CloneKeyProc copykey, GATTable_GetHashProc get_hash, GATTable_DestroyKeyProc destroy_key)
 GATTable_CreateAnyKey Create the GATTable object.


Detailed Description

Header file for the GATTableAnyKey class.

This in an additional interface to the GATTable object, which allows to specify arbitrary key types.

Please note, that table type of tables are not serialisable! So use it with care.

Date:
Tue Nov 4 2003
Version:
Header:
/export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATTableAnyKey.h,v 1.5 2004/03/24 19:30:58 hartmutkaiser Exp

Copyright (C) Hartmut Kaiser This file is part of the GAT Engine. Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.

Use, modification and distribution is subject to the Gridlab Software License. (See accompanying file GLlicense.txt or copy at http://www.gridlab.org/GLlicense.txt)

Definition in file GATTableAnyKey.h.


Define Documentation

#define _GATTABLEANYKEY_H_   1
 

Definition at line 24 of file GATTableAnyKey.h.


Typedef Documentation

typedef GATuint32(* GATTable_GetKeySizeProc)(GATTable_const, void const *)
 

Definition at line 29 of file GATTableAnyKey.h.

Referenced by GATTable_CreateAnyKey().

typedef GATBool(* GATTable_EqualKeysProc)(GATTable_const, void const *, void const *)
 

Definition at line 30 of file GATTableAnyKey.h.

Referenced by GATTable_CreateAnyKey().

typedef unsigned long(* GATTable_GetHashProc)(GATTable_const, void const *)
 

Definition at line 32 of file GATTableAnyKey.h.

Referenced by GATTable_CreateAnyKey().

typedef int(* GATTable_CloneKeyProc)(GATTable_const, void const *, void **)
 

Definition at line 33 of file GATTableAnyKey.h.

Referenced by GATTable_CreateAnyKey().

typedef void(* GATTable_DestroyKeyProc)(GATTable_const, void **)
 

Definition at line 34 of file GATTableAnyKey.h.

Referenced by GATTable_CreateAnyKey().


Function Documentation

GATBool GATTable_Default_Equal_Keys GATTable_const    table,
void const *    key1,
void const *    key2
 

GATTable_Default_Equal_Keys.

The function GATTable_Default_Equal_Keys is the default callback function which is used to compare two different keys of a GATTableAnyKey for equality. This function compares the keys with the help of the function memcmp.

Parameters:
table  The table, for which these keys are to be used.
key1  first key for comparison.
key2  second key for comparison.
Returns:
GATTrue for equal keys, GATFalse for non equal keys

Definition at line 1651 of file GATTable.c.

References GATBool, GATFalse, GATTable_const, GATTable_Internal_Get_KeySize(), GATTrue, GATuint32, key1, and key2.

Referenced by GATTable_CreateAnyKey().

unsigned long GATTable_Default_Hash_sdbm GATTable_const    table,
void const *    key
 

GATTable_Default_Hash_sdbm.

The function GATTable_Default_Hash_sdbm is the default callback function which is used to calculate the hash value for a given key. This function calculates the hash value based on the plain memory representation of the key.

Parameters:
table  The table, for which this hash value is to be calculated.
key  The key to create a hash from.
Returns:
the hash value

Definition at line 1595 of file GATTable.c.

References GATTable_const, GATTable_Internal_Get_KeySize(), and GATuint32.

Referenced by GATTable_Create(), GATTable_CreateAnyKey(), GATTable_DeSerialise_Create(), and GATTable_SerialiseItems().

GATResult GATTable_Default_Clone_Key GATTable_const    table,
void const *    src,
void **    dest
 

GATTable_Default_CloneKey.

The function GATTable_Default_Clone_Key is the default callback function which is used to copy a key to a new location. This function calculates copies the key with the help of the function memcpy.

Parameters:
table  The table, into which this key is to be inserted.
src  The source memory area, where the key is to be copied from.
dest  The destination area, which receives the new key.
Returns:
A GAT error code.

Definition at line 1630 of file GATTable.c.

References GAT_MEMORYFAILURE, GAT_SUCCESS, GATTable_const, GATTable_Internal_Get_KeySize(), GATuint32, GATUtil_memdup(), and src.

Referenced by GATTable_CreateAnyKey().

void GATTable_Default_Destroy_Key GATTable_const    table,
void **    key
 

GATTable_Default_Destroy_Key.

The function GATTable_Default_Destroy_Key is the default callback function which is used to destroy a key (deallocate all associated memory). This function compares free's the key with the std function free().

Parameters:
table  The table, for which these keys are to be used.
key  The pointer to the key to deallocate.

Definition at line 1675 of file GATTable.c.

References GAT_UNUSED_PARAMETER, and GATTable_const.

Referenced by GATTable_Create(), GATTable_CreateAnyKey(), GATTable_DeSerialise_Create(), and GATTable_SerialiseItems().

GATTable GATTable_CreateAnyKey GATTable_GetKeySizeProc    get_keysize,
GATTable_EqualKeysProc    equalkeys,
GATTable_CloneKeyProc    copykey,
GATTable_GetHashProc    get_hash,
GATTable_DestroyKeyProc    destroy_key
 

GATTable_CreateAnyKey Create the GATTable object.

This is the method used by any application code to create a GATTable object, which used the provided callback functions.

Note though, that objects of this type may not be used for serialisation.

Parameters:
get_keysize  The callback function to calculate the size of a given key. This parameter must be supplied.
equalkeys  The callback function to compare two keys for equality. If this param is 0 (zero) the default callback function will be used (GATTable_Default_Equal_Keys).
get_hash  The callback function to calculate the hash value for a given key. If this param is 0 (zero) the default callback function will be used used (GATTable_Default_Hash_sdbm).
destroy_key  The callback function to destroy a key (deallocate all associated memory). If this parameter is 0 (zero), the default callback function will be used (GATTable_Default_Destroy_Key).
Returns:
The GATTable object

Definition at line 226 of file GATTable.c.

References GATTable_S::clone_key, GATTable_S::destroy_key, GATTable_S::element_count, GATTable_S::equal_keys, GATTable_S::GATObject__vtable, GATTable_S::GATSerialisable__vtable, GATTable__vtable, GATTable_CloneKeyProc, GATTable_Default_Clone_Key(), GATTable_Default_Destroy_Key(), GATTable_Default_Equal_Keys(), GATTable_Default_Hash_sdbm(), GATTable_DestroyKeyProc, GATTable_EqualKeysProc, GATTable_GetHashProc, GATTable_GetKeySizeProc, GATTable_ISerialisable__vtable, GATuint32, GATTable_S::get_hash, GATTable_S::get_key_size, GATTable_S::load_limit, size, GATTable_S::table, and GATTable_S::table_length.

Referenced by GATMonitorable_Impl_Create(), and GATTable_Create().