Simbody  3.5

Namespace-scope utility function SimTK::readUnformatted<T>() reads the next whitespace-separated token(s) from a given stream and attempts to interpret them as a value of type T. More...

Functions

bool SimTK::readOneTokenUnformatted (std::istream &in, String &token)
 Read in the next whitespace-delimited token as a String, ignoring leading whitespace. More...
 
template<class T >
bool SimTK::readUnformatted (std::istream &in, T &v)
 The default implementation of readUnformatted<T> reads in the next whitespace-separated token and then attempts to convert the whole thing into one value of type T. More...
 
template<class T >
bool SimTK::readUnformatted (std::istream &in, float &v)
 Specialize for float to help some compilers with template matching. More...
 
template<class T >
bool SimTK::readUnformatted (std::istream &in, double &v)
 Specialize for double to help some compilers with template matching. More...
 
template<class T >
bool SimTK::readUnformatted (std::istream &in, long double &v)
 Specialize for long double to help some compilers with template matching. More...
 
template<class T >
bool SimTK::readUnformatted (std::istream &in, negator< T > &v)
 Specialization for negator<T>: read as type T and convert. More...
 
template<class T >
bool SimTK::readUnformatted (std::istream &in, std::complex< T > &v)
 Specialization for std::complex<T> (two space-separated T's). More...
 
template<class T >
bool SimTK::readUnformatted (std::istream &in, conjugate< T > &v)
 Specialization for SimTK::conjugate<T> (same as std::complex<T>). More...
 
template<>
bool SimTK::readUnformatted< String > (std::istream &in, String &v)
 Specialization for SimTK::String (just read token). More...
 
template<int M, class E , int S>
bool readUnformatted (std::istream &in, 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>
bool readUnformatted (std::istream &in, Row< N, E, S > &v)
 Specialize for Row<N,E,S> to delegate to element type E, with spaces separating the elements; format is same as Vec. More...
 
template<int M, int N, class E , int CS, int RS>
bool readUnformatted (std::istream &in, Mat< M, N, E, CS, RS > &v)
 Specialize for Mat<M,N,E,CS,RS> delegating to Row<N,E,RS>. More...
 
template<int M, class E , int RS>
bool readUnformatted (std::istream &in, SymMat< M, E, RS > &v)
 Specialize for SymMat<M,E,RS>. More...
 

Detailed Description

Namespace-scope utility function SimTK::readUnformatted<T>() reads the next whitespace-separated token(s) from a given stream and attempts to interpret them as a value of type T.

Function Documentation

bool SimTK::readOneTokenUnformatted ( std::istream &  in,
String token 
)
inline

Read in the next whitespace-delimited token as a String, ignoring leading whitespace.

The token is terminated by whitespace or eof and the terminating character is left in the stream. Failure to find any non-whitespace characters is treated as a failure. If we're successful at getting a token the function returns true; the stream may be good() or eof(). Otherwise this function returns false and the fail bit in the stream is also set.

template<class T >
bool SimTK::readUnformatted ( std::istream &  in,
T &  v 
)
inline

The default implementation of readUnformatted<T> reads in the next whitespace-separated token and then attempts to convert the whole thing into one value of type T.

If that fails, or if the whole token isn't consumed, we return false and the fail bit is set in the stream.

Returns
true if we are successful in reading the value
template<class T >
bool SimTK::readUnformatted ( std::istream &  in,
float &  v 
)
inline

Specialize for float to help some compilers with template matching.

template<class T >
bool SimTK::readUnformatted ( std::istream &  in,
double &  v 
)
inline

Specialize for double to help some compilers with template matching.

template<class T >
bool SimTK::readUnformatted ( std::istream &  in,
long double &  v 
)
inline

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

template<class T >
bool SimTK::readUnformatted ( std::istream &  in,
negator< T > &  v 
)
inline

Specialization for negator<T>: read as type T and convert.

template<class T >
bool SimTK::readUnformatted ( std::istream &  in,
std::complex< T > &  v 
)
inline

Specialization for std::complex<T> (two space-separated T's).

template<class T >
bool SimTK::readUnformatted ( std::istream &  in,
conjugate< T > &  v 
)
inline

Specialization for SimTK::conjugate<T> (same as std::complex<T>).

template<>
bool SimTK::readUnformatted< String > ( std::istream &  in,
String v 
)
inline

Specialization for SimTK::String (just read token).

template<int M, class E , int S>
bool readUnformatted ( std::istream &  in,
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>
bool readUnformatted ( std::istream &  in,
Row< N, E, S > &  v 
)
related

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

template<int M, int N, class E , int CS, int RS>
bool readUnformatted ( std::istream &  in,
Mat< M, N, E, CS, RS > &  v 
)
related

Specialize for Mat<M,N,E,CS,RS> delegating to Row<N,E,RS>.

template<int M, class E , int RS>
bool readUnformatted ( std::istream &  in,
SymMat< M, E, RS > &  v 
)
related

Specialize for SymMat<M,E,RS>.

We require the whole matrix, then verify symmetry and assign to the output argument. We'll return false with the fail bit set in the stream if we get a Mat<M,M> but it isn't symmetric to a tight numerical tolerance.

See also
SimTK::SymMat::setFromSymmetric(), SimTK::Mat::isNumericallySymmetric()