14 #ifndef _OM_SERIALIZABLE_MATRIX_H_
15 #define _OM_SERIALIZABLE_MATRIX_H_
17 #include <MDSTk\Math\mdsMatrix.h>
18 #include <OpenMesh\Core\Utils\BaseProperty.hh>
28 class OMSerializableMatrix :
public Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Eigen::AutoAlign>
37 OMSerializableMatrix(
int nRows,
int nCols) : Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Eigen::AutoAlign>()
45 OMSerializableMatrix() : Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Eigen::AutoAlign>()
58 template <
class T>
struct binary<OMToolkit::Types::OMSerializableMatrix<T>>
68 static const bool is_streamable =
true;
74 static size_t size_of(
void)
84 return _v.size() *
sizeof(T) + 2 *
sizeof(
int);
95 bytes =
IO::store( _os, _v.rows(), _swap);
96 bytes +=
IO::store( _os, _v.cols(), _swap);
97 for (
int i = 0; i < size; ++i)
99 return _os.good() ? bytes : 0;
112 _v.resize(rows, cols);
113 unsigned int size = rows * cols;
115 for (
unsigned int i = 0; i < size && _is.good(); ++i)
117 return _is.good() ? bytes : 0;
123 #endif //_OM_SERIALIZABLE_MATRIX_H_