Brad Bishop | f3df6b4 | 2017-01-06 10:14:09 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 9331ab7 | 2018-01-29 09:48:47 -0800 | [diff] [blame] | 3 | #include "sensorset.hpp" |
Brad Bishop | f3df6b4 | 2017-01-06 10:14:09 -0500 | [diff] [blame] | 4 | |
Patrick Venture | 043d323 | 2018-08-31 10:10:53 -0700 | [diff] [blame] | 5 | #include <string> |
| 6 | |
| 7 | namespace env |
| 8 | { |
Patrick Venture | 7a5285d | 2018-04-17 19:15:05 -0700 | [diff] [blame] | 9 | |
Matt Spinler | 049e0dd | 2017-10-12 16:33:22 -0500 | [diff] [blame] | 10 | /** @brief Reads an environment variable |
| 11 | * |
Patrick Venture | a24c880 | 2018-04-17 19:38:06 -0700 | [diff] [blame] | 12 | * Reads the environment for that key |
| 13 | * |
| 14 | * @param[in] key - the key |
| 15 | * |
| 16 | * @return string - the env var value |
| 17 | */ |
| 18 | std::string getEnv(const char* key); |
| 19 | |
| 20 | /** @brief Reads an environment variable |
| 21 | * |
Matt Spinler | 049e0dd | 2017-10-12 16:33:22 -0500 | [diff] [blame] | 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 | */ |
Patrick Venture | 043d323 | 2018-08-31 10:10:53 -0700 | [diff] [blame] | 29 | std::string getEnv(const char* prefix, const SensorSet::key_type& sensor); |
Tom Joseph | 1f8a958 | 2017-06-12 20:10:59 +0530 | [diff] [blame] | 30 | |
Matt Spinler | 049e0dd | 2017-10-12 16:33:22 -0500 | [diff] [blame] | 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 | */ |
Patrick Venture | 043d323 | 2018-08-31 10:10:53 -0700 | [diff] [blame] | 39 | std::string getEnv(const char* prefix, const std::string& type, |
| 40 | const std::string& id); |
Matt Spinler | 049e0dd | 2017-10-12 16:33:22 -0500 | [diff] [blame] | 41 | |
Matt Spinler | 82d507d | 2017-10-12 16:36:57 -0500 | [diff] [blame] | 42 | /** @brief Gets the ID for the sensor with a level of indirection |
| 43 | * |
Matt Spinler | 7c42480 | 2018-05-04 10:52:40 -0500 | [diff] [blame] | 44 | * Read the ID from the <path>/<item><X>_<suffix> file. |
Matt Spinler | 82d507d | 2017-10-12 16:36:57 -0500 | [diff] [blame] | 45 | * <item> & <X> are populated from the sensor key. |
| 46 | * |
| 47 | * @param[in] path - Directory path of the label file |
Matt Spinler | 7c42480 | 2018-05-04 10:52:40 -0500 | [diff] [blame] | 48 | * @param[in] fileSuffix - The file suffix |
Matt Spinler | 82d507d | 2017-10-12 16:36:57 -0500 | [diff] [blame] | 49 | * @param[in] sensor - Sensor details |
| 50 | */ |
Patrick Venture | 043d323 | 2018-08-31 10:10:53 -0700 | [diff] [blame] | 51 | std::string getIndirectID(std::string path, const std::string& fileSuffix, |
| 52 | const SensorSet::key_type& sensor); |
Patrick Venture | 7a5285d | 2018-04-17 19:15:05 -0700 | [diff] [blame] | 53 | |
Patrick Venture | 043d323 | 2018-08-31 10:10:53 -0700 | [diff] [blame] | 54 | } // namespace env |