Skip to content
Snippets Groups Projects
Commit 676ebaa1 authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Fix attribute parsing findBestMatch + add log if matchingSpecs is empty.

parent 541ea019
No related branches found
No related tags found
No related merge requests found
......@@ -120,11 +120,10 @@ Aidge::ImplSpec Aidge::OperatorImpl::getBestMatch(const ImplSpec& requiredSpecs)
std::string qualifier;
const auto qualifierPos = std::find_if(attrName.begin(), attrName.end(),
[](char c) { return c == ':'; });
if (qualifierPos != attrName.begin()) {
name = attrName.substr(0, qualifierPos - attrName.begin());
qualifier = attrName.substr(qualifierPos - attrName.begin());
if (qualifierPos != attrName.end()) {
name = attrName.substr(0, (qualifierPos - attrName.begin()));
qualifier = attrName.substr((qualifierPos - attrName.begin())+1);
}
const bool mandatory = (qualifier == "!");
if (mandatory) {
// Required attribute:
......@@ -161,6 +160,10 @@ Aidge::ImplSpec Aidge::OperatorImpl::getBestMatch(const ImplSpec& requiredSpecs)
Log::debug(" {}:{} - {}", (match) ? "MATCH" : "MISMATCH", priority, spec);
}
if(matchingSpecs.empty()){
Log::debug(" No spec to match registered, returning requiredSpecs.");
return requiredSpecs;
}
// Return best match
const auto bestMatch = std::max_element(matchingSpecs.begin(), matchingSpecs.end());
if (*bestMatch >= 0) {
......@@ -367,6 +370,6 @@ std::shared_ptr<Aidge::ProdConso> Aidge::OperatorImpl::getProdConso() const {
return std::make_shared<ProdConso>(mOp);
}
std::set<Aidge::ImplSpec> Aidge::OperatorImpl::getAvailableImplSpecs() const {
return std::set<ImplSpec>();
std::vector<Aidge::ImplSpec> Aidge::OperatorImpl::getAvailableImplSpecs() const {
return std::vector<ImplSpec>();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment