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

Method getFunctionTemplateData

erpcgen/src/CGenerator.cpp:1656–1733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1654}
1655
1656data_map CGenerator::getFunctionTemplateData(Group *group, Function *fn)
1657{
1658 data_map info;
1659
1660 info = getFunctionBaseTemplateData(group, fn);
1661
1662 // Ignore function shim code. Will be serialized through common function.
1663 bool useCommonFunction = false;
1664 if (fn->getFunctionType())
1665 {
1666 int similarFunctions = 0;
1667 for (Interface *_interface : group->getInterfaces())
1668 {
1669 for (Function *function : _interface->getFunctions())
1670 {
1671 if (fn->getFunctionType() == function->getFunctionType())
1672 {
1673 ++similarFunctions;
1674 }
1675 }
1676 }
1677
1678 if (similarFunctions > 1)
1679 {
1680 useCommonFunction = true;
1681 }
1682 }
1683
1684 if (useCommonFunction)
1685 {
1686 std::string callbackFName = getOutputName(fn->getFunctionType());
1687 info["callbackFNameNoGroup"] = callbackFName;
1688 if (!group->getName().empty())
1689 {
1690 callbackFName += "_" + group->getName();
1691 }
1692 info["isCallback"] = true;
1693 info["callbackFName"] = callbackFName;
1694 info["serviceId"] = fn->getInterface()->getUniqueId();
1695 }
1696 else
1697 {
1698 info["isCallback"] = false;
1699 info["serverPrototype"] = getFunctionServerCall(fn);
1700 info["serviceId"] = "";
1701 }
1702 string serverProtoC = getFunctionServerCall(fn, true);
1703 info["serverPrototypeC"] = serverProtoC;
1704
1705 string proto = getFunctionPrototype(group, fn);
1706 info["prototype"] = proto;
1707 string protoCpp = getFunctionPrototype(group, fn, getOutputName(fn->getInterface()) + "_client", "", true);
1708 info["prototypeCpp"] = protoCpp;
1709 string protoInterface = getFunctionPrototype(group, fn, "", "", true);
1710 info["prototypeInterface"] = protoInterface;
1711
1712 data_list callbackParameters;
1713 for (auto parameter : fn->getParameters().getMembers())

Callers

nothing calls this directly

Calls 9

getFunctionTypeMethod · 0.80
isFunctionMethod · 0.80
push_backMethod · 0.80
emptyMethod · 0.45
getNameMethod · 0.45
getUniqueIdMethod · 0.45
getInterfaceMethod · 0.45
getDataTypeMethod · 0.45
getDirectionMethod · 0.45

Tested by

no test coverage detected