mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
signal: add signal_list_copy()
This commit is contained in:
parent
3bab0c9c06
commit
3f6ddaa653
2 changed files with 17 additions and 0 deletions
|
@ -111,6 +111,7 @@ int signal_list_destroy(struct vlist *list);
|
|||
int signal_list_parse(struct vlist *list, json_t *cfg);
|
||||
int signal_list_generate(struct vlist *list, unsigned len, enum signal_type fmt);
|
||||
void signal_list_dump(const struct vlist *list, const union signal_data *data, int len);
|
||||
int signal_list_copy(struct vlist *dst, const struct vlist *src);
|
||||
|
||||
enum signal_type signal_type_from_str(const char *str);
|
||||
|
||||
|
|
16
lib/signal.c
16
lib/signal.c
|
@ -307,6 +307,22 @@ void signal_list_dump(const struct vlist *list, const union signal_data *data, i
|
|||
}
|
||||
}
|
||||
|
||||
int signal_list_copy(struct vlist *dst, const struct vlist *src)
|
||||
{
|
||||
assert(src->state == STATE_INITIALIZED);
|
||||
assert(dst->state == STATE_INITIALIZED);
|
||||
|
||||
for (size_t i = 0; i < vlist_length(src); i++) {
|
||||
struct signal *s = (struct signal *) vlist_at_safe(src, i);
|
||||
|
||||
signal_incref(s);
|
||||
|
||||
vlist_push(dst, s);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Signal type */
|
||||
|
||||
enum signal_type signal_type_from_str(const char *str)
|
||||
|
|
Loading…
Add table
Reference in a new issue