env.hpp (7c424807216cf276fb247954060561030720ea4e) env.hpp (043d32306e00484afc446a44789b61869ea14f84)
1#pragma once
2
1#pragma once
2
3#include <string>
4
5#include "sensorset.hpp"
6
3#include "sensorset.hpp"
4
7namespace env {
5#include <string>
8
6
7namespace env
8{
9
9/** @brief Reads an environment variable
10 *
11 * Reads the environment for that key
12 *
13 * @param[in] key - the key
14 *
15 * @return string - the env var value
16 */
17std::string getEnv(const char* key);
18
19/** @brief Reads an environment variable
20 *
21 * Reads <prefix>_<sensor.first><sensor.second>
22 *
23 * @param[in] prefix - the variable prefix
24 * @param[in] sensor - Sensor details
25 *
26 * @return string - the env var value
27 */
10/** @brief Reads an environment variable
11 *
12 * Reads the environment for that key
13 *
14 * @param[in] key - the key
15 *
16 * @return string - the env var value
17 */
18std::string getEnv(const char* key);
19
20/** @brief Reads an environment variable
21 *
22 * Reads <prefix>_<sensor.first><sensor.second>
23 *
24 * @param[in] prefix - the variable prefix
25 * @param[in] sensor - Sensor details
26 *
27 * @return string - the env var value
28 */
28std::string getEnv(
29 const char* prefix, const SensorSet::key_type& sensor);
29std::string getEnv(const char* prefix, const SensorSet::key_type& sensor);
30
31/** @brief Reads an environment variable, and takes type and id separately
32 *
33 * @param[in] prefix - the variable prefix
34 * @param[in] type - sensor type, like 'temp'
35 * @param[in] id - sensor ID, like '5'
36 *
37 * @return string - the env var value
38 */
30
31/** @brief Reads an environment variable, and takes type and id separately
32 *
33 * @param[in] prefix - the variable prefix
34 * @param[in] type - sensor type, like 'temp'
35 * @param[in] id - sensor ID, like '5'
36 *
37 * @return string - the env var value
38 */
39std::string getEnv(
40 const char* prefix,
41 const std::string& type,
42 const std::string& id);
39std::string getEnv(const char* prefix, const std::string& type,
40 const std::string& id);
43
44/** @brief Gets the ID for the sensor with a level of indirection
45 *
46 * Read the ID from the <path>/<item><X>_<suffix> file.
47 * <item> & <X> are populated from the sensor key.
48 *
49 * @param[in] path - Directory path of the label file
50 * @param[in] fileSuffix - The file suffix
51 * @param[in] sensor - Sensor details
52 */
41
42/** @brief Gets the ID for the sensor with a level of indirection
43 *
44 * Read the ID from the <path>/<item><X>_<suffix> file.
45 * <item> & <X> are populated from the sensor key.
46 *
47 * @param[in] path - Directory path of the label file
48 * @param[in] fileSuffix - The file suffix
49 * @param[in] sensor - Sensor details
50 */
53std::string getIndirectID(
54 std::string path,
55 const std::string& fileSuffix,
56 const SensorSet::key_type& sensor);
51std::string getIndirectID(std::string path, const std::string& fileSuffix,
52 const SensorSet::key_type& sensor);
57
53
58} // namespace env
54} // namespace env