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

Method setInterfaceId

erpcgen/src/UniqueIdChecker.cpp:87–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87void UniqueIdChecker::setInterfaceId(Interface *iface, Annotation *interfaceId)
88{
89 if (!interfaceId->hasValue() || interfaceId->getValueObject()->getType() != kIntegerValue)
90 {
91 throw semantic_error(format_string("@id() for interface %s() has no valid value\n", iface->getName().c_str()));
92 }
93 else
94 {
95 assert(nullptr != dynamic_cast<IntegerValue *>(interfaceId->getValueObject()));
96 uint32_t newIdValue = (uint32_t) dynamic_cast<IntegerValue *>(interfaceId->getValueObject())->getValue();
97 if (newIdValue == 0 && 0 != iface->getName().compare("Common"))
98 {
99 throw semantic_error(
100 format_string("@id value for interface %s must be greater than zero", iface->getName().c_str()));
101 }
102 iface->setUniqueId(newIdValue);
103 for (unsigned int i = 0; i < m_usedInterfaceIds.size(); ++i)
104 {
105 if (0 == m_usedInterfaceIds[i].second.compare(iface->getName()))
106 {
107 m_usedInterfaceIds.erase(m_usedInterfaceIds.begin() + i);
108 break;
109 }
110 }
111 m_usedInterfaceIds.push_back(make_pair(newIdValue, iface->getName()));
112 }
113}
114
115void UniqueIdChecker::setFunctionId(Function *fn, Annotation *idAnnotation)
116{

Callers

nothing calls this directly

Calls 11

semantic_errorClass · 0.85
format_stringFunction · 0.85
getTypeMethod · 0.80
getValueObjectMethod · 0.80
push_backMethod · 0.80
hasValueMethod · 0.45
getNameMethod · 0.45
getValueMethod · 0.45
setUniqueIdMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected