1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-23 00:00:01 +01:00
VILLASnode/include/villas/config_helper.hpp
Steffen Vogel 0735eb0f89 Make project REUSE compliant
And various other cleanups and harmonizations

Signed-off-by: Steffen Vogel <steffen.vogel@opal-rt.com>
2023-09-07 11:16:04 +02:00

44 lines
1.1 KiB
C++

/* Helpers for configuration parsers.
*
* Author: Steffen Vogel <post@steffenvogel.de>
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#ifdef WITH_CONFIG
#include <libconfig.h>
#endif
#include <jansson.h>
#include <villas/node/config.hpp>
#include <villas/sample.hpp>
namespace villas {
namespace node {
#ifdef WITH_CONFIG
// Convert a libconfig object to a jansson object
json_t * config_to_json(struct config_setting_t *cfg);
// Convert a jansson object into a libconfig object.
int json_to_config(json_t *json, struct config_setting_t *parent);
#endif // WITH_CONFIG
int json_object_extend_str(json_t *orig, const char *str);
void json_object_extend_key_value(json_t *obj, const char *key, const char *value);
void json_object_extend_key_value_token(json_t *obj, const char *key, const char *value);
// Merge two JSON objects recursively.
int json_object_extend(json_t *orig, json_t *merge);
json_t * json_load_cli(int argc, const char *argv[]);
} // namespace node
} // namespace villas