| 51 | #define DefaultDeviceID "0000001" |
| 52 | |
| 53 | AbstractAgentPtr Model::addAgent(const std::string &deviceIDString, AlgorithmType agentType, |
| 54 | DeviceType deviceType) { |
| 55 | auto agent = AgentFactory::create(agentType, shared_from_this(), deviceType); |
| 56 | const std::string &deviceID = deviceIDString.empty() ? DefaultDeviceID |
| 57 | : deviceIDString; // deviceID is device id |
| 58 | this->_deviceIDAgentMap.emplace(deviceID, |
| 59 | agent); // add the pair of device and agent to the _deviceIDAgentMap |
| 60 | this->_graph->addListener( |
| 61 | agent); // add the agent to the graph and listen to updates of this graph. |
| 62 | return agent; |
| 63 | } |
| 64 | |
| 65 | AbstractAgentPtr Model::getAgent(const std::string &deviceID) const { |
| 66 | const std::string &d = deviceID.empty() ? DefaultDeviceID : deviceID; |
no test coverage detected