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