blob: d91b1b59bd88997d9f1cbdc6bac8809b10323421 [file] [log] [blame]
Brad Bishopab795a12017-01-05 20:50:49 -05001#pragma once
2
Carol Wang9bbe6022019-08-01 17:31:30 +08003#include "sensorset.hpp"
4
Brad Bishopab795a12017-01-05 20:50:49 -05005#include <cstdlib>
6
7namespace phosphor
8{
9namespace utility
10{
11/** @struct Free
12 * @brief A malloc cleanup type for use with smart pointers.
13 */
14template <typename T>
15struct Free
16{
17 void operator()(T* ptr) const
18 {
19 free(ptr);
20 }
21};
Carol Wang9bbe6022019-08-01 17:31:30 +080022
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 */
29inline bool isAverageEnvSet(const SensorSet::key_type& sensor)
30{
31 return env::getEnv("AVERAGE", sensor.first, sensor.second) == "true";
32}
Brad Bishopab795a12017-01-05 20:50:49 -050033} // namespace utility
34} // namespace phosphor
35// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4