nonlinearExceptions.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 
18 #pragma once
19 
20 #include <exception>
21 
22 #include <gtsam/inference/Key.h>
23 
24 namespace gtsam {
25 
32  class MarginalizeNonleafException : public std::exception {
35  mutable std::string what_;
36  public:
39  virtual ~MarginalizeNonleafException() noexcept {}
40  Key key() const { return key_; }
41  const char* what() const noexcept override {
42  if(what_.empty())
43  what_ =
44 "\nRequested to marginalize out variable " + formatter_(key_) + ", but this variable\n\
45 is not a leaf. To make the variables you would like to marginalize be leaves,\n\
46 their ordering should be constrained using the constrainedKeys argument to\n\
47 ISAM2::update().\n";
48  return what_.c_str();
49  }
50  };
51 
52 }
gtsam::MarginalizeNonleafException::what
const char * what() const noexcept override
Definition: nonlinearExceptions.h:41
formatter
const KeyFormatter & formatter
Definition: treeTraversal-inst.h:204
gtsam::MarginalizeNonleafException::key_
Key key_
Definition: nonlinearExceptions.h:33
gtsam::MarginalizeNonleafException::what_
std::string what_
Definition: nonlinearExceptions.h:35
gtsam::DefaultKeyFormatter
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition: Key.cpp:30
Key.h
gtsam::MarginalizeNonleafException::formatter_
KeyFormatter formatter_
Definition: nonlinearExceptions.h:34
gtsam::KeyFormatter
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:35
gtsam::MarginalizeNonleafException::key
Key key() const
Definition: nonlinearExceptions.h:40
gtsam
traits
Definition: SFMdata.h:40
gtsam::MarginalizeNonleafException::MarginalizeNonleafException
MarginalizeNonleafException(Key key, KeyFormatter formatter=DefaultKeyFormatter) noexcept
Definition: nonlinearExceptions.h:37
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97
gtsam::MarginalizeNonleafException::~MarginalizeNonleafException
virtual ~MarginalizeNonleafException() noexcept
Definition: nonlinearExceptions.h:39
gtsam::MarginalizeNonleafException
Definition: nonlinearExceptions.h:32


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:03:12