1 #ifndef SimTK_SimTKCOMMON_SERIALIZE_H_
2 #define SimTK_SimTKCOMMON_SERIALIZE_H_
74 template <
class T>
inline void
80 template <
class T>
inline void
82 { writeUnformatted<float>(o,v); }
84 template <
class T>
inline void
86 { writeUnformatted<double>(o,v); }
89 template <
class T>
inline void
91 { writeUnformatted<long double>(o,v); }
94 template <
class T>
inline void
100 template <
class T>
inline void
105 template <
class T>
inline void
113 template <
int M,
class E,
int S>
inline void
115 for (
int i=0; i < M; ++i) {
116 if (i != 0) o <<
" ";
123 template <
int N,
class E,
int S>
inline void
130 template <
int M,
int N,
class E,
int CS,
int RS>
inline void
132 for (
int i=0; i < M; ++i) {
133 if (i != 0) o << std::endl;
141 template <
int M,
class E,
int RS>
inline void
143 for (
int i=0; i < M; ++i) {
144 if (i != 0) o << std::endl;
173 if (!in.good()) {in.setstate(std::ios::failbit);
return false;}
176 if (!in.good()) {in.setstate(std::ios::failbit);
return false;}
177 in >> token;
if (in.fail())
return false;
178 if (token.empty()) {in.setstate(std::ios_base::failbit);
return false;}
187 template <
class T>
inline bool
192 { in.setstate(std::ios::failbit);
return false; }
197 template <
class T>
inline bool
199 {
return readUnformatted<float>(in,v); }
201 template <
class T>
inline bool
203 {
return readUnformatted<double>(in,v); }
206 template <
class T>
inline bool
208 {
return readUnformatted<long double>(in,v); }
211 template <
class T>
inline bool
219 template <
class T>
inline bool
229 template <
class T>
inline bool
237 template <>
inline bool
245 template <
int M,
class E,
int S>
inline bool
247 for (
int i=0; i < M; ++i)
255 template <
int N,
class E,
int S>
inline bool
261 template <
int M,
int N,
class E,
int CS,
int RS>
inline bool
263 for (
int i=0; i < M; ++i)
274 template <
int M,
class E,
int RS>
inline bool
278 in.setstate(std::ios::failbit);
311 template <
class T>
inline void
334 template <
class T>
inline bool
346 #endif // SimTK_SimTKCOMMON_SERIALIZE_H_
bool readUnformatted(std::istream &in, T &v)
The default implementation of readUnformatted reads in the next whitespace-separated token and the...
Definition: Serialize.h:188
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
bool tryConvertTo(T &out) const
Attempt to convert this String to an object of type T, returning a status value to indicate success o...
Definition: String.h:421
bool readUnformatted(std::istream &in, Vec< M, E, S > &v)
Specialize for Vec to delegate to element type E, with spaces separating the elements...
Definition: Serialize.h:246
This is a small, fixed-size symmetric or Hermitian matrix designed for no-overhead inline computation...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:592
This file contains macros which are convenient to use for sprinkling error checking around liberally ...
bool readUnformatted(std::istream &in, SymMat< M, E, RS > &v)
Specialize for SymMat.
Definition: Serialize.h:275
bool isNumericallySymmetric(double tol=getDefaultTolerance()) const
A Matrix is symmetric (actually Hermitian) if it is square and each element (i,j) is the Hermitian tr...
Definition: Mat.h:1172
bool readOneTokenUnformatted(std::istream &in, String &token)
Read in the next whitespace-delimited token as a String, ignoring leading whitespace.
Definition: Serialize.h:171
negator, where N is a number type (real, complex, conjugate), is represented in memory identically...
Definition: String.h:44
This is a fixed-length row vector designed for no-overhead inline computation.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:590
bool readUnformatted(std::istream &in, Mat< M, N, E, CS, RS > &v)
Specialize for Mat delegating to Row.
Definition: Serialize.h:262
SymMat & setFromSymmetric(const Mat< M, M, EE, CSS, RSS > &m)
Create a new SymMat of this type from a square Mat of the right size, that is expected to be symmetri...
Definition: SymMat.h:317
const float & real(const conjugate< float > &c)
Definition: conjugate.h:771
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:62
This class represents a small matrix whose size is known at compile time, containing elements of any ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:591
Mandatory first inclusion for any Simbody source or header file.
This is a fixed-length column vector designed for no-overhead inline computation. ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:589
const negator< float > & imag(const conjugate< float > &c)
Definition: conjugate.h:772
SimTK::conjugate should be instantiated only for float, double, long double.
Definition: String.h:45
bool readUnformatted(std::istream &in, Row< N, E, S > &v)
Specialize for Row to delegate to element type E, with spaces separating the elements; format ...
Definition: Serialize.h:256
bool readUnformatted< String >(std::istream &in, String &v)
Specialization for SimTK::String (just read token).
Definition: Serialize.h:238