1 #pragma once 2 3 #include "sensorset.hpp" 4 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 { operator ()phosphor::utility::Free17 void operator()(T* ptr) const 18 { 19 free(ptr); 20 } 21 }; 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 */ isAverageEnvSet(const SensorSet::key_type & sensor)29inline bool isAverageEnvSet(const SensorSet::key_type& sensor) 30 { 31 return env::getEnv("AVERAGE", sensor.first, sensor.second) == "true"; 32 } 33 } // namespace utility 34 } // namespace phosphor 35 // vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 36