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

Method makeGroupSymbolsTemplateData

erpcgen/src/CGenerator.cpp:910–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

908}
909
910data_map CGenerator::makeGroupSymbolsTemplateData(Group *group)
911{
912 data_map symbolsTemplate;
913 set<string> names;
914
915 data_list symbolsToClient;
916 data_list symbolsToServer;
917 data_list symbolsServerFree;
918
919 Log::info("Group symbols:\n");
920
921 for (Symbol *symbol : group->getSymbols())
922 {
923 data_map info;
924 const set<param_direction_t> dirs = group->getSymbolDirections(symbol);
925 if (dirs.size())
926 {
927 if (symbol->isDatatypeSymbol())
928 {
929 DataType *datatype = dynamic_cast<DataType *>(symbol);
930 assert(datatype);
931
932 if (datatype->isStruct())
933 {
934 StructType *structType = dynamic_cast<StructType *>(datatype);
935 assert(structType);
936
937 Log::info("%s\n", structType->getDescription().c_str());
938
939 string name = (structType->getName() != "") ? getOutputName(structType) : getAliasName(structType);
940
941 // check if template for this structure has not already been generated
942 if (names.find(name) == names.end())
943 {
944 // get struct declaration info
945 info = getSymbolTemplateByName(name);
946 if (info.empty())
947 {
948 continue;
949 }
950
951 // get struct definition info
952 info = getStructDefinitionTemplateData(group, structType, info);
953
954 // set symbol data to client or server according to its directions
955 setSymbolDataToSide(structType, dirs, symbolsToClient, symbolsToServer, info);
956
957 // struct needs to be freed?
958 set<DataType *> loopDetection;
959 if (structType->containStringMember() || structType->containListMember() ||
960 containsByrefParamToFree(structType, loopDetection))
961 {
962 symbolsServerFree.push_back(info);
963 }
964
965 names.insert(name);
966 }
967 }

Callers

nothing calls this directly

Calls 12

getSymbolDirectionsMethod · 0.80
isDatatypeSymbolMethod · 0.80
isStructMethod · 0.80
containStringMemberMethod · 0.80
containListMemberMethod · 0.80
push_backMethod · 0.80
isUnionMethod · 0.80
sizeMethod · 0.45
getDescriptionMethod · 0.45
getNameMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected