public/protected/private visibility fixes and fixes with base/derived classes

release/4.3a0
Richard Roberts 2013-06-17 21:16:08 +00:00
parent 642eca5fc5
commit d85a437c90
7 changed files with 33 additions and 13 deletions

View File

@ -84,7 +84,7 @@ namespace gtsam {
/// @{ /// @{
/** check equality */ /** check equality */
bool equals(const This& other, double tol = 1e-9) const { bool equals(const DERIVED& other, double tol = 1e-9) const {
return (!conditional_ && !other.conditional()) return (!conditional_ && !other.conditional())
|| conditional_->equals(*other.conditional(), tol); || conditional_->equals(*other.conditional(), tol);
} }

View File

@ -104,9 +104,11 @@ namespace gtsam {
/** Copy constructor */ /** Copy constructor */
BayesTreeUnordered(const This& other); BayesTreeUnordered(const This& other);
protected:
/** Assignment operator */ /** Assignment operator */
This& operator=(const This& other); This& operator=(const This& other);
public:
/// @} /// @}
/// @name Advanced Constructors /// @name Advanced Constructors
/// @{ /// @{
@ -118,6 +120,7 @@ namespace gtsam {
/// @name Testable /// @name Testable
/// @{ /// @{
protected:
/** check equality */ /** check equality */
bool equals(const This& other, double tol = 1e-9) const; bool equals(const This& other, double tol = 1e-9) const;
@ -125,6 +128,7 @@ namespace gtsam {
void print(const std::string& s = "", void print(const std::string& s = "",
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const; const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
public:
/// @} /// @}
/// @name Standard Interface /// @name Standard Interface
/// @{ /// @{

View File

@ -39,19 +39,18 @@ namespace gtsam {
class FactorGraphUnordered { class FactorGraphUnordered {
public: public:
typedef FactorGraphUnordered<FACTOR> This; typedef FactorGraphUnordered<FACTOR> This;
typedef FACTOR FactorType; ///< factor type typedef FACTOR FactorType; ///< factor type
typedef boost::shared_ptr<FACTOR> sharedFactor; ///< Shared pointer to a factor typedef boost::shared_ptr<FACTOR> sharedFactor; ///< Shared pointer to a factor
typedef boost::shared_ptr<typename FACTOR::ConditionalType> sharedConditional; ///< Shared pointer to a conditional typedef boost::shared_ptr<typename FACTOR::ConditionalType> sharedConditional; ///< Shared pointer to a conditional
typedef FactorGraphUnordered<FACTOR> This; ///< Typedef for this class
typedef boost::shared_ptr<This> shared_ptr; ///< Shared pointer for this class
typedef typename std::vector<sharedFactor>::iterator iterator; typedef typename std::vector<sharedFactor>::iterator iterator;
typedef typename std::vector<sharedFactor>::const_iterator const_iterator; typedef typename std::vector<sharedFactor>::const_iterator const_iterator;
protected: private:
typedef FactorGraphUnordered<FACTOR> This; ///< Typedef for this class
typedef boost::shared_ptr<This> shared_ptr; ///< Shared pointer for this class
protected:
/** concept check, makes sure FACTOR defines print and equals */ /** concept check, makes sure FACTOR defines print and equals */
GTSAM_CONCEPT_TESTABLE_TYPE(FACTOR) GTSAM_CONCEPT_TESTABLE_TYPE(FACTOR)
@ -59,7 +58,6 @@ namespace gtsam {
std::vector<sharedFactor> factors_; std::vector<sharedFactor> factors_;
public: public:
/// @name Standard Constructors /// @name Standard Constructors
/// @{ /// @{

View File

@ -50,13 +50,13 @@ namespace gtsam {
*/ */
class GTSAM_EXPORT FactorUnordered { class GTSAM_EXPORT FactorUnordered {
public: private:
typedef FactorUnordered This; ///< This class typedef FactorUnordered This; ///< This class
/// A shared_ptr to this class, derived classes must redefine this. /// A shared_ptr to this class, derived classes must redefine this.
typedef boost::shared_ptr<FactorUnordered> shared_ptr; typedef boost::shared_ptr<FactorUnordered> shared_ptr;
public:
/// Iterator over keys /// Iterator over keys
typedef std::vector<Key>::iterator iterator; typedef std::vector<Key>::iterator iterator;
@ -68,8 +68,6 @@ protected:
/// The keys involved in this factor /// The keys involved in this factor
std::vector<Key> keys_; std::vector<Key> keys_;
public:
/// @name Standard Constructors /// @name Standard Constructors
/// @{ /// @{
@ -118,7 +116,7 @@ public:
/// @} /// @}
public:
/// @name Standard Interface /// @name Standard Interface
/// @{ /// @{

View File

@ -42,11 +42,24 @@ namespace gtsam {
class GTSAM_EXPORT SymbolicBayesTreeUnordered : class GTSAM_EXPORT SymbolicBayesTreeUnordered :
public BayesTreeUnordered<SymbolicBayesTreeCliqueUnordered> public BayesTreeUnordered<SymbolicBayesTreeCliqueUnordered>
{ {
private:
typedef BayesTreeUnordered<SymbolicBayesTreeCliqueUnordered> Base;
public: public:
typedef SymbolicBayesTreeUnordered This;
typedef boost::shared_ptr<This> shared_ptr;
/** Insert a new conditional */ /** Insert a new conditional */
//void insert(const sharedConditional& conditional); //void insert(const sharedConditional& conditional);
/** check equality */
bool equals(const This& other, double tol = 1e-9) const { return Base::equals(other, tol); }
/** print */
void print(const std::string& s = "",
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const { Base::print(s, keyFormatter); }
protected: protected:
/** /**

View File

@ -35,7 +35,6 @@ namespace gtsam {
class GTSAM_EXPORT SymbolicConditionalUnordered : public SymbolicFactorUnordered, public ConditionalUnordered<SymbolicFactorUnordered,SymbolicConditionalUnordered> { class GTSAM_EXPORT SymbolicConditionalUnordered : public SymbolicFactorUnordered, public ConditionalUnordered<SymbolicFactorUnordered,SymbolicConditionalUnordered> {
public: public:
typedef SymbolicConditionalUnordered This; /// Typedef to this class typedef SymbolicConditionalUnordered This; /// Typedef to this class
typedef SymbolicFactorUnordered BaseFactor; /// Typedef to the factor base class typedef SymbolicFactorUnordered BaseFactor; /// Typedef to the factor base class
typedef ConditionalUnordered<SymbolicFactorUnordered,SymbolicConditionalUnordered> BaseConditional; /// Typedef to the conditional base class typedef ConditionalUnordered<SymbolicFactorUnordered,SymbolicConditionalUnordered> BaseConditional; /// Typedef to the conditional base class

View File

@ -22,6 +22,7 @@
#include <gtsam/inference/FactorGraphUnordered.h> #include <gtsam/inference/FactorGraphUnordered.h>
#include <gtsam/inference/EliminateableFactorGraph.h> #include <gtsam/inference/EliminateableFactorGraph.h>
#include <gtsam/symbolic/SymbolicFactorUnordered.h> #include <gtsam/symbolic/SymbolicFactorUnordered.h>
// NOTE: Additional headers included at end of file for user convenience
namespace gtsam { class SymbolicConditionalUnordered; } namespace gtsam { class SymbolicConditionalUnordered; }
namespace gtsam { class SymbolicBayesNetUnordered; } namespace gtsam { class SymbolicBayesNetUnordered; }
@ -47,6 +48,7 @@ namespace gtsam {
typedef EliminateableFactorGraph< typedef EliminateableFactorGraph<
SymbolicFactorUnordered, SymbolicFactorGraphUnordered, SymbolicConditionalUnordered, SymbolicBayesNetUnordered, SymbolicFactorUnordered, SymbolicFactorGraphUnordered, SymbolicConditionalUnordered, SymbolicBayesNetUnordered,
SymbolicEliminationTreeUnordered, SymbolicBayesTreeUnordered, SymbolicJunctionTreeUnordered> BaseEliminateable; SymbolicEliminationTreeUnordered, SymbolicBayesTreeUnordered, SymbolicJunctionTreeUnordered> BaseEliminateable;
typedef boost::shared_ptr<This> shared_ptr;
typedef BaseEliminateable::Eliminate Eliminate; typedef BaseEliminateable::Eliminate Eliminate;
/// @name Standard Constructors /// @name Standard Constructors
@ -83,3 +85,9 @@ namespace gtsam {
}; };
} // namespace gtsam } // namespace gtsam
// These are not needed for this file but are returned from EliminateableFactorGraph functions so
// are included here for user convenience
#include <gtsam/symbolic/SymbolicBayesNetUnordered.h>
#include <gtsam/symbolic/SymbolicBayesTreeUnordered.h>