-
Notifications
You must be signed in to change notification settings - Fork 767
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
Override print methods #760
Conversation
varunagrawal
commented
Apr 29, 2021
- Override print methods.
- Update wrapper.
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.
Nice maintenance PR! Don't merge until you addressed comments and checked CI for warnings?
gtsam/discrete/DiscreteFactor.h
Outdated
const KeyFormatter& formatter = DefaultKeyFormatter) const { | ||
Factor::print(s, formatter); | ||
virtual void print( |
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.
no virtual if override
gtsam/linear/GaussianBayesNet.h
Outdated
@@ -177,6 +177,13 @@ namespace gtsam { | |||
*/ | |||
VectorValues backSubstituteTranspose(const VectorValues& gx) const; | |||
|
|||
/// print graph | |||
virtual void print( |
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.
no virtual. I recommend checking the warnings in a clang CI run to be sure I did not miss anything.
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.
Great idea. And yes I'll get rid of the virtuals where there are overrides.
gtsam/linear/GaussianFactor.h
Outdated
const KeyFormatter& formatter = DefaultKeyFormatter) const = 0; | ||
|
||
virtual void print( |
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.
no virtual
gtsam/nonlinear/NonlinearFactor.h
Outdated
@@ -70,8 +70,9 @@ class GTSAM_EXPORT NonlinearFactor: public Factor { | |||
/// @{ | |||
|
|||
/** print */ | |||
virtual void print(const std::string& s = "", | |||
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const; | |||
virtual void print( |
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.
no virtual
@@ -63,6 +63,13 @@ namespace gtsam { | |||
/** Check equality */ | |||
GTSAM_EXPORT bool equals(const This& bn, double tol = 1e-9) const; | |||
|
|||
GTSAM_EXPORT void print( |
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.
Why is this the only one with GTSAM_EXPORT? Should we have that everywhere?
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's a good question. My intent was to be consistent (since equals
in this case is qualified with GTSAM_EXPORT
) but it would be good to have a good hard look in a subsequent PR? I know Windows people will have all sorts of issues due to the lack of GTSAM_EXPORT.
I had to add a bunch of virtual destructors to satisfy the compiler's warnings, but all the warnings with Clang have been addressed. 🎉 |