MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / addAgent

Method addAgent

native/model/Model.cpp:53–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers 2

getOperateOptMethod · 0.95

Calls 3

createFunction · 0.85
emptyMethod · 0.80
addListenerMethod · 0.80

Tested by

no test coverage detected