GetHashTable.c File Reference

#include "GetHashTable.h"
#include "machine.h"
#include "getHandleProperty.h"
#include "sciprint.h"

Include dependency graph for GetHashTable.c:

Go to the source code of this file.

Data Structures

struct  getHashTableCouple

Defines

#define NB_PROPERTIES   125

Functions

GetPropertyHashTablecreateScilabGetHashTable (void)
int callGetProperty (sciPointObj *pObj, char *propertyName)
void destroyScilabGetHashTable (void)

Variables

static BOOL getHashTableCreated = FALSE
static GetPropertyHashTablegetHashTable = NULL
static getHashTableCouple propertyTable [NB_PROPERTIES]


Define Documentation

#define NB_PROPERTIES   125

number of properties don't forget to modify it each time the propertyTable is modified.

Definition at line 38 of file GetHashTable.c.

Referenced by createScilabGetHashTable(), and createScilabSetHashTable().


Function Documentation

int callGetProperty ( sciPointObj pObj,
char *  propertyName 
)

call the function which the property propertyName of object pObj

Returns:
0 if successful -1 if an error occured in the get function 1 if the property was not found

Definition at line 201 of file GetHashTable.c.

References getHashTable, NULL, sciprint(), and searchGetHashtable().

Referenced by sciGet().

00202 {
00203   getPropertyFunc accessor = searchGetHashtable( getHashTable, propertyName ) ;
00204   if ( accessor == NULL )
00205   {
00206     sciprint( "Unknown property.\n" ) ;
00207     return -1 ;
00208   }
00209   return accessor( pObj ) ;
00210 }

Here is the call graph for this function:

Here is the caller graph for this function:

GetPropertyHashTable* createScilabGetHashTable ( void   ) 

create the fill hash table already filled for get functions this use the singleton pattern since only one hashtable is useful.

Definition at line 173 of file GetHashTable.c.

References createGetHashTable(), getHashTable, getHashTableCreated, i, insertGetHashtable(), NB_PROPERTIES, NULL, propertyTable, and TRUE.

Referenced by loadGraphicModule(), and sciGet().

00174 {
00175   int i ;
00176   if ( getHashTableCreated )
00177   {
00178     return getHashTable ;
00179   }
00180 
00181   /* create the hash table */
00182   getHashTable = createGetHashTable() ;
00183 
00184   if ( getHashTable == NULL )
00185   {
00186     return NULL ;
00187   }
00188 
00189   /* insert every couple */
00190   for ( i = 0 ; i < NB_PROPERTIES ; i++ )
00191   {
00192     insertGetHashtable( getHashTable, propertyTable[i].key, propertyTable[i].accessor ) ;
00193   }
00194 
00195   getHashTableCreated = TRUE ;
00196 
00197   return getHashTable ;
00198 
00199 }

Here is the call graph for this function:

Here is the caller graph for this function:

void destroyScilabGetHashTable ( void   ) 

Delete the scilab get hashtable

Definition at line 212 of file GetHashTable.c.

References destroyGetHashTable(), FALSE, getHashTable, and getHashTableCreated.

Referenced by closeGraphicModule().

00213 {
00214   if ( !getHashTableCreated )
00215   {
00216     return ;
00217   }
00218   
00219   destroyGetHashTable( getHashTable ) ;
00220   getHashTableCreated = FALSE ;
00221 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

GetPropertyHashTable* getHashTable = NULL [static]

the get hashtable

Definition at line 21 of file GetHashTable.c.

Referenced by callGetProperty(), createScilabGetHashTable(), and destroyScilabGetHashTable().

BOOL getHashTableCreated = FALSE [static]

use for the singleton to know if the hashtable has already be created.

Definition at line 16 of file GetHashTable.c.

Referenced by createScilabGetHashTable(), and destroyScilabGetHashTable().

getHashTableCouple propertyTable[NB_PROPERTIES] [static]

list of all property names and associated functions in scilab This is inserted in the hashTable

Definition at line 44 of file GetHashTable.c.

Referenced by createScilabGetHashTable(), and createScilabSetHashTable().


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