1 // Copyright 2011 Juri Glass, Mathias Runge, Nadim El Sayed 2 // DAI-Labor, TU-Berlin 3 // 4 // This file is part of libSML. 5 // 6 // libSML is free software: you can redistribute it and/or modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // (at your option) any later version. 10 // 11 // libSML is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with libSML. If not, see <http://www.gnu.org/licenses/>. 18 19 #ifndef SML_LIST_H_ 20 #define SML_LIST_H_ 21 22 #include "sml_time.h" 23 #include "sml_octet_string.h" 24 #include "sml_number.h" 25 #include "sml_status.h" 26 #include "sml_value.h" 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 typedef struct { 33 void **elems; 34 int elems_len; 35 void (*elem_free) (void *elem); 36 } sml_sequence; 37 38 sml_sequence *sml_sequence_init(void (*elem_free) (void *elem)); 39 sml_sequence *sml_sequence_parse(sml_buffer *buf, void *(*elem_parse) (sml_buffer *buf), void (*elem_free) (void *elem)); 40 void sml_sequence_write(sml_sequence *seq, sml_buffer *buf, void (*elem_write) (void *elem, sml_buffer *buf)); 41 void sml_sequence_free(sml_sequence *seq); 42 void sml_sequence_add(sml_sequence *list, void *new_entry); 43 44 typedef struct sml_list_entry { 45 octet_string *obj_name; 46 sml_status *status; // optional 47 sml_time *val_time; // optional 48 sml_unit *unit; // optional 49 i8 *scaler; // optional 50 sml_value *value; 51 sml_signature *value_signature; // optional 52 53 // list specific 54 struct sml_list_entry *next; 55 } sml_list; 56 57 sml_list *sml_list_init(); 58 sml_list *sml_list_parse(sml_buffer *buf); 59 void sml_list_write(sml_list *list, sml_buffer *buf); 60 void sml_list_add(sml_list *list, sml_list *new_entry); 61 void sml_list_free(sml_list *list); 62 63 #ifdef __cplusplus 64 } 65 #endif 66 67 68 #endif /* SML_LIST_H_ */ 69 70