Simbody  3.6

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 negator< T > &v)
 Partial specialization for SimTK::negator<T>: convert to T and write. More...
 
template<class T >
void SimTK::writeUnformatted (std::ostream &o, const std::complex< T > &v)
 Partial specialization 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)
 Partial specialization 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

◆ writeUnformatted() [1/8]

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. Bool will be output "true" or "false", floating point values will be written with enough digits to be read back unchanged, and non-finite floating point values are written as NaN, Inf, or -Inf as appropriate (Matlab compatible).

◆ writeUnformatted() [2/8]

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

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

◆ writeUnformatted() [3/8]

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

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

◆ writeUnformatted() [4/8]

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

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

◆ writeUnformatted() [5/8]

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.

◆ writeUnformatted() [6/8]

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.

◆ writeUnformatted() [7/8]

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.

◆ writeUnformatted() [8/8]

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.