# My Digital Signal Controller Library # The objective of MyDSC library is to implement controllers with help digital signal processors, digital signal controllers or mixed signals processors.
Dependents: mydsc_sampling_example mydsc_sampling_example mydsc-serial-example mydsc-nonblocking-example
include/mydsc_kvp.h@1:2c47778e8a67, 2020-02-28 (annotated)
- Committer:
- ghsalazar
- Date:
- Fri Feb 28 20:06:30 2020 +0000
- Revision:
- 1:2c47778e8a67
- Child:
- 2:1f276b0dd807
A key-value pairs handler is commited.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ghsalazar | 1:2c47778e8a67 | 1 | /** @file: mydsc_kvp.h |
ghsalazar | 1:2c47778e8a67 | 2 | @author Gastón H. Salazar-Silva <gaston_salazar@yahoo.com> |
ghsalazar | 1:2c47778e8a67 | 3 | **/ |
ghsalazar | 1:2c47778e8a67 | 4 | |
ghsalazar | 1:2c47778e8a67 | 5 | #ifndef MYDSC_kvp_H |
ghsalazar | 1:2c47778e8a67 | 6 | #define MYDSC_kvp_H |
ghsalazar | 1:2c47778e8a67 | 7 | |
ghsalazar | 1:2c47778e8a67 | 8 | #include <stdint.h> |
ghsalazar | 1:2c47778e8a67 | 9 | |
ghsalazar | 1:2c47778e8a67 | 10 | #ifdef __cplusplus |
ghsalazar | 1:2c47778e8a67 | 11 | extern "C" { |
ghsalazar | 1:2c47778e8a67 | 12 | #endif |
ghsalazar | 1:2c47778e8a67 | 13 | |
ghsalazar | 1:2c47778e8a67 | 14 | enum mydsc_kvp_errno_t { |
ghsalazar | 1:2c47778e8a67 | 15 | MYDSC_KVP_SUCCESS = 0, |
ghsalazar | 1:2c47778e8a67 | 16 | MYDSC_KVP_NO_SET = -1, |
ghsalazar | 1:2c47778e8a67 | 17 | MYDSC_KVP_NO_KEY = -2, |
ghsalazar | 1:2c47778e8a67 | 18 | MYDSC_KVP_WRONG_VALUE = -3 |
ghsalazar | 1:2c47778e8a67 | 19 | }; |
ghsalazar | 1:2c47778e8a67 | 20 | |
ghsalazar | 1:2c47778e8a67 | 21 | typedef struct mydsc_kvp_struct { |
ghsalazar | 1:2c47778e8a67 | 22 | char *key; |
ghsalazar | 1:2c47778e8a67 | 23 | char* (*get_function)(void); |
ghsalazar | 1:2c47778e8a67 | 24 | int (*set_function)(char*); |
ghsalazar | 1:2c47778e8a67 | 25 | struct mydsc_kvp_struct *next_kvp; |
ghsalazar | 1:2c47778e8a67 | 26 | } mydsc_kvp_t; |
ghsalazar | 1:2c47778e8a67 | 27 | |
ghsalazar | 1:2c47778e8a67 | 28 | int mydsc_kvp_init(mydsc_kvp_t* pkv); |
ghsalazar | 1:2c47778e8a67 | 29 | char* mydsc_kvp_get_value(mydsc_kvp_t* pkv, char* key); |
ghsalazar | 1:2c47778e8a67 | 30 | int mydsc_kvp_set_value(mydsc_kvp_t* pkv, char* key, char* value); |
ghsalazar | 1:2c47778e8a67 | 31 | int mydsc_kvp_append(mydsc_kvp_t* pkv, char* key, |
ghsalazar | 1:2c47778e8a67 | 32 | char* (*get_function)(void), |
ghsalazar | 1:2c47778e8a67 | 33 | int (*set_function)(char*)); |
ghsalazar | 1:2c47778e8a67 | 34 | |
ghsalazar | 1:2c47778e8a67 | 35 | #ifdef __cplusplus |
ghsalazar | 1:2c47778e8a67 | 36 | } |
ghsalazar | 1:2c47778e8a67 | 37 | #endif |
ghsalazar | 1:2c47778e8a67 | 38 | |
ghsalazar | 1:2c47778e8a67 | 39 | #endif // MYDSC_RING_BUFFER_H |