Simbody  3.7
Serialize.h File Reference

This file contains definitions of templatized serialize-to-stream methods specialized for the built-in C++ and SimTK low-level classes. More...

Go to the source code of this file.

Namespaces

 SimTK
 This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with other symbols.
 

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...
 
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, 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<class T >
void SimTK::writeFormatted (std::ostream &o, const T &v)
 The default implementation of writeFormatted<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 >
bool SimTK::readFormatted (std::istream &in, T &v)
 The default implementation of readFormatted<T>() uses readUnformatted<T>(). More...
 

Detailed Description

This file contains definitions of templatized serialize-to-stream methods specialized for the built-in C++ and SimTK low-level classes.

These are used to provide the concrete level of recursively-defined methods for serialization of container classes (Array_, Vector_, Vec, Mat, etc.) each of which should define templatized methods of the same names that serialize using the same serialization method applied to their elements. Methods are provided for different kinds of formatting; at the concrete level these are likely to be identical but they differ for containers. Unformatted output will write just space separated elements, while formatted output may write surrounding parentheses or brackets, comma separators, or whatever else might be appropriate.