Additional API
parent
bf47ef3432
commit
6f2b49d80d
|
@ -20,9 +20,12 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
// Output stream operator implementation
|
EdgeKey::operator std::string() const {
|
||||||
|
return "{" + std::to_string(i_) + ", " + std::to_string(j_) + "}";
|
||||||
|
}
|
||||||
|
|
||||||
GTSAM_EXPORT std::ostream& operator<<(std::ostream& os, const EdgeKey& key) {
|
GTSAM_EXPORT std::ostream& operator<<(std::ostream& os, const EdgeKey& key) {
|
||||||
os << "{" << key.i() << ", " << key.j() << "}";
|
os << (std::string)key;
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,10 @@ class GTSAM_EXPORT EdgeKey {
|
||||||
/// Constructor
|
/// Constructor
|
||||||
EdgeKey(std::uint32_t i, std::uint32_t j) : i_(i), j_(j) {}
|
EdgeKey(std::uint32_t i, std::uint32_t j) : i_(i), j_(j) {}
|
||||||
|
|
||||||
|
EdgeKey(Key key)
|
||||||
|
: i_(static_cast<std::uint32_t>(key >> 32)),
|
||||||
|
j_(static_cast<std::uint32_t>(key)) {}
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
/// @name API
|
/// @name API
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -50,6 +54,9 @@ class GTSAM_EXPORT EdgeKey {
|
||||||
/// Retrieve low 32 bits
|
/// Retrieve low 32 bits
|
||||||
inline std::uint32_t j() const { return j_; }
|
inline std::uint32_t j() const { return j_; }
|
||||||
|
|
||||||
|
/** Create a string from the key */
|
||||||
|
operator std::string() const;
|
||||||
|
|
||||||
/// Output stream operator
|
/// Output stream operator
|
||||||
friend GTSAM_EXPORT std::ostream& operator<<(std::ostream&, const EdgeKey&);
|
friend GTSAM_EXPORT std::ostream& operator<<(std::ostream&, const EdgeKey&);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue