diff --git a/gtsam.h b/gtsam.h index 879248f33..c5e5b6baf 100644 --- a/gtsam.h +++ b/gtsam.h @@ -898,6 +898,24 @@ class VariableIndex { void permuteInPlace(const gtsam::Permutation& permutation); }; +#include +template +virtual class BayesTree { + + //Constructors + BayesTree(); + + //Standard Interface + //bool equals(const gtsam::BayesTree& other, double tol) const; + void print(string s); + size_t size(); + CLIQUE* root() const; + void clear(); + void insert(const CLIQUE* subtree); +}; + +typedef gtsam::BayesTree ISAM2BayesTree; + //************************************************************************* // linear //************************************************************************* @@ -1672,6 +1690,20 @@ class ISAM2Params { void setEnablePartialRelinearizationCheck(bool enablePartialRelinearizationCheck); }; +virtual class ISAM2Clique { + + //Constructors + ISAM2Clique(const gtsam::GaussianConditional* conditional); + + //Standard Interface + Vector gradientContribution() const; + gtsam::ISAM2Clique* clone() const; + void print(string s); + + void permuteWithInverse(const gtsam::Permutation& inversePermutation); + bool permuteSeparatorWithInverse(const gtsam::Permutation& inversePermutation); +}; + class ISAM2Result { ISAM2Result(); @@ -1683,7 +1715,7 @@ class ISAM2Result { size_t getCliques() const; }; -class ISAM2 { +virtual class ISAM2 : gtsam::ISAM2BayesTree { ISAM2(); ISAM2(const gtsam::ISAM2Params& params); diff --git a/gtsam/inference/BayesTree-inl.h b/gtsam/inference/BayesTree-inl.h index 72a503b6a..3d5276be8 100644 --- a/gtsam/inference/BayesTree-inl.h +++ b/gtsam/inference/BayesTree-inl.h @@ -338,7 +338,7 @@ namespace gtsam { template void BayesTree::print(const std::string& s, const IndexFormatter& indexFormatter) const { if (root_.use_count() == 0) { - printf("WARNING: BayesTree.print encountered a forest...\n"); + std::cout << "WARNING: BayesTree.print encountered a forest..." << std::endl; return; } std::cout << s << ": clique size == " << size() << ", node size == " << nodes_.size() << std::endl; diff --git a/wrap/Module.cpp b/wrap/Module.cpp index 46b31f3e6..aad533a9a 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -342,6 +342,15 @@ Module::Module(const string& interfacePath, printf("parsing stopped at \n%.20s\n",info.stop); throw ParseFailed((int)info.length); } + + //Explicitly add methods to the classes from parents so it shows in documentation + BOOST_FOREACH(Class& cls, classes) + { + map inhereted = appendInheretedMethods(cls, classes); + cls.methods.insert(inhereted.begin(), inhereted.end()); + } + + } /* ************************************************************************* */ @@ -432,6 +441,7 @@ void Module::matlab_code(const string& toolboxPath, const string& headerPath) co // verify parents if(!cls.qualifiedParent.empty() && std::find(validTypes.begin(), validTypes.end(), wrap::qualifiedName("::", cls.qualifiedParent)) == validTypes.end()) throw DependencyMissing(wrap::qualifiedName("::", cls.qualifiedParent), cls.qualifiedName("::")); + } // Create type attributes table and check validity @@ -472,6 +482,33 @@ void Module::matlab_code(const string& toolboxPath, const string& headerPath) co wrapperFile.emit(true); } +/* ************************************************************************* */ +map Module::appendInheretedMethods(const Class& cls, const vector& classes) +{ + map methods; + if(!cls.qualifiedParent.empty()) + { + cout << "Class: " << cls.name << " Parent Name: " << cls.qualifiedParent.back() << endl; + //Find Class + BOOST_FOREACH(const Class& parent, classes) + { + //We found the class for our parent + if(parent.name == cls.qualifiedParent.back()) + { + cout << "Inner class: " << cls.qualifiedParent.back() << endl; + Methods inhereted = appendInheretedMethods(parent, classes); + methods.insert(inhereted.begin(), inhereted.end()); + } + } + } + else + { + cout << "Dead end: " << cls.name << endl; + methods.insert(cls.methods.begin(), cls.methods.end()); + } + + return methods; +} /* ************************************************************************* */ void Module::finish_wrapper(FileWriter& file, const std::vector& functionNames) const { diff --git a/wrap/Module.h b/wrap/Module.h index ca8b0bb1a..a1dfe88d8 100644 --- a/wrap/Module.h +++ b/wrap/Module.h @@ -35,6 +35,7 @@ namespace wrap { struct Module { typedef std::map GlobalFunctions; + typedef std::map Methods; std::string name; ///< module name std::vector classes; ///< list of classes @@ -49,6 +50,9 @@ struct Module { const std::string& moduleName, bool enable_verbose=true); + //Recursive method to append all methods inhereted from parent classes + std::map appendInheretedMethods(const Class& cls, const std::vector& classes); + /// MATLAB code generation: void matlab_code( const std::string& path, diff --git a/wrap/tests/expected/Point2.m b/wrap/tests/expected/Point2.m index d1c336c5f..22dec9641 100644 --- a/wrap/tests/expected/Point2.m +++ b/wrap/tests/expected/Point2.m @@ -1,7 +1,10 @@ +%class Point2, see Doxygen page for details +%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html +% %-------Constructors------- %Point2() %Point2(double x, double y) -% +% %-------Methods------- %argChar(char a) : returns void %argUChar(unsigned char a) : returns void @@ -10,10 +13,7 @@ %vectorConfusion() : returns VectorNotEigen %x() : returns double %y() : returns double -% -%-------Static Methods------- % -%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html classdef Point2 < handle properties ptr_Point2 = 0 diff --git a/wrap/tests/expected/Point3.m b/wrap/tests/expected/Point3.m index f73b740ac..3a90f1982 100644 --- a/wrap/tests/expected/Point3.m +++ b/wrap/tests/expected/Point3.m @@ -1,14 +1,16 @@ +%class Point3, see Doxygen page for details +%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html +% %-------Constructors------- %Point3(double x, double y, double z) -% +% %-------Methods------- %norm() : returns double -% +% %-------Static Methods------- %StaticFunctionRet(double z) : returns Point3 %staticFunction() : returns double % -%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html classdef Point3 < handle properties ptr_Point3 = 0 diff --git a/wrap/tests/expected/Test.m b/wrap/tests/expected/Test.m index 1e07974ee..e493b9a04 100644 --- a/wrap/tests/expected/Test.m +++ b/wrap/tests/expected/Test.m @@ -1,7 +1,10 @@ +%class Test, see Doxygen page for details +%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html +% %-------Constructors------- %Test() %Test(double a, Matrix b) -% +% %-------Methods------- %arg_EigenConstRef(Matrix value) : returns void %create_MixedPtrs() : returns pair< Test, SharedTest > @@ -22,10 +25,7 @@ %return_string(string value) : returns string %return_vector1(Vector value) : returns Vector %return_vector2(Vector value) : returns Vector -% -%-------Static Methods------- % -%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html classdef Test < handle properties ptr_Test = 0 diff --git a/wrap/tests/expected_namespaces/+ns1/ClassA.m b/wrap/tests/expected_namespaces/+ns1/ClassA.m index ee87c12d7..f7dce6031 100644 --- a/wrap/tests/expected_namespaces/+ns1/ClassA.m +++ b/wrap/tests/expected_namespaces/+ns1/ClassA.m @@ -1,11 +1,9 @@ +%class ClassA, see Doxygen page for details +%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html +% %-------Constructors------- %ClassA() -% -%-------Methods------- -% -%-------Static Methods------- % -%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html classdef ClassA < handle properties ptr_ns1ClassA = 0 diff --git a/wrap/tests/expected_namespaces/+ns1/ClassB.m b/wrap/tests/expected_namespaces/+ns1/ClassB.m index 7f393f03e..df956a179 100644 --- a/wrap/tests/expected_namespaces/+ns1/ClassB.m +++ b/wrap/tests/expected_namespaces/+ns1/ClassB.m @@ -1,11 +1,9 @@ +%class ClassB, see Doxygen page for details +%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html +% %-------Constructors------- %ClassB() -% -%-------Methods------- -% -%-------Static Methods------- % -%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html classdef ClassB < handle properties ptr_ns1ClassB = 0 diff --git a/wrap/tests/expected_namespaces/+ns2/+ns3/ClassB.m b/wrap/tests/expected_namespaces/+ns2/+ns3/ClassB.m index 4ad4a14f0..23c3dbacb 100644 --- a/wrap/tests/expected_namespaces/+ns2/+ns3/ClassB.m +++ b/wrap/tests/expected_namespaces/+ns2/+ns3/ClassB.m @@ -1,11 +1,9 @@ +%class ClassB, see Doxygen page for details +%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html +% %-------Constructors------- %ClassB() -% -%-------Methods------- -% -%-------Static Methods------- % -%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html classdef ClassB < handle properties ptr_ns2ns3ClassB = 0 diff --git a/wrap/tests/expected_namespaces/+ns2/ClassA.m b/wrap/tests/expected_namespaces/+ns2/ClassA.m index c56377c2a..c7ab901ae 100644 --- a/wrap/tests/expected_namespaces/+ns2/ClassA.m +++ b/wrap/tests/expected_namespaces/+ns2/ClassA.m @@ -1,15 +1,17 @@ +%class ClassA, see Doxygen page for details +%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html +% %-------Constructors------- %ClassA() -% +% %-------Methods------- %memberFunction() : returns double %nsArg(ClassB arg) : returns int %nsReturn(double q) : returns ns2::ns3::ClassB -% +% %-------Static Methods------- %afunction() : returns double % -%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html classdef ClassA < handle properties ptr_ns2ClassA = 0 diff --git a/wrap/tests/expected_namespaces/+ns2/ClassC.m b/wrap/tests/expected_namespaces/+ns2/ClassC.m index 050ef19f4..19b709f5c 100644 --- a/wrap/tests/expected_namespaces/+ns2/ClassC.m +++ b/wrap/tests/expected_namespaces/+ns2/ClassC.m @@ -1,11 +1,9 @@ +%class ClassC, see Doxygen page for details +%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html +% %-------Constructors------- %ClassC() -% -%-------Methods------- -% -%-------Static Methods------- % -%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html classdef ClassC < handle properties ptr_ns2ClassC = 0 diff --git a/wrap/tests/expected_namespaces/ClassD.m b/wrap/tests/expected_namespaces/ClassD.m index 41e9e63ec..453025961 100644 --- a/wrap/tests/expected_namespaces/ClassD.m +++ b/wrap/tests/expected_namespaces/ClassD.m @@ -1,11 +1,9 @@ +%class ClassD, see Doxygen page for details +%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html +% %-------Constructors------- %ClassD() -% -%-------Methods------- -% -%-------Static Methods------- % -%For more detailed documentation on GTSAM go to our Doxygen page, which can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html classdef ClassD < handle properties ptr_ClassD = 0