58 template < GUM_Numeric GUM_SCALAR >
66 template < GUM_Numeric GUM_SCALAR >
74 template < GUM_Numeric GUM_SCALAR >
83 template < GUM_Numeric GUM_SCALAR >
88 template < GUM_Numeric GUM_SCALAR >
91 if (
this == &src) {
return *
this; }
103 template < GUM_Numeric GUM_SCALAR >
106 if (
this == &src) {
return *
this; }
107 _prm_ = std::move(src._prm_);
118 template < GUM_Numeric GUM_SCALAR >
121 if (name.
label().empty()) {
return true; }
144 if (t->name().label() == name.
label()) {
150 for (
auto& i:
_o3_prm_->interfaces()) {
151 if (i->name().label() == name.
label()) {
157 for (
auto& c:
_o3_prm_->classes()) {
158 if (c->name().label() == name.
label()) {
164 auto lookup =
"." + name.
label();
166 auto matches = std::vector< std::string >();
169 for (
auto t:
_prm_->types()) {
171 if (!found.exists(t->name())) {
172 found.insert(t->name());
173 matches.push_back(t->name());
179 if (
endsWith(t->name().label(), lookup)) {
180 if (!found.exists(t->name().label())) {
181 found.insert(t->name().label());
182 matches.push_back(t->name().label());
188 for (
auto i:
_prm_->interfaces()) {
190 if (!found.exists(i->name())) {
191 found.insert(i->name());
192 matches.push_back(i->name());
197 for (
auto& i:
_o3_prm_->interfaces()) {
198 if (
endsWith(i->name().label(), lookup)) {
199 if (!found.exists(i->name().label())) {
200 found.insert(i->name().label());
201 matches.push_back(i->name().label());
207 for (
auto c:
_prm_->classes()) {
209 if (!found.exists(c->name())) {
210 found.insert(c->name());
211 matches.push_back(c->name());
216 for (
auto& c:
_o3_prm_->classes()) {
217 if (
endsWith(c->name().label(), lookup)) {
218 if (!found.exists(c->name().label())) {
219 found.insert(c->name().label());
220 matches.push_back(c->name().label());
225 if (matches.size() == 1) {
227 name.
label() = matches.back();
230 }
else if (matches.size() == 0) {
233 O3PRM_TYPE_NOT_FOUND(name, *
_errors_);
239 O3PRM_TYPE_AMBIGUOUS(name, matches, *
_errors_);
244 template < GUM_Numeric GUM_SCALAR >
247 if (name.
label().empty()) {
return true; }
263 if (t->name().label() == name.
label()) {
271 auto lookup =
"." + name.
label();
273 auto matches = std::vector< std::string >();
276 for (
auto t:
_prm_->types()) {
278 if (!found.exists(t->name())) {
279 found.insert(t->name());
280 matches.push_back(t->name());
287 if (
endsWith(t->name().label(), lookup)) {
288 if (!found.exists(t->name().label())) {
289 found.insert(t->name().label());
290 matches.push_back(t->name().label());
295 if (matches.size() == 1) {
297 name.
label() = matches.back();
300 }
else if (matches.size() == 0) {
303 O3PRM_TYPE_NOT_FOUND(name, *
_errors_);
309 O3PRM_TYPE_AMBIGUOUS(name, matches, *
_errors_);
314 template < GUM_Numeric GUM_SCALAR >
317 if (name.
label().empty()) {
return true; }
331 for (
auto& i:
_o3_prm_->interfaces()) {
332 if (i->name().label() == name.
label()) {
340 auto lookup =
"." + name.
label();
342 auto matches = std::vector< std::string >();
345 for (
auto i:
_prm_->interfaces()) {
347 if (!found.exists(i->name())) {
348 found.insert(i->name());
349 matches.push_back(i->name());
355 for (
auto& i:
_o3_prm_->interfaces()) {
356 if (
endsWith(i->name().label(), lookup)) {
357 if (!found.exists(i->name().label())) {
358 found.insert(i->name().label());
359 matches.push_back(i->name().label());
364 if (matches.size() == 1) {
367 name.
label() = matches.back();
370 }
else if (matches.size() == 0) {
373 O3PRM_INTERFACE_NOT_FOUND(name, *
_errors_);
379 O3PRM_INTERFACE_AMBIGUOUS(name, matches, *
_errors_);
384 template < GUM_Numeric GUM_SCALAR >
387 if (name.
label().empty()) {
return true; }
401 for (
auto& c:
_o3_prm_->classes()) {
402 if (c->name().label() == name.
label()) {
410 auto lookup =
"." + name.
label();
411 auto matches = std::vector< std::string >();
415 for (
auto c:
_prm_->classes()) {
417 if (!found.exists(c->name())) {
418 found.insert(c->name());
419 matches.push_back(c->name());
425 for (
auto& c:
_o3_prm_->classes()) {
426 if (
endsWith(c->name().label(), lookup)) {
427 if (!found.exists(c->name().label())) {
428 found.insert(c->name().label());
429 matches.push_back(c->name().label());
434 if (matches.size() == 1) {
437 name.
label() = matches.back();
440 }
else if (matches.size() == 0) {
443 O3PRM_CLASS_NOT_FOUND(name, *
_errors_);
449 O3PRM_CLASS_AMBIGUOUS(name, matches, *
_errors_);
454 template < GUM_Numeric GUM_SCALAR >
457 if (name.
label().empty()) {
return true; }
470 for (
auto& i:
_o3_prm_->interfaces()) {
471 if (i->name().label() == name.
label()) {
478 for (
auto& c:
_o3_prm_->classes()) {
479 if (c->name().label() == name.
label()) {
487 auto lookup =
"." + name.
label();
489 auto matches = std::vector< std::string >();
492 for (
auto i:
_prm_->interfaces()) {
494 if (!found.exists(i->name())) {
495 found.insert(i->name());
496 matches.push_back(i->name());
502 for (
auto& i:
_o3_prm_->interfaces()) {
503 if (
endsWith(i->name().label(), lookup)) {
504 if (!found.exists(i->name().label())) {
505 found.insert(i->name().label());
506 matches.push_back(i->name().label());
512 for (
auto c:
_prm_->classes()) {
514 if (!found.exists(c->name())) {
515 found.insert(c->name());
516 matches.push_back(c->name());
522 for (
auto& c:
_o3_prm_->classes()) {
523 if (
endsWith(c->name().label(), lookup)) {
524 if (!found.exists(c->name().label())) {
525 found.insert(c->name().label());
526 matches.push_back(c->name().label());
531 if (matches.size() == 1) {
534 name.
label() = matches.back();
537 }
else if (matches.size() == 0) {
540 O3PRM_REFERENCE_NOT_FOUND(name, *
_errors_);
546 O3PRM_REFERENCE_AMBIGUOUS(name, matches, *
_errors_);
Headers for the O3NameSolver class.
This class is used contain and manipulate gum::ParseError.
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
The O3Label is part of the AST of the O3PRM language.
Resolves names for the different O3PRM factories.
ErrorsContainer * _errors_
O3NameSolver< GUM_SCALAR > & operator=(const O3NameSolver< GUM_SCALAR > &src)
O3NameSolver(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, ErrorsContainer &errors)
PRM< GUM_SCALAR > * _prm_
bool resolveClassElement(O3Label &name)
bool resolveClass(O3Label &name)
bool resolveSlotType(O3Label &name)
bool resolveType(O3Label &name)
bool resolveInterface(O3Label &name)
The O3PRM is part of the AST of the O3PRM language.
bool endsWith(const std::string_view &value, const std::string_view &ending)
Returns true if value ends with ending.
namespace for all probabilistic relational models entities
gum is the global namespace for all aGrUM entities