First class data visualization and communication library with embedded devices. Code is maintained at github.com/Overdrivr/Telemetry

Dependents:   telemetry_car_demo telemetry_demo_FRDM-TFC telemetry_example_01 telemetry_indexed_data_demo ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dictionnary.h Source File

dictionnary.h

00001 #ifndef TELEMETRY_DICTIONNARY_H_
00002 #define TELEMETRY_DICTIONNARY_H_
00003 
00004 #include "stdint.h"
00005 
00006 
00007 enum ptr_type {
00008   ptr_f32 = 0,
00009   ptr_u8 = 1,
00010   ptr_u16 = 2,
00011   ptr_u32 = 3,
00012   ptr_i8 = 4,
00013   ptr_i16 = 5,
00014   ptr_i32 = 6,
00015   ptr_function = 8
00016 };
00017 
00018 typedef enum ptr_type ptr_type;
00019 
00020 struct nlist { /* table entry: */
00021     struct nlist *next; /* next entry in chain */
00022     char * key;
00023 
00024     // Table can store for a given key all following pointers
00025     float     * ptr_f32;
00026     uint8_t   * ptr_u8;
00027     uint16_t  * ptr_u16;
00028     uint32_t  * ptr_u32;
00029     int8_t    * ptr_i8;
00030     int16_t   * ptr_i16;
00031     int32_t   * ptr_i32;
00032     void      * ptr_function;
00033 };
00034 
00035 #define HASHSIZE 101
00036 
00037 void init_table(struct nlist ** hashtab);
00038 
00039 /* lookup: look for s in hashtab */
00040 struct nlist * lookup(struct nlist ** hashtab, const char * key);
00041 
00042 struct nlist * install(struct nlist ** hashtab, const char * key, void * ptr, ptr_type type);
00043 
00044 #endif