std string plugName getPlugNameFromType agentConfigurationMe ssage- Ty

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
//std::string plugName = getPlugNameFromType(agentConfigurationMessage->Type());
Logger::gLogger().writeLog(MessageType::General, "Got plugin type %d",(int)agentConfigurationMessage->Type());
std::shared_ptr<PluginConfiguration> &pconf = lconf[std::to_string((int)agentConfigurationMessage->Type())]; // sic, reference to pointer
if (!pconf) // new entry
pconf = std::make_shared<PluginConfiguration>(); // fills the map entry, not just a local variable
while (propEnumerator->MoveNext()) {
uint64_t propId = (uint64_t) (propEnumerator->Current()->getId());
auto propValuesPtr = propEnumerator->Current()->getValue();
std::for_each(propValuesPtr.begin(), propValuesPtr.end(),
[&propId,&pconf](Contract::PropVal &val) {
try {
Logger::gLogger().writeLog(MessageType::General, "Got property %d = %s",(unsigned long long) propId, val.get<std::string>().c_str());
pconf->addSingle(std::to_string(propId), val.get<std::string>().c_str());
}
catch (const std::exception &) {
Logger::gLogger().writeLog(MessageType::General, "Can't Get value for property id %d",(unsigned long long) propId);
}
}
);
}