From 2c088b6a727053c490fe9c39d6406d733c731087 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Mon, 25 Jun 2012 12:09:42 +0000 Subject: [PATCH] Could not use local class for KeyFormatter when passing to boost function on some compilers --- gtsam/inference/BayesTree.h | 1 - gtsam/nonlinear/NonlinearISAM.cpp | 27 ++++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gtsam/inference/BayesTree.h b/gtsam/inference/BayesTree.h index c62af258a..4d8b0a1a4 100644 --- a/gtsam/inference/BayesTree.h +++ b/gtsam/inference/BayesTree.h @@ -34,7 +34,6 @@ #include #include #include -#include namespace gtsam { diff --git a/gtsam/nonlinear/NonlinearISAM.cpp b/gtsam/nonlinear/NonlinearISAM.cpp index 3bddbb635..467f7bfe3 100644 --- a/gtsam/nonlinear/NonlinearISAM.cpp +++ b/gtsam/nonlinear/NonlinearISAM.cpp @@ -29,21 +29,22 @@ using namespace std; namespace gtsam { + +/* ************************************************************************* */ +// Create an index formatter that looks up the Key in an inverse ordering, then +// formats the key using the provided key formatter, used in saveGraph. +struct OrderingIndexFormatter { + Ordering::InvertedMap inverseOrdering; + const KeyFormatter& keyFormatter; + OrderingIndexFormatter(const Ordering& ordering, const KeyFormatter& keyFormatter) : + inverseOrdering(ordering.invert()), keyFormatter(keyFormatter) {} + string operator()(Index index) { + return keyFormatter(inverseOrdering.at(index)); + } +}; + /* ************************************************************************* */ void NonlinearISAM::saveGraph(const string& s, const KeyFormatter& keyFormatter) const { - - // Create an index formatter that looks up the Key in an inverse ordering, then - // formats the key using the provided key formatter. - struct OrderingIndexFormatter { - Ordering::InvertedMap inverseOrdering; - const KeyFormatter& keyFormatter; - OrderingIndexFormatter(const Ordering& ordering, const KeyFormatter& keyFormatter) : - inverseOrdering(ordering.invert()), keyFormatter(keyFormatter) {} - string operator()(Index index) { - return keyFormatter(inverseOrdering.at(index)); - } - }; - isam_.saveGraph(s, OrderingIndexFormatter(ordering_, keyFormatter)); }