1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/include/villas/config_helper.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.2 KiB
C++
Raw Permalink Normal View History

/* Helpers for configuration parsers.
*
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
*/
#pragma once
#include <jansson.h>
#include <villas/node/config.hpp>
#include <villas/sample.hpp>
#ifdef WITH_CONFIG
#include <libconfig.h>
#endif
namespace villas {
namespace node {
2019-04-05 11:01:49 +02:00
#ifdef WITH_CONFIG
2019-03-26 07:01:10 +01:00
// Convert a libconfig object to a jansson object
json_t *config_to_json(struct config_setting_t *cfg);
2019-03-26 07:01:10 +01:00
// Convert a jansson object into a libconfig object.
int json_to_config(json_t *json, struct config_setting_t *parent);
2019-04-05 11:01:49 +02:00
#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);
2019-03-26 07:01:10 +01:00
// 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