gtsam
Loading...
Searching...
No Matches
EdgeKey.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
12#pragma once
13
20
21#include <gtsam/base/Testable.h>
22#include <gtsam/inference/Key.h>
23
24namespace gtsam {
25class GTSAM_EXPORT EdgeKey {
26 protected:
27 std::uint32_t i_;
28 std::uint32_t j_;
29
30 public:
33
35 EdgeKey() : i_(0), j_(0) {}
36
38 EdgeKey(std::uint32_t i, std::uint32_t j) : i_(i), j_(j) {}
39
40 EdgeKey(Key key)
41 : i_(static_cast<std::uint32_t>(key >> 32)),
42 j_(static_cast<std::uint32_t>(key)) {}
43
47
49 Key key() const { return ((std::uint64_t)i_ << 32) | j_; }
50
52 operator Key() const { return key(); }
53
55 inline std::uint32_t i() const { return i_; }
56
58 inline std::uint32_t j() const { return j_; }
59
61 operator std::string() const;
62
64 friend GTSAM_EXPORT std::ostream& operator<<(std::ostream&, const EdgeKey&);
65
69
71 void print(const std::string& s = "") const;
72
74 bool equals(const EdgeKey& expected, double tol = 0.0) const {
75 return (*this) == expected;
76 }
77
78};
79
81template <>
82struct traits<EdgeKey> : public Testable<EdgeKey> {};
83
84} // namespace gtsam
Concept check for values that can be used in unit tests.
STL namespace.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
Definition EdgeKey.h:25
Key key() const
Cast to Key.
Definition EdgeKey.h:49
std::uint32_t i_
Upper 32 bits.
Definition EdgeKey.h:27
EdgeKey(std::uint32_t i, std::uint32_t j)
Constructor.
Definition EdgeKey.h:38
bool equals(const EdgeKey &expected, double tol=0.0) const
Checks if this EdgeKey is equal to another, tolerance is ignored.
Definition EdgeKey.h:74
EdgeKey()
Default constructor.
Definition EdgeKey.h:35
std::uint32_t j() const
Retrieve low 32 bits.
Definition EdgeKey.h:58
std::uint32_t i() const
Retrieve high 32 bits.
Definition EdgeKey.h:55
std::uint32_t j_
Lower 32 bits.
Definition EdgeKey.h:28