Added exists() as a utility for matlab to check whether a pointer is live
parent
e6d5c2bf73
commit
5fe46f9bad
3
gtsam.h
3
gtsam.h
|
@ -829,6 +829,7 @@ class SymbolicFactorGraph {
|
||||||
void print(string s) const;
|
void print(string s) const;
|
||||||
bool equals(const gtsam::SymbolicFactorGraph& rhs, double tol) const;
|
bool equals(const gtsam::SymbolicFactorGraph& rhs, double tol) const;
|
||||||
size_t size() const;
|
size_t size() const;
|
||||||
|
bool exists(size_t idx) const;
|
||||||
|
|
||||||
// Standard interface
|
// Standard interface
|
||||||
gtsam::KeySet keys() const;
|
gtsam::KeySet keys() const;
|
||||||
|
@ -1246,6 +1247,7 @@ class GaussianFactorGraph {
|
||||||
size_t size() const;
|
size_t size() const;
|
||||||
gtsam::GaussianFactor* at(size_t idx) const;
|
gtsam::GaussianFactor* at(size_t idx) const;
|
||||||
gtsam::KeySet keys() const;
|
gtsam::KeySet keys() const;
|
||||||
|
bool exists(size_t idx) const;
|
||||||
|
|
||||||
// Building the graph
|
// Building the graph
|
||||||
void push_back(gtsam::GaussianFactor* factor);
|
void push_back(gtsam::GaussianFactor* factor);
|
||||||
|
@ -1520,6 +1522,7 @@ class NonlinearFactorGraph {
|
||||||
gtsam::NonlinearFactor* at(size_t idx) const;
|
gtsam::NonlinearFactor* at(size_t idx) const;
|
||||||
void push_back(const gtsam::NonlinearFactorGraph& factors);
|
void push_back(const gtsam::NonlinearFactorGraph& factors);
|
||||||
void push_back(gtsam::NonlinearFactor* factor);
|
void push_back(gtsam::NonlinearFactor* factor);
|
||||||
|
bool exists(size_t idx) const;
|
||||||
|
|
||||||
// NonlinearFactorGraph
|
// NonlinearFactorGraph
|
||||||
double error(const gtsam::Values& values) const;
|
double error(const gtsam::Values& values) const;
|
||||||
|
|
|
@ -352,6 +352,9 @@ namespace gtsam {
|
||||||
/** Potentially very slow function to return all keys involved */
|
/** Potentially very slow function to return all keys involved */
|
||||||
FastSet<Key> keys() const;
|
FastSet<Key> keys() const;
|
||||||
|
|
||||||
|
/** MATLAB interface utility: Checks whether a factor index idx exists in the graph and is a live pointer */
|
||||||
|
inline bool exists(size_t idx) const { return idx < size() && at(idx); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** Serialization function */
|
/** Serialization function */
|
||||||
|
|
Loading…
Reference in New Issue