Started print formatter

release/4.3a0
Richard Roberts 2012-02-20 17:02:59 +00:00
parent 0592b71ac4
commit 3bd1aa13fc
5 changed files with 1073 additions and 997 deletions

2002
.cproject

File diff suppressed because it is too large Load Diff

View File

@ -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 */

View File

@ -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 */

View File

@ -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";
}

View File

@ -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_;