setGetHashTable.h File Reference

#include "hashtable.h"
#include "ObjectStructure.h"

Include dependency graph for setGetHashTable.h:

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

Go to the source code of this file.

Typedefs

typedef hashtable GetPropertyHashTable
typedef hashtable SetPropertyHashTable
typedef int(*) getPropertyFunc (sciPointObj *)
typedef int(*) setPropertyFunc (sciPointObj *, int, int, int, int)

Functions

GetPropertyHashTablecreateGetHashTable (void)
void destroyGetHashTable (GetPropertyHashTable *hashTable)
getPropertyFunc searchGetHashtable (GetPropertyHashTable *hashTable, char *key)
int insertGetHashtable (GetPropertyHashTable *hashTable, char *key, getPropertyFunc value)
GetPropertyHashTablecreateSetHashTable (void)
void destroySetHashTable (SetPropertyHashTable *hashTable)
setPropertyFunc searchSetHashtable (SetPropertyHashTable *hashTable, char *key)
int insertSetHashtable (SetPropertyHashTable *hashTable, char *key, setPropertyFunc value)


Typedef Documentation

typedef int(*) getPropertyFunc(sciPointObj *)

Prototype of functions used to get a specific property of an handle. The sciPointObj is the object to get the property from The return value is 0 if the call was successful and -1 otherwise.

Definition at line 33 of file setGetHashTable.h.

typedef struct hashtable GetPropertyHashTable

Hide the real type of hashtable

Definition at line 19 of file setGetHashTable.h.

typedef int(*) setPropertyFunc(sciPointObj *, int, int, int, int)

Prototype of functions used to set a specific property of an handle. The sciPointObj is the object to get the property from The return value is SET_PROERTY_SUCEED if the call was successful and a redraw is needed SET_PROPERTY_UNCHANGED if nothing was actually changed and SET_PROPERTY_ERROR if an error occurred.

Definition at line 42 of file setGetHashTable.h.

typedef struct hashtable SetPropertyHashTable

Hide the real type of hashtable

Definition at line 24 of file setGetHashTable.h.


Function Documentation

GetPropertyHashTable* createGetHashTable ( void   ) 

Create a new hashTable of get functions

Definition at line 42 of file setGetHashTable.c.

References create_hashtable(), setGetHashTableEqualKeys(), and setGetHashTableHash().

Referenced by createScilabGetHashTable().

00043 {
00044   return create_hashtable(16, setGetHashTableHash, setGetHashTableEqualKeys ) ;
00045 }

Here is the call graph for this function:

Here is the caller graph for this function:

GetPropertyHashTable* createSetHashTable ( void   ) 

Create a new hashTable of set functions

Definition at line 72 of file setGetHashTable.c.

References create_hashtable(), setGetHashTableEqualKeys(), and setGetHashTableHash().

Referenced by createScilabSetHashTable().

00073 {
00074   return create_hashtable(16, setGetHashTableHash, setGetHashTableEqualKeys ) ;
00075 }

Here is the call graph for this function:

Here is the caller graph for this function:

void destroyGetHashTable ( GetPropertyHashTable hashTable  ) 

destroy the hashtable and free the used resources.

Definition at line 47 of file setGetHashTable.c.

References hashtable_destroy().

Referenced by destroyScilabGetHashTable().

00048 {
00049   /* we just store pointers */
00050   hashtable_destroy( hashTable, 0 ) ;
00051 }

Here is the call graph for this function:

Here is the caller graph for this function:

void destroySetHashTable ( SetPropertyHashTable hashTable  ) 

destroy the hashtable and free the used resources.

Definition at line 77 of file setGetHashTable.c.

References hashtable_destroy().

Referenced by destroyScilabSetHashTable().

00078 {
00079   /* we just store pointers */
00080   hashtable_destroy( hashTable, 0 ) ;
00081 }

Here is the call graph for this function:

Here is the caller graph for this function:

int insertGetHashtable ( GetPropertyHashTable hashTable,
char *  key,
getPropertyFunc  value 
)

Definition at line 58 of file setGetHashTable.c.

References hashtable_insert(), MALLOC, and NULL.

Referenced by createScilabGetHashTable().

00059 {
00060   /* allocate a new key because the hashtable claims ownership */
00061   /* and will free it when destroyed */
00062   char * copyKey   = NULL ;
00063   int    keyLength = strlen( key ) + 1 ;
00064 
00065   copyKey = MALLOC( keyLength * sizeof(char) ) ;
00066   if ( copyKey == NULL ) { return 0 ; }
00067   strcpy( copyKey, key ) ;
00068 
00069   return hashtable_insert( hashTable, copyKey, value ) ;
00070 }

Here is the call graph for this function:

Here is the caller graph for this function:

int insertSetHashtable ( SetPropertyHashTable hashTable,
char *  key,
setPropertyFunc  value 
)

Definition at line 88 of file setGetHashTable.c.

References hashtable_insert(), MALLOC, and NULL.

Referenced by createScilabSetHashTable().

00089 {
00090   /* allocate a new key because the hashtable claims ownership */
00091   /* and will free it when destroyed */
00092   char * copyKey   = NULL ;
00093   int    keyLength = strlen( key ) + 1 ;
00094 
00095   copyKey = MALLOC( keyLength * sizeof(char) ) ;
00096   strcpy( copyKey, key ) ;
00097 
00098   return hashtable_insert( hashTable, copyKey, value ) ;
00099 }

Here is the call graph for this function:

Here is the caller graph for this function:

getPropertyFunc searchGetHashtable ( GetPropertyHashTable hashTable,
char *  key 
)

Search for a key in a hashtable. if succeed, return the value needed. if failed, return NULL

Returns:
The corresponding value if the key was found, NULL otherwise.

Definition at line 53 of file setGetHashTable.c.

References hashtable_search().

Referenced by callGetProperty().

00054 {
00055   return (getPropertyFunc) hashtable_search( hashTable, key ) ;
00056 }

Here is the call graph for this function:

Here is the caller graph for this function:

setPropertyFunc searchSetHashtable ( SetPropertyHashTable hashTable,
char *  key 
)

Search for a key in a hashtable. if succeed, return the value needed. if failed, return NULL

Returns:
The corresponding value if the key was found, NULL otherwise.

Definition at line 83 of file setGetHashTable.c.

References hashtable_search().

Referenced by callSetProperty().

00084 {
00085   return (setPropertyFunc) hashtable_search( hashTable, key ) ;
00086 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Sun Mar 4 15:44:27 2007 for Scilab [trunk] by  doxygen 1.5.1