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
[RST-2427] Added a 'source' field to the constraints #101
Conversation
…ange and hence touches a lot of files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but it seems to me that you're missing direct initialization (https://en.cppreference.com/w/cpp/language/direct_initialization) with list initialization (https://en.cppreference.com/w/cpp/language/list_initialization), or maybe aggregate initialization (https://en.cppreference.com/w/cpp/language/aggregate_initialization) 🤔
const Variable& variable, | ||
const fuse_core::VectorXd& mean, | ||
const fuse_core::MatrixXd& covariance) : | ||
fuse_core::Constraint{variable.uuid()}, | ||
fuse_core::Constraint(source, {variable.uuid()}), // NOLINT(whitespace/braces) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should also work: fuse_core::Constraint{source, variable.uuid()},
(same in other instances below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That particular incantation results in:
error: no matching function for call to ‘std::vector<boost::uuids::uuid>::vector(boost::uuids::uuid&)’
This does work, but I'm not sure it has any advantages over the constructor ()
version:
fuse_core::Constraint{source, {variable.uuid()}}
I could do something with variadic templates:
https://stackoverflow.com/questions/25721869/initializer-list-combined-with-other-parameters
public:
template <class ...Args>
Constraint(const std::string& source, Args... args) : Constraint(source, {args...}) {}
private:
Constraint(const std::string& source, std::initializer_list<UUID> variable_uuid_list) :
source_(source),
variables_(variable_uuid_list)
{}
but I'm not sure it is worth the trouble.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. I don't think it's worth the trouble, and I didn't realized there's an std::initializer_list
for the UUIDs.
const Variable& variable1, | ||
const Variable& variable2, | ||
const fuse_core::VectorXd& delta, | ||
const fuse_core::MatrixXd& covariance) : | ||
fuse_core::Constraint{variable1.uuid(), variable2.uuid()}, | ||
fuse_core::Constraint(source, {variable1.uuid(), variable2.uuid()}), // NOLINT(whitespace/braces) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned before, I think this should work: fuse_core::Constraint{source, variable1.uuid(), variable2.uuid()},
(same below)
const fuse_variables::Orientation3DStamped& orientation, | ||
const fuse_core::Vector4d& mean, | ||
const fuse_core::Matrix3d& covariance) : | ||
fuse_core::Constraint{orientation.uuid()}, | ||
fuse_core::Constraint(source, {orientation.uuid()}), // NOLINT(whitespace/braces) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fuse_core::Constraint{source, orientation.uuid()},
Added a 'source' field to the constraints. This is an API-breaking change and hence touches a lot of files.