2023-09-04 12:21:37 +02:00
|
|
|
/* Path list.
|
2021-06-21 16:12:47 -04:00
|
|
|
*
|
2022-03-15 09:18:01 -04:00
|
|
|
* Author: Steffen Vogel <post@steffenvogel.de>
|
2022-03-15 09:28:57 -04:00
|
|
|
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
|
2022-07-04 18:20:03 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2021-06-21 16:12:47 -04:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
#include <villas/path.hpp>
|
2023-09-07 11:46:39 +02:00
|
|
|
#include <villas/path_list.hpp>
|
2021-06-21 16:12:47 -04:00
|
|
|
|
|
|
|
using namespace villas::node;
|
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
Path *PathList::lookup(const uuid_t &uuid) const {
|
|
|
|
for (auto *p : *this) {
|
|
|
|
if (!uuid_compare(uuid, p->uuid))
|
|
|
|
return p;
|
|
|
|
}
|
2021-06-21 16:12:47 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
return nullptr;
|
2021-06-21 16:12:47 -04:00
|
|
|
}
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
json_t *PathList::toJson() const {
|
|
|
|
json_t *json_paths = json_array();
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
for (auto *p : *this)
|
|
|
|
json_array_append_new(json_paths, p->toJson());
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
return json_paths;
|
2021-08-10 10:12:48 -04:00
|
|
|
}
|