Rev 4505 | Rev 4733 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4505 | Rev 4704 | ||
|---|---|---|---|
| Line 29... | Line 29... | ||
| 29 | /** @addtogroup net |
29 | /** @addtogroup net |
| 30 | * @{ |
30 | * @{ |
| 31 | */ |
31 | */ |
| 32 | 32 | ||
| 33 | /** @file |
33 | /** @file |
| - | 34 | * Character string to generic type map. |
|
| 34 | */ |
35 | */ |
| 35 | 36 | ||
| 36 | #ifndef __GENERIC_CHAR_MAP_H__ |
37 | #ifndef __GENERIC_CHAR_MAP_H__ |
| 37 | #define __GENERIC_CHAR_MAP_H__ |
38 | #define __GENERIC_CHAR_MAP_H__ |
| 38 | 39 | ||
| Line 42... | Line 43... | ||
| 42 | #include "../err.h" |
43 | #include "../err.h" |
| 43 | 44 | ||
| 44 | #include "char_map.h" |
45 | #include "char_map.h" |
| 45 | #include "generic_field.h" |
46 | #include "generic_field.h" |
| 46 | 47 | ||
| - | 48 | /** Internal magic value for a map consistency check. |
|
| - | 49 | */ |
|
| 47 | #define GENERIC_CHAR_MAP_MAGIC_VALUE 0x12345622 |
50 | #define GENERIC_CHAR_MAP_MAGIC_VALUE 0x12345622 |
| 48 | 51 | ||
| - | 52 | /** Character string to generic type map declaration. |
|
| - | 53 | * @param name Name of the map. Input parameter. |
|
| - | 54 | * @param type Inner object type. Input parameter |
|
| - | 55 | */ |
|
| 49 | #define GENERIC_CHAR_MAP_DECLARE( name, type ) \ |
56 | #define GENERIC_CHAR_MAP_DECLARE( name, type ) \ |
| 50 | \ |
57 | \ |
| 51 | GENERIC_FIELD_DECLARE( name##_items, type ) \ |
58 | GENERIC_FIELD_DECLARE( name##_items, type ) \ |
| 52 | \ |
59 | \ |
| 53 | typedef struct name name##_t; \ |
60 | typedef struct name name##_t; \ |
| Line 66... | Line 73... | ||
| 66 | type * name##_find( name##_ref map, const char * name, const size_t length ); \ |
73 | type * name##_find( name##_ref map, const char * name, const size_t length ); \ |
| 67 | type * name##_get_index( name##_ref map, int index ); \ |
74 | type * name##_get_index( name##_ref map, int index ); \ |
| 68 | int name##_initialize( name##_ref map ); \ |
75 | int name##_initialize( name##_ref map ); \ |
| 69 | int name##_is_valid( name##_ref map ); |
76 | int name##_is_valid( name##_ref map ); |
| 70 | 77 | ||
| - | 78 | /** Character string to generic type map implementation. |
|
| - | 79 | * Should follow declaration with the same parameters. |
|
| - | 80 | * @param name Name of the map. Input parameter. |
|
| - | 81 | * @param type Inner object type. Input parameter |
|
| - | 82 | */ |
|
| 71 | #define GENERIC_CHAR_MAP_IMPLEMENT( name, type ) \ |
83 | #define GENERIC_CHAR_MAP_IMPLEMENT( name, type ) \ |
| 72 | \ |
84 | \ |
| 73 | GENERIC_FIELD_IMPLEMENT( name##_items, type ) \ |
85 | GENERIC_FIELD_IMPLEMENT( name##_items, type ) \ |
| 74 | \ |
86 | \ |
| 75 | int name##_add( name##_ref map, const char * name, const size_t length, type * value ){ \ |
87 | int name##_add( name##_ref map, const char * name, const size_t length, type * value ){ \ |