Some reformatting/docs/using

release/4.3a0
Frank Dellaert 2022-01-18 17:33:46 -05:00
parent 296b469df9
commit 7557bd990a
1 changed files with 23 additions and 20 deletions

View File

@ -64,33 +64,35 @@ template<> struct EliminationTraits<DiscreteFactorGraph>
* A Discrete Factor Graph is a factor graph where all factors are Discrete, i.e. * A Discrete Factor Graph is a factor graph where all factors are Discrete, i.e.
* Factor == DiscreteFactor * Factor == DiscreteFactor
*/ */
class GTSAM_EXPORT DiscreteFactorGraph: public FactorGraph<DiscreteFactor>, class GTSAM_EXPORT DiscreteFactorGraph
public EliminateableFactorGraph<DiscreteFactorGraph> { : public FactorGraph<DiscreteFactor>,
public: public EliminateableFactorGraph<DiscreteFactorGraph> {
public:
using This = DiscreteFactorGraph; ///< this class
using Base = FactorGraph<DiscreteFactor>; ///< base factor graph type
using BaseEliminateable =
EliminateableFactorGraph<This>; ///< for elimination
using shared_ptr = boost::shared_ptr<This>; ///< shared_ptr to This
typedef DiscreteFactorGraph This; ///< Typedef to this class using Values = DiscreteValues; ///< backwards compatibility
typedef FactorGraph<DiscreteFactor> Base; ///< Typedef to base factor graph type
typedef EliminateableFactorGraph<This> BaseEliminateable; ///< Typedef to base elimination class
typedef boost::shared_ptr<This> shared_ptr; ///< shared_ptr to this class
using Values = DiscreteValues; ///< backwards compatibility using Indices = KeyVector; ///> map from keys to values
/** A map from keys to values */
typedef KeyVector Indices;
/** Default constructor */ /** Default constructor */
DiscreteFactorGraph() {} DiscreteFactorGraph() {}
/** Construct from iterator over factors */ /** Construct from iterator over factors */
template<typename ITERATOR> template <typename ITERATOR>
DiscreteFactorGraph(ITERATOR firstFactor, ITERATOR lastFactor) : Base(firstFactor, lastFactor) {} DiscreteFactorGraph(ITERATOR firstFactor, ITERATOR lastFactor)
: Base(firstFactor, lastFactor) {}
/** Construct from container of factors (shared_ptr or plain objects) */ /** Construct from container of factors (shared_ptr or plain objects) */
template<class CONTAINER> template <class CONTAINER>
explicit DiscreteFactorGraph(const CONTAINER& factors) : Base(factors) {} explicit DiscreteFactorGraph(const CONTAINER& factors) : Base(factors) {}
/** Implicit copy/downcast constructor to override explicit template container constructor */ /** Implicit copy/downcast constructor to override explicit template container
template<class DERIVEDFACTOR> * constructor */
template <class DERIVEDFACTOR>
DiscreteFactorGraph(const FactorGraph<DERIVEDFACTOR>& graph) : Base(graph) {} DiscreteFactorGraph(const FactorGraph<DERIVEDFACTOR>& graph) : Base(graph) {}
/// Destructor /// Destructor
@ -108,7 +110,7 @@ public:
void add(Args&&... args) { void add(Args&&... args) {
emplace_shared<DecisionTreeFactor>(std::forward<Args>(args)...); emplace_shared<DecisionTreeFactor>(std::forward<Args>(args)...);
} }
/** Return the set of variables involved in the factors (set union) */ /** Return the set of variables involved in the factors (set union) */
KeySet keys() const; KeySet keys() const;
@ -163,9 +165,10 @@ public:
const DiscreteFactor::Names& names = {}) const; const DiscreteFactor::Names& names = {}) const;
/// @} /// @}
}; // \ DiscreteFactorGraph }; // \ DiscreteFactorGraph
/// traits /// traits
template<> struct traits<DiscreteFactorGraph> : public Testable<DiscreteFactorGraph> {}; template <>
struct traits<DiscreteFactorGraph> : public Testable<DiscreteFactorGraph> {};
} // \ namespace gtsam } // namespace gtsam