Simbody  3.5

Namespace-scope utility method SimTK::writeUnformatted<T>() writes a value of type T to an output stream as a space-separated series of tokens with no brackets, commas, semicolons or other formatting characters. More...

Functions

template<class T >
void SimTK::writeUnformatted (std::ostream &o, const T &v)
 The default implementation of writeUnformatted<T> converts the object to a String using the templatized String constructor, and then writes that string to the stream using String::operator<<(). More...
 
template<class T >
void SimTK::writeUnformatted (std::ostream &o, const float &v)
 Specialize for float to help some compilers with template matching. More...
 
template<class T >
void SimTK::writeUnformatted (std::ostream &o, const double &v)
 Specialize for double to help some compilers with template matching. More...
 
template<class T >
void SimTK::writeUnformatted (std::ostream &o, const long double &v)
 Specialize for long double to help some compilers with template matching. More...
 
template<class T >
void SimTK::writeUnformatted (std::ostream &o, const negator< T > &v)
 Specialize for SimTK::negator<T>: convert to T and write. More...
 
template<class T >
void SimTK::writeUnformatted (std::ostream &o, const std::complex< T > &v)
 Specialize for std::complex<T>: just write two T's separated by a space; no parentheses or comma. More...
 
template<class T >
void SimTK::writeUnformatted (std::ostream &o, const conjugate< T > &v)
 Specialize for SimTK::conjugate<T>: same as std::complex<T>. More...
 
template<int M, class E , int S>
void writeUnformatted (std::ostream &o, const Vec< M, E, S > &v)
 Specialize for Vec<M,E,S> to delegate to element type E, with spaces separating the elements. More...
 
template<int N, class E , int S>
void writeUnformatted (std::ostream &o, const Row< N, E, S > &v)
 Specialize for Row<N,E,S> to delegate to element type E, with spaces separating the elements; raw output is same as Vec. More...
 
template<int M, int N, class E , int CS, int RS>
void writeUnformatted (std::ostream &o, const Mat< M, N, E, CS, RS > &v)
 Specialize for Mat<M,N,E,CS,RS> delegating to Row<N,E,RS> with newlines separating the rows, but no final newline. More...
 
template<int M, class E , int RS>
void writeUnformatted (std::ostream &o, const SymMat< M, E, RS > &v)
 Specialize for SymMat<M,E,RS> delegating to Row<M,E,RS> with newlines separating the rows, but no final newline. More...
 

Detailed Description

Namespace-scope utility method SimTK::writeUnformatted<T>() writes a value of type T to an output stream as a space-separated series of tokens with no brackets, commas, semicolons or other formatting characters.

If there is only one token it is serialized without any added leading or trailing whitespace. Output of bool values is "true" or "false"; output of non-finite floating point values is "NaN", "Inf", or "-Inf" as in Matlab. For matrix output, we will write a newline between each row, meaning there won't be one after the last row. This method is specialized for many SimTK types, and you can specialize it for your own types in which case containers like Array_<YourType> will work correctly too.

Function Documentation

template<class T >
void SimTK::writeUnformatted ( std::ostream &  o,
const T &  v 
)
inline

The default implementation of writeUnformatted<T> converts the object to a String using the templatized String constructor, and then writes that string to the stream using String::operator<<().

This is suitable for use with any of the built-in types. Note that bool will be output "true" or "false" and non-finite floating point values are written as NaN, Inf, or -Inf as appropriate.

template<class T >
void SimTK::writeUnformatted ( std::ostream &  o,
const float &  v 
)
inline

Specialize for float to help some compilers with template matching.

template<class T >
void SimTK::writeUnformatted ( std::ostream &  o,
const double &  v 
)
inline

Specialize for double to help some compilers with template matching.

template<class T >
void SimTK::writeUnformatted ( std::ostream &  o,
const long double &  v 
)
inline

Specialize for long double to help some compilers with template matching.

template<class T >
void SimTK::writeUnformatted ( std::ostream &  o,
const negator< T > &  v 
)
inline

Specialize for SimTK::negator<T>: convert to T and write.

template<class T >
void SimTK::writeUnformatted ( std::ostream &  o,
const std::complex< T > &  v 
)
inline

Specialize for std::complex<T>: just write two T's separated by a space; no parentheses or comma.

template<class T >
void SimTK::writeUnformatted ( std::ostream &  o,
const conjugate< T > &  v 
)
inline

Specialize for SimTK::conjugate<T>: same as std::complex<T>.

template<int M, class E , int S>
void writeUnformatted ( std::ostream &  o,
const Vec< M, E, S > &  v 
)
related

Specialize for Vec<M,E,S> to delegate to element type E, with spaces separating the elements.

template<int N, class E , int S>
void writeUnformatted ( std::ostream &  o,
const Row< N, E, S > &  v 
)
related

Specialize for Row<N,E,S> to delegate to element type E, with spaces separating the elements; raw output is same as Vec.

template<int M, int N, class E , int CS, int RS>
void writeUnformatted ( std::ostream &  o,
const Mat< M, N, E, CS, RS > &  v 
)
related

Specialize for Mat<M,N,E,CS,RS> delegating to Row<N,E,RS> with newlines separating the rows, but no final newline.

template<int M, class E , int RS>
void writeUnformatted ( std::ostream &  o,
const SymMat< M, E, RS > &  v 
)
related

Specialize for SymMat<M,E,RS> delegating to Row<M,E,RS> with newlines separating the rows, but no final newline.