diff --git a/src_main/core/pivariant.h b/src_main/core/pivariant.h index 643c2008..e25aea97 100755 --- a/src_main/core/pivariant.h +++ b/src_main/core/pivariant.h @@ -28,6 +28,8 @@ #include "pivarianttypes.h" #include "pitime.h" #include "pigeometry.h" +#include "pimathmatrix.h" + #ifndef QNX # define CUSTOM_PIVARIANT diff --git a/src_main/core/pivarianttypes.h b/src_main/core/pivarianttypes.h index 740570aa..1a22682b 100644 --- a/src_main/core/pivarianttypes.h +++ b/src_main/core/pivarianttypes.h @@ -26,7 +26,6 @@ #define PIVARIANTYPES_H #include "pistring.h" -#include "pimathmatrix.h" class PIPropertyStorage; diff --git a/src_main/math/pigeometry.h b/src_main/math/pigeometry.h index 78630762..68f5651f 100644 --- a/src_main/math/pigeometry.h +++ b/src_main/math/pigeometry.h @@ -59,7 +59,7 @@ template PICout operator <<(PICout & s, const PIPoint & v) {s.setControl(0, true); s << "Point{" << v.x << ", " << v.y << "}"; s.restoreControl(); return s;} template -inline PIByteArray & operator <<(PIByteArray & s, PIPoint v) {s << v.x << v.y; return s;} +inline PIByteArray & operator <<(PIByteArray & s, const PIPoint & v) {s << v.x << v.y; return s;} template inline PIByteArray & operator >>(PIByteArray & s, PIPoint & v) {s >> v.x >> v.y; return s;} @@ -144,7 +144,7 @@ template PICout operator <<(PICout & s, const PIRect & v) {s.setControl(0, true); s << "Rect{" << v.x0 << ", " << v.y0 << "; " << v.x1 - v.x0 << ", " << v.y1 - v.y0 << "}"; s.restoreControl(); return s;} template -inline PIByteArray & operator <<(PIByteArray & s, PIRect v) {s << v.x0 << v.x1 << v.y0 << v.y1; return s;} +inline PIByteArray & operator <<(PIByteArray & s, const PIRect & v) {s << v.x0 << v.x1 << v.y0 << v.y1; return s;} template inline PIByteArray & operator >>(PIByteArray & s, PIRect & v) {s >> v.x0 >> v.x1 >> v.y0 >> v.y1; return s;} diff --git a/src_main/math/pimathmatrix.h b/src_main/math/pimathmatrix.h index c7232d8d..f9c3e973 100644 --- a/src_main/math/pimathmatrix.h +++ b/src_main/math/pimathmatrix.h @@ -494,6 +494,12 @@ inline std::ostream & operator <<(std::ostream & s, const PIMathMatrix & m template inline PICout operator <<(PICout s, const PIMathMatrix & m) {s << "Matrix{"; for (uint r = 0; r < m.rows(); ++r) { for (uint c = 0; c < m.cols(); ++c) { s << m.element(r, c); if (c < m.cols() - 1 || r < m.rows() - 1) s << ", ";} if (r < m.rows() - 1) s << PICoutManipulators::NewLine << " ";} s << "}"; return s;} +template +inline PIByteArray & operator <<(PIByteArray & s, const PIMathMatrix & v) {s << (const PIVector2D &)v; return s;} +template +inline PIByteArray & operator >>(PIByteArray & s, PIMathMatrix & v) {s >> (PIVector2D &)v; return s;} + + /// Multiply matrices {CR x Rows0} on {Cols1 x CR}, result is {Cols1 x Rows0} template inline PIMathMatrix operator *(const PIMathMatrix & fm, diff --git a/src_main/math/pimathvector.h b/src_main/math/pimathvector.h index 9c0f3a46..6c3581aa 100644 --- a/src_main/math/pimathvector.h +++ b/src_main/math/pimathvector.h @@ -178,6 +178,8 @@ typedef PIMathVectorT<4u, double> PIMathVectorT4d; template class PIP_EXPORT PIMathVector { typedef PIMathVector _CVector; + template friend PIByteArray & operator <<(PIByteArray & s, const PIMathVector & v); + template friend PIByteArray & operator >>(PIByteArray & s, PIMathVector & v); public: PIMathVector(const uint size = 0) {c.resize(size);} PIMathVector(const PIVector & val) {c.resize(val.size()); PIMV_FOR(i, 0) c[i] = val[i];} @@ -258,9 +260,9 @@ inline std::ostream & operator <<(std::ostream & s, const PIMathVector & v template inline PICout operator <<(PICout s, const PIMathVector & v) {s << "Vector{"; for (uint i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; return s;} -template +template inline PIByteArray & operator <<(PIByteArray & s, const PIMathVector & v) {s << v.c; return s;} -template +template inline PIByteArray & operator >>(PIByteArray & s, PIMathVector & v) {s >> v.c; return s;}