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

Method getCallbacksTemplateData

erpcgen/src/Generator.cpp:678–761  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676}
677
678void Generator::getCallbacksTemplateData(Group *group, const Interface *iface, data_list &callbackTypesInt,
679 data_list &callbackTypesExt, data_list &callbackTypesAll)
680{
681 list<FunctionType *> callbackTypes;
682 list<string> interfacesNames;
683 list<string> callbackTypesNames;
684 interfacesNames.push_back(iface->getName());
685 for (auto function : iface->getFunctions())
686 {
687 for (auto param : function->getParameters().getMembers())
688 {
689 DataType *datatype = param->getDataType()->getTrueDataType();
690 if (datatype->isFunction())
691 {
692 FunctionType *funType = dynamic_cast<FunctionType *>(datatype);
693 if (funType->getInterface() != iface)
694 {
695 interfacesNames.push_back(funType->getInterface()->getName());
696 }
697 if ((std::find(callbackTypesNames.begin(), callbackTypesNames.end(), funType->getName()) ==
698 callbackTypesNames.end()))
699 {
700 callbackTypes.push_back(funType);
701 callbackTypesNames.push_back(funType->getName());
702 }
703 }
704 }
705 }
706 for (auto functionType : iface->getFunctionTypes())
707 {
708 if ((std::find(callbackTypesNames.begin(), callbackTypesNames.end(), functionType->getName()) ==
709 callbackTypesNames.end()))
710 {
711 callbackTypes.push_back(functionType);
712 callbackTypesNames.push_back(functionType->getName());
713 }
714 }
715
716 for (auto functionType : callbackTypes)
717 {
718 data_list functionsInt;
719 data_list functionsExt;
720 data_list functionsAll;
721 for (auto fun : functionType->getCallbackFuns())
722 {
723 if ((std::find(interfacesNames.begin(), interfacesNames.end(), fun->getInterface()->getName()) !=
724 interfacesNames.end()))
725 {
726 data_map function;
727 function["name"] = fun->getName();
728 if (fun->getInterface() == iface)
729 {
730 functionsInt.push_back(function);
731 }
732 else
733 {
734 functionsExt.push_back(function);
735 }

Callers

nothing calls this directly

Calls 9

push_backMethod · 0.80
getTrueDataTypeMethod · 0.80
isFunctionMethod · 0.80
getNameMethod · 0.45
getDataTypeMethod · 0.45
getInterfaceMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected