MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / makeConstTemplateData

Method makeConstTemplateData

erpcgen/src/PythonGenerator.cpp:309–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309void PythonGenerator::makeConstTemplateData()
310{
311 Log::info("Constant globals:\n");
312 data_list consts;
313 for (auto it : m_globals->getSymbolsOfType(Symbol::symbol_type_t::kConstSymbol))
314 {
315 ConstType *constVar = dynamic_cast<ConstType *>(it);
316 assert(constVar);
317 data_map constInfo;
318 if (!findAnnotation(constVar, EXTERNAL_ANNOTATION))
319 {
320 constInfo["name"] = getOutputName(constVar);
321
322 // throw nullptr exception
323 if (NULL == constVar->getValue())
324 {
325 Log::info("const pointing to null Value object\n");
326 }
327 if (kStringValue == constVar->getValue()->getType())
328 {
329 constInfo["value"] = "\"" + constVar->getValue()->toString() + "\"";
330 }
331 else
332 {
333 constInfo["value"] = constVar->getValue()->toString();
334 }
335 setTemplateComments(constVar, constInfo);
336 Log::info("Name=%s\tType=%s\tValue=%s\n", constVar->getName().c_str(),
337 constVar->getDataType()->getName().c_str(), constVar->getValue()->toString().c_str());
338 consts.push_back(constInfo);
339 }
340 }
341 m_templateData["consts"] = consts;
342}
343
344void PythonGenerator::makeEnumsTemplateData()
345{

Callers

nothing calls this directly

Calls 7

getSymbolsOfTypeMethod · 0.80
getTypeMethod · 0.80
push_backMethod · 0.80
getValueMethod · 0.45
toStringMethod · 0.45
getNameMethod · 0.45
getDataTypeMethod · 0.45

Tested by

no test coverage detected