Started print formatter
parent
0592b71ac4
commit
3bd1aa13fc
|
@ -0,0 +1,23 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
|
||||
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
||||
* Atlanta, Georgia 30332-0415
|
||||
* All Rights Reserved
|
||||
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
||||
|
||||
* See LICENSE for the license information
|
||||
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* @file StringFormatter.cpp
|
||||
* @brief
|
||||
* @author Richard Roberts
|
||||
* @date Feb 19, 2012
|
||||
*/
|
||||
|
||||
#include "StringFormatter.h"
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
} /* namespace gtsam */
|
|
@ -0,0 +1,36 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
|
||||
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
||||
* Atlanta, Georgia 30332-0415
|
||||
* All Rights Reserved
|
||||
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
||||
|
||||
* See LICENSE for the license information
|
||||
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* @file StringFormatter.h
|
||||
* @brief
|
||||
* @author Richard Roberts
|
||||
* @date Feb 19, 2012
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class StringFormatter {
|
||||
|
||||
public:
|
||||
|
||||
virtual ~StringFormatter() {}
|
||||
|
||||
virtual std::string keyToString(Key key) = 0;
|
||||
|
||||
};
|
||||
|
||||
} /* namespace gtsam */
|
|
@ -24,6 +24,7 @@
|
|||
#include <limits>
|
||||
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include <gtsam/inference/Factor-inl.h>
|
||||
#include <gtsam/inference/IndexFactor.h>
|
||||
|
@ -78,7 +79,8 @@ public:
|
|||
/// @{
|
||||
|
||||
/** print */
|
||||
virtual void print(const std::string& s = "") const {
|
||||
virtual void print(const std::string& s = "",
|
||||
const boost::function<std::string(Key)>& keyFormatter = &Symbol::format) const {
|
||||
std::cout << s << ": NonlinearFactor\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -119,6 +119,11 @@ public:
|
|||
return (*this) == expected;
|
||||
}
|
||||
|
||||
/** Format function that can be passed to print functions in nonlinear */
|
||||
static std::string format(Key key) {
|
||||
return (std::string)Symbol(key);
|
||||
}
|
||||
|
||||
/** Retrieve key character */
|
||||
unsigned char chr() const {
|
||||
return c_;
|
||||
|
|
Loading…
Reference in New Issue