move DiscreteKeys code to .cpp
parent
c6ebbdc708
commit
ab017dfd19
|
|
@ -48,4 +48,25 @@ namespace gtsam {
|
||||||
return keys & key2;
|
return keys & key2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DiscreteKeys::print(const std::string& s,
|
||||||
|
const KeyFormatter& keyFormatter) const {
|
||||||
|
for (auto&& dkey : *this) {
|
||||||
|
std::cout << DefaultKeyFormatter(dkey.first) << " " << dkey.second
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DiscreteKeys::equals(const DiscreteKeys& other, double tol) const {
|
||||||
|
if (this->size() != other.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < this->size(); i++) {
|
||||||
|
if (this->at(i).first != other.at(i).first ||
|
||||||
|
this->at(i).second != other.at(i).second) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,26 +73,10 @@ namespace gtsam {
|
||||||
|
|
||||||
/// Print the keys and cardinalities.
|
/// Print the keys and cardinalities.
|
||||||
void print(const std::string& s = "",
|
void print(const std::string& s = "",
|
||||||
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const {
|
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
|
||||||
for (auto&& dkey : *this) {
|
|
||||||
std::cout << DefaultKeyFormatter(dkey.first) << " " << dkey.second
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool equals(const DiscreteKeys& other, double tol = 0) const {
|
/// Check equality to another DiscreteKeys object.
|
||||||
if (this->size() != other.size()) {
|
bool equals(const DiscreteKeys& other, double tol = 0) const;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < this->size(); i++) {
|
|
||||||
if (this->at(i).first != other.at(i).first ||
|
|
||||||
this->at(i).second != other.at(i).second) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Serialization function */
|
/** Serialization function */
|
||||||
friend class boost::serialization::access;
|
friend class boost::serialization::access;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue