Brad Bishop | ab795a1 | 2017-01-05 20:50:49 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Carol Wang | 9bbe602 | 2019-08-01 17:31:30 +0800 | [diff] [blame] | 3 | #include "sensorset.hpp" |
| 4 | |
Brad Bishop | ab795a1 | 2017-01-05 20:50:49 -0500 | [diff] [blame] | 5 | #include <cstdlib> |
| 6 | |
| 7 | namespace phosphor |
| 8 | { |
| 9 | namespace utility |
| 10 | { |
| 11 | /** @struct Free |
| 12 | * @brief A malloc cleanup type for use with smart pointers. |
| 13 | */ |
| 14 | template <typename T> |
| 15 | struct Free |
| 16 | { |
| 17 | void operator()(T* ptr) const |
| 18 | { |
| 19 | free(ptr); |
| 20 | } |
| 21 | }; |
Carol Wang | 9bbe602 | 2019-08-01 17:31:30 +0800 | [diff] [blame] | 22 | |
| 23 | /** @brief Check if AVERAGE_power* is set to be true in env |
| 24 | * |
| 25 | * @param[in] sensor - Sensor details |
| 26 | * |
| 27 | * @return bool - true or false |
| 28 | */ |
| 29 | inline bool isAverageEnvSet(const SensorSet::key_type& sensor) |
| 30 | { |
| 31 | return env::getEnv("AVERAGE", sensor.first, sensor.second) == "true"; |
| 32 | } |
Brad Bishop | ab795a1 | 2017-01-05 20:50:49 -0500 | [diff] [blame] | 33 | } // namespace utility |
| 34 | } // namespace phosphor |