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 <boost/lexical_cast.hpp>
21 #include <exception>
22 
23 #include <gtsam/inference/Key.h>
24 
25 namespace gtsam {
26 
33  class MarginalizeNonleafException : public std::exception {
36  mutable std::string what_;
37  public:
39  key_(key), formatter_(formatter) {}
40  virtual ~MarginalizeNonleafException() noexcept {}
41  Key key() const { return key_; }
42  const char* what() const noexcept override {
43  if(what_.empty())
44  what_ =
45 "\nRequested to marginalize out variable " + formatter_(key_) + ", but this variable\n\
46 is not a leaf. To make the variables you would like to marginalize be leaves,\n\
47 their ordering should be constrained using the constrainedKeys argument to\n\
48 ISAM2::update().\n";
49  return what_.c_str();
50  }
51  };
52 
53 }
MarginalizeNonleafException(Key key, KeyFormatter formatter=DefaultKeyFormatter) noexcept
virtual ~MarginalizeNonleafException() noexcept
static const KeyFormatter DefaultKeyFormatter
Definition: Key.h:43
const KeyFormatter & formatter
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
traits
Definition: chartTesting.h:28
const char * what() const noexceptoverride
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:43:03