diff ParamBag.h @ 7:1bf28dddc45f

Created MC_shared branch
author Me@portablequad
date Sat, 11 Feb 2012 20:08:58 -0800
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ParamBag.h	Sat Feb 11 20:08:58 2012 -0800
     1.3 @@ -0,0 +1,59 @@
     1.4 +/* 
     1.5 + * 
     1.6 + * Author: SeanHalle@yahoo.com
     1.7 + *
     1.8 + * Created on November 19, 2009, 6:30 PM
     1.9 + */
    1.10 +
    1.11 +#ifndef _PARAM_H
    1.12 +#define	_PARAM_H
    1.13 +
    1.14 +#include "../../VMS_Implementations/VMS_impl/VMS_primitive_data_types.h"
    1.15 +#include "../../VMS_Implementations/VMS_impl/vmalloc.h"
    1.16 +
    1.17 +typedef
    1.18 +struct
    1.19 + { int type;
    1.20 +   int intValue;
    1.21 +   char * strValue;
    1.22 +   float floatValue;
    1.23 + }
    1.24 +ParamStruc;
    1.25 +
    1.26 +#define INT_PARAM_TYPE    0
    1.27 +#define STRING_PARAM_TYPE 1
    1.28 +#define FLOAT_PARAM_TYPE  2
    1.29 +
    1.30 +#define PARAM_BAG_HASHSIZE 1024
    1.31 +
    1.32 +typedef struct _ParamBagHashEntry ParamBagHashEntry;
    1.33 +
    1.34 +struct _ParamBagHashEntry
    1.35 + {
    1.36 +   char       *key;
    1.37 +   ParamStruc *param;
    1.38 +   struct _ParamBagHashEntry *next;
    1.39 + }
    1.40 +/*ParamBagHashEntry*/;
    1.41 +
    1.42 +
    1.43 +typedef
    1.44 +struct
    1.45 + { int bagSz;
    1.46 +   ParamBagHashEntry* *entries;
    1.47 + }
    1.48 +ParamBag;
    1.49 +
    1.50 +
    1.51 +ParamBag    *makeParamBag();
    1.52 +void         readParamFileIntoBag( char *paramFileName, ParamBag * bag );
    1.53 +ParamStruc  *getParamFromBag( char *key, ParamBag * bag );
    1.54 +int          addParamToBag( char* key, ParamStruc *param, ParamBag *bag );
    1.55 +void         freeParamBag( ParamBag *bag );
    1.56 +//char        *paramBagToString( ParamBag * bag );
    1.57 +ParamStruc  *makeParamStruc();
    1.58 +ParamStruc  *makeParamFromStrs( char * type, char *value );
    1.59 +ssize_t      getline( char **lineptr, size_t *n, FILE *stream );
    1.60 +
    1.61 +#endif	/* _PARAM_H */
    1.62 +