Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on PropertyMap exposeTo #584

Open
captain-yoshi opened this issue Jun 11, 2024 · 1 comment
Open

Clarification on PropertyMap exposeTo #584

captain-yoshi opened this issue Jun 11, 2024 · 1 comment

Comments

@captain-yoshi
Copy link
Contributor

When exposing properties to another stage and if that stage property has already been declared, then the property value is not beeing exposed. Is this the intended behavior ?

Stage2 has already a property called timeout

StagePtr stage1 = std::make_shared<stages::CurrentState>();
StagePtr stage2 = std::make_shared<stages::CurrentState>();

std::cout << stage1->properties().get<double>("timeout") << std::endl;
// timeout = 3
  
stage1->properties().set("timeout", 0.5);
std::cout << stage1->properties().get<double>("timeout") << std::endl;
// timeout = 0.5

stage1->properties().exposeTo(stage2->properties(), { "timeout" });
std::cout << stage2->properties().get<double>("timeout") << std::endl;
// timeout = 3         I would have expected this to be 0.5 ...

With an undeclared property

StagePtr stage1 = std::make_shared<stages::CurrentState>();
StagePtr stage2 = std::make_shared<stages::CurrentState>();

stage1->properties().set("controller_id", 3.0);
std::cout << stage1->properties().get<double>("controller_id") << std::endl;
// controller_id = 3

stage1->properties().set("controller_id", 0.5);
std::cout << stage1->properties().get<double>("controller_id") << std::endl;
// controller_id = 0.5

stage1->properties().exposeTo(stage2->properties(), { "controller_id" });
std::cout << stage2->properties().get<double>("controller_id") << std::endl;
// controller_id = 0.5
@rhaschke
Copy link
Contributor

The function doc states:

declare given property name as other_name in other PropertyMap

Thus, the property is just declared if it doesn't yet exist. Redeclaring a property doesn't modify any of its values.
Looks like, I should improve the docs on property handling...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants