-
Notifications
You must be signed in to change notification settings - Fork 802
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
Update "print" function arguments #738
Conversation
b43f7c6d7 Merge pull request #80 from borglab/feature/multiple_interface_files 7b9d080f5 Revert "unit test for printing with keyformatter" 45e203195 Revert "funcitonal print passes unit test" 8b5d66f03 Revert "include functional and iostream" 34bfbec21 Revert "delete debug statement" dbe661c93 Revert "add includes to the example tpl file." f47e23f1a Revert "Revert "function to concatenate multiple header files together"" e667e2095 Revert "function to concatenate multiple header files together" 600c77bf4 add includes to the example tpl file. d5caca20e delete debug statement 4a554edb8 include functional and iostream e8ad2c26f funcitonal print passes unit test 077d5c4e7 unit test for printing with keyformatter d5a1e6dff function to concatenate multiple header files together git-subtree-dir: wrap git-subtree-split: b43f7c6d7d6cb50ebe585d7e38390e2bfeb51dde
Ping me for a re-review when you and @varunagrawal agree on a solution |
gtsam/gtsam.i
Outdated
@@ -1236,7 +1239,8 @@ class SymbolicBayesNet { | |||
SymbolicBayesNet(); | |||
SymbolicBayesNet(const gtsam::SymbolicBayesNet& other); | |||
// Testable | |||
void print(string s="") const; | |||
void print(string s = "BayesNet", |
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.
Should this be SymbolicBayesNet?
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.
Looks fine to me, but we we should make the default s
values consistent with the C++ defaults or update them to the subclass value.
gtsam/gtsam.i
Outdated
@@ -1582,7 +1590,8 @@ class VectorValues { | |||
#include <gtsam/linear/GaussianFactor.h> | |||
virtual class GaussianFactor { | |||
gtsam::KeyVector keys() const; | |||
void print(string s="") const; | |||
void print(string s = "Factor", |
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.
Keep it empty like in the header file?
gtsam/gtsam.i
Outdated
@@ -1610,7 +1619,8 @@ virtual class JacobianFactor : gtsam::GaussianFactor { | |||
JacobianFactor(const gtsam::GaussianFactorGraph& graph); | |||
|
|||
//Testable | |||
void print(string s="") const; | |||
void print(string s = "Factor", |
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.
Keep it empty like in the header file?
gtsam/gtsam.i
Outdated
@@ -1659,7 +1669,8 @@ virtual class HessianFactor : gtsam::GaussianFactor { | |||
|
|||
//Testable | |||
size_t size() const; | |||
void print(string s="") const; | |||
void print(string s = "Factor", |
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.
Keep it empty like in the header file?
gtsam/gtsam.i
Outdated
@@ -1684,7 +1695,8 @@ class GaussianFactorGraph { | |||
GaussianFactorGraph(const gtsam::GaussianBayesTree& bayesTree); | |||
|
|||
// From FactorGraph | |||
void print(string s="") const; | |||
void print(string s = "FactorGraph", |
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.
Leave this empty or change it to GaussianFactorGraph
?
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.
Should be same default as c++ which should not change @varunagrawal so change before merge if you did change.
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.
This is the default for the base class, so it will also print in the subclass. Should I override the print method?
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.
To clarify, the print
in FactorGraph
has "FactorGraph" as the default and since GaussianFactorGraph
inherits from FactorGraph
, it also prints "FactorGraph" as the default (which to me isn't quite right).
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.
Not this PR to fix it
I went ahead and updated this PR since I want to land it at the earliest. |
Okay I am merging this and will create a new PR for overriding the |
After borglab/wrap#86 gets merged, it will allow optional arguments for the gtsam wrapper interface file. This updates the
gtsam.i
definitions to take advantage of these for the print statements.This actually basically accomplishes the same thing as overloading... except that it also supports kwargs which can be handy. e.g.
Admittedly, the value add is not super large but imho it can still simplify the wrapping a little bit.