Return a set of DiscreteKey, Fixes issue #1384
parent
28f440a623
commit
f4c3131ee2
|
|
@ -25,17 +25,17 @@
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
DiscreteKeys HybridFactorGraph::discreteKeys() const {
|
std::set<DiscreteKey> HybridFactorGraph::discreteKeys() const {
|
||||||
DiscreteKeys keys;
|
std::set<DiscreteKey> keys;
|
||||||
for (auto& factor : factors_) {
|
for (auto& factor : factors_) {
|
||||||
if (auto p = boost::dynamic_pointer_cast<DecisionTreeFactor>(factor)) {
|
if (auto p = boost::dynamic_pointer_cast<DecisionTreeFactor>(factor)) {
|
||||||
for (const DiscreteKey& key : p->discreteKeys()) {
|
for (const DiscreteKey& key : p->discreteKeys()) {
|
||||||
keys.push_back(key);
|
keys.insert(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (auto p = boost::dynamic_pointer_cast<HybridFactor>(factor)) {
|
if (auto p = boost::dynamic_pointer_cast<HybridFactor>(factor)) {
|
||||||
for (const DiscreteKey& key : p->discreteKeys()) {
|
for (const DiscreteKey& key : p->discreteKeys()) {
|
||||||
keys.push_back(key);
|
keys.insert(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class HybridFactorGraph : public FactorGraph<Factor> {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// Get all the discrete keys in the factor graph.
|
/// Get all the discrete keys in the factor graph.
|
||||||
DiscreteKeys discreteKeys() const;
|
std::set<DiscreteKey> discreteKeys() const;
|
||||||
|
|
||||||
/// Get all the discrete keys in the factor graph, as a set.
|
/// Get all the discrete keys in the factor graph, as a set.
|
||||||
KeySet discreteKeySet() const;
|
KeySet discreteKeySet() const;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue