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 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:1126
RS is total spacing between rows in memory (default 1)
Definition: SymMat.h:71
SimTK::conjugate<R> should be instantiated only for float, double, long double.
Definition: String.h:45
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<M,E,S> to delegate to element type E, with spaces separating the elements...
Definition: Serialize.h:246
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:301
negator<N>, where N is a number type (real, complex, conjugate), is represented in memory identically...
Definition: String.h:44
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<M,E,RS>.
Definition: Serialize.h:275
bool readUnformatted(std::istream &in, VectorView_< E > &v)
Read fixed-size VectorView from input stream.
Definition: BigMatrix.h:3325
This is a fixed length column vector designed for no-overhead inline computation. ...
Definition: Vec.h:131
bool readOneTokenUnformatted(std::istream &in, String &token)
Read in the next whitespace-delimited token as a String, ignoring leading whitespace.
Definition: Serialize.h:171
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>.
Definition: Serialize.h:262
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
Generic Row.
Definition: Row.h:118
Mandatory first inclusion for any Simbody source or header file.
const negator< float > & imag(const conjugate< float > &c)
Definition: conjugate.h:772
This class represents a small matrix whose size is known at compile time, containing elements of any ...
Definition: Mat.h:51
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 ...
Definition: Serialize.h:256
bool readUnformatted< String >(std::istream &in, String &v)
Specialization for SimTK::String (just read token).
Definition: Serialize.h:238