37 template <
typename GUM_SCALAR >
42 __o3_prm(&o3_prm), __errors(&errors) {
46 template <
typename GUM_SCALAR >
57 template <
typename GUM_SCALAR >
69 template <
typename GUM_SCALAR >
74 template <
typename GUM_SCALAR >
77 if (
this == &src) {
return *
this; }
89 template <
typename GUM_SCALAR >
92 if (
this == &src) {
return *
this; }
93 __prm = std::move(src.__prm);
104 template <
typename GUM_SCALAR >
107 if (name.
label() ==
"") {
return true; }
130 if (t->name().label() == name.
label()) {
137 if (i->name().label() == name.
label()) {
144 if (c->name().label() == name.
label()) {
150 auto lookup =
"." + name.
label();
152 auto matches = std::vector< std::string >();
155 for (
auto t :
__prm->types()) {
157 if (!found.exists(t->name())) {
159 matches.push_back(t->name());
165 if (
endsWith(t->name().label(), lookup)) {
166 if (!found.exists(t->name().label())) {
167 found.
insert(t->name().label());
168 matches.push_back(t->name().label());
174 for (
auto i :
__prm->interfaces()) {
176 if (!found.exists(i->name())) {
178 matches.push_back(i->name());
184 if (
endsWith(i->name().label(), lookup)) {
185 if (!found.exists(i->name().label())) {
186 found.
insert(i->name().label());
187 matches.push_back(i->name().label());
193 for (
auto c :
__prm->classes()) {
195 if (!found.exists(c->name())) {
197 matches.push_back(c->name());
203 if (
endsWith(c->name().label(), lookup)) {
204 if (!found.exists(c->name().label())) {
205 found.
insert(c->name().label());
206 matches.push_back(c->name().label());
211 if (matches.
size() == 1) {
213 name.
label() = matches.back();
216 }
else if (matches.
size() == 0) {
219 O3PRM_TYPE_NOT_FOUND(name, *
__errors);
225 O3PRM_TYPE_AMBIGUOUS(name, matches, *
__errors);
230 template <
typename GUM_SCALAR >
233 if (name.
label() ==
"") {
return true; }
249 if (t->name().label() == name.
label()) {
257 auto lookup =
"." + name.
label();
259 auto matches = std::vector< std::string >();
262 for (
auto t :
__prm->types()) {
264 if (!found.exists(t->name())) {
266 matches.push_back(t->name());
273 if (
endsWith(t->name().label(), lookup)) {
274 if (!found.exists(t->name().label())) {
275 found.
insert(t->name().label());
276 matches.push_back(t->name().label());
281 if (matches.
size() == 1) {
283 name.
label() = matches.back();
286 }
else if (matches.
size() == 0) {
289 O3PRM_TYPE_NOT_FOUND(name, *
__errors);
295 O3PRM_TYPE_AMBIGUOUS(name, matches, *
__errors);
300 template <
typename GUM_SCALAR >
303 if (name.
label() ==
"") {
return true; }
318 if (i->name().label() == name.
label()) {
326 auto lookup =
"." + name.
label();
328 auto matches = std::vector< std::string >();
331 for (
auto i :
__prm->interfaces()) {
333 if (!found.exists(i->name())) {
335 matches.push_back(i->name());
342 if (
endsWith(i->name().label(), lookup)) {
343 if (!found.exists(i->name().label())) {
344 found.
insert(i->name().label());
345 matches.push_back(i->name().label());
350 if (matches.
size() == 1) {
353 name.
label() = matches.back();
356 }
else if (matches.
size() == 0) {
359 O3PRM_INTERFACE_NOT_FOUND(name, *
__errors);
365 O3PRM_INTERFACE_AMBIGUOUS(name, matches, *
__errors);
370 template <
typename GUM_SCALAR >
373 if (name.
label() ==
"") {
return true; }
388 if (c->name().label() == name.
label()) {
396 auto lookup =
"." + name.
label();
397 auto matches = std::vector< std::string >();
401 for (
auto c :
__prm->classes()) {
403 if (!found.exists(c->name())) {
404 found.insert(c->name());
405 matches.push_back(c->name());
412 if (
endsWith(c->name().label(), lookup)) {
413 if (!found.exists(c->name().label())) {
414 found.insert(c->name().label());
415 matches.push_back(c->name().label());
420 if (matches.size() == 1) {
423 name.
label() = matches.back();
426 }
else if (matches.size() == 0) {
429 O3PRM_CLASS_NOT_FOUND(name, *
__errors);
435 O3PRM_CLASS_AMBIGUOUS(name, matches, *
__errors);
440 template <
typename GUM_SCALAR >
443 if (name.
label() ==
"") {
return true; }
457 if (i->name().label() == name.
label()) {
465 if (c->name().label() == name.
label()) {
473 auto lookup =
"." + name.
label();
475 auto matches = std::vector< std::string >();
478 for (
auto i :
__prm->interfaces()) {
480 if (!found.exists(i->name())) {
482 matches.push_back(i->name());
489 if (
endsWith(i->name().label(), lookup)) {
490 if (!found.exists(i->name().label())) {
491 found.
insert(i->name().label());
492 matches.push_back(i->name().label());
498 for (
auto c :
__prm->classes()) {
500 if (!found.exists(c->name())) {
502 matches.push_back(c->name());
509 if (
endsWith(c->name().label(), lookup)) {
510 if (!found.exists(c->name().label())) {
511 found.
insert(c->name().label());
512 matches.push_back(c->name().label());
517 if (matches.
size() == 1) {
520 name.
label() = matches.back();
523 }
else if (matches.
size() == 0) {
526 O3PRM_REFERENCE_NOT_FOUND(name, *
__errors);
532 O3PRM_REFERENCE_AMBIGUOUS(name, matches, *
__errors);
bool exists(const Key &key) const
Checks whether there exists an element with a given key in the hashtable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
This class is used contain and manipulate gum::ParseError.
The O3Label is part of the AST of the O3PRM language.
bool resolveType(O3Label &name)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool endsWith(std::string const &value, std::string const &ending)
Returns true if value ends with ending.
O3NameSolver< GUM_SCALAR > & operator=(const O3NameSolver< GUM_SCALAR > &src)
Resolves names for the different O3PRM factories.
bool resolveClassElement(O3Label &name)
bool resolveSlotType(O3Label &name)
O3InterfaceList & interfaces()
O3NameSolver(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, ErrorsContainer &errors)
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
ErrorsContainer * __errors
bool resolveInterface(O3Label &name)
The O3PRM is part of the AST of the O3PRM language.
Size size() const noexcept
Returns the number of elements in the set.
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
void insert(const Key &k)
Inserts a new element into the set.
bool resolveClass(O3Label &name)
PRM< GUM_SCALAR > * __prm