removed odprint which used varargs to fix issue 91
parent
4a1d04a4d0
commit
968bea0a58
|
@ -30,55 +30,11 @@
|
||||||
|
|
||||||
#include <gtsam/base/Vector.h>
|
#include <gtsam/base/Vector.h>
|
||||||
|
|
||||||
//#ifdef WIN32
|
|
||||||
//#include <Windows.h>
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
void odprintf_(const char *format, ostream& stream, ...) {
|
|
||||||
char buf[4096], *p = buf;
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, stream);
|
|
||||||
#ifdef WIN32
|
|
||||||
_vsnprintf(p, sizeof buf - 3, format, args); // buf-3 is room for CR/LF/NUL
|
|
||||||
#else
|
|
||||||
vsnprintf(p, sizeof buf - 3, format, args); // buf-3 is room for CR/LF/NUL
|
|
||||||
#endif
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
//#ifdef WIN32
|
|
||||||
// OutputDebugString(buf);
|
|
||||||
//#else
|
|
||||||
stream << buf;
|
|
||||||
//#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
|
|
||||||
void odprintf(const char *format, ...) {
|
|
||||||
char buf[4096], *p = buf;
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
|
||||||
#ifdef WIN32
|
|
||||||
_vsnprintf(p, sizeof buf - 3, format, args); // buf-3 is room for CR/LF/NUL
|
|
||||||
#else
|
|
||||||
vsnprintf(p, sizeof buf - 3, format, args); // buf-3 is room for CR/LF/NUL
|
|
||||||
#endif
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
//#ifdef WIN32
|
|
||||||
// OutputDebugString(buf);
|
|
||||||
//#else
|
|
||||||
cout << buf;
|
|
||||||
//#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
bool zero(const Vector& v) {
|
bool zero(const Vector& v) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
@ -101,10 +57,12 @@ Vector delta(size_t n, size_t i, double value) {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void print(const Vector& v, const string& s, ostream& stream) {
|
void print(const Vector& v, const string& s, ostream& stream) {
|
||||||
size_t n = v.size();
|
size_t n = v.size();
|
||||||
odprintf_("%s [", stream, s.c_str());
|
|
||||||
for(size_t i=0; i<n; i++)
|
stream << s << "[";
|
||||||
odprintf_("%g%s", stream, v[i], (i<n-1 ? "; " : ""));
|
for(size_t i=0; i<n; i++) {
|
||||||
odprintf_("];\n", stream);
|
stream << setprecision(9) << v(i) << (i<n-1 ? "; " : "");
|
||||||
|
}
|
||||||
|
stream << "];" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
@ -41,11 +41,6 @@ typedef Eigen::Matrix<double, 6, 1> Vector6;
|
||||||
typedef Eigen::VectorBlock<Vector> SubVector;
|
typedef Eigen::VectorBlock<Vector> SubVector;
|
||||||
typedef Eigen::VectorBlock<const Vector> ConstSubVector;
|
typedef Eigen::VectorBlock<const Vector> ConstSubVector;
|
||||||
|
|
||||||
/**
|
|
||||||
* An auxiliary function to printf for Win32 compatibility, added by Kai
|
|
||||||
*/
|
|
||||||
GTSAM_EXPORT void odprintf(const char *format, ...);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create vector initialized to a constant value
|
* Create vector initialized to a constant value
|
||||||
* @param n is the size of the vector
|
* @param n is the size of the vector
|
||||||
|
|
|
@ -38,7 +38,7 @@ Errors::Errors(const VectorValues& V) {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void Errors::print(const std::string& s) const {
|
void Errors::print(const std::string& s) const {
|
||||||
odprintf("%s:\n", s.c_str());
|
cout << s << endl;
|
||||||
BOOST_FOREACH(const Vector& v, *this)
|
BOOST_FOREACH(const Vector& v, *this)
|
||||||
gtsam::print(v);
|
gtsam::print(v);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue