xref: /openbmc/phosphor-pid-control/sensors/manager.cpp (revision 46a755fce8dc0bdd9c0c5ea09d55d3e5494f335f)
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: Copyright 2017 Google Inc
3 
4 /* Configuration. */
5 #include "sensors/manager.hpp"
6 
7 #include "sensor.hpp"
8 
9 #include <memory>
10 #include <string>
11 #include <utility>
12 
13 namespace pid_control
14 {
15 
addSensor(const std::string & type,const std::string & name,std::unique_ptr<Sensor> sensor)16 void SensorManager::addSensor(const std::string& type, const std::string& name,
17                               std::unique_ptr<Sensor> sensor)
18 {
19     _sensorMap[name] = std::move(sensor);
20 
21     auto entry = _sensorTypeList.find(type);
22     if (entry == _sensorTypeList.end())
23     {
24         _sensorTypeList[type] = {};
25     }
26 
27     _sensorTypeList[type].push_back(name);
28 }
29 
30 } // namespace pid_control
31