summaryrefslogtreecommitdiffstats
path: root/build/buildjson.hpp
blob: afc90dff1301be1fb3046f3f5d4f58fdfcba7a19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once

#include <nlohmann/json.hpp>
#include <string>

using json = nlohmann::json;

/**
 * Given json data, validate the minimum.
 * The json data must be valid, and must contain two keys:
 * sensors, and zones.
 *
 * @param[in] data - the json data.
 * @return nothing - throws exceptions on invalid bits.
 */
void validateJson(const json& data);

/**
 * Given a json configuration file, parse it.
 *
 * There must be at least one sensor, and one zone.
 * That one zone must contain at least one PID.
 *
 * @param[in] path - path to the configuration
 * @return the json data.
 */
json parseValidateJson(const std::string& path);
OpenPOWER on IntegriCloud