core/vnl/xio/vnl_xio_matrix.h
Go to the documentation of this file.
00001 // This is core/vnl/xio/vnl_xio_matrix.h
00002 #ifndef vnl_xio_matrix_h
00003 #define vnl_xio_matrix_h
00004 //:
00005 // \file
00006 // \brief XML write a vnl_matrix
00007 //  Two functions which write a valid XML fragment to an ostream.
00008 //  The matrix dimensions are output as attributes of the (top) node.
00009 // - x_write() writes a single XML element node with text content only:
00010 //             space-separated coordinates.
00011 // - x_write_tree() writes a 3-level XML fragment: one top element node,
00012 //                  one level below it for the matrix rows, and one level
00013 //                  below that with the individual matrix elements (element
00014 //                  nodes with a single value each).
00015 //  The name of the top node can be chosen; by default, it is "vnl_matrix".
00016 //  The names of the intermediate nodes are "row" and "cell", respectively.
00017 // \author Peter Vanroose
00018 // \date 29 July 2011
00019 // \verbatim
00020 //  Modifications
00021 //   <none yet>
00022 // \endverbatim
00023 
00024 #include <vnl/vnl_matrix.h>
00025 #include <vcl_string.h>
00026 #include <vcl_iosfwd.h>
00027 
00028 //: XML save vnl_matrix to stream.
00029 // \relatesalso vnl_matrix
00030 template <class T>
00031 void x_write(vcl_ostream & os, vnl_matrix<T> const& v,
00032              vcl_string name="vnl_matrix");
00033 
00034 //: XML save vnl_matrix as a 3-level tree to stream.
00035 // \relatesalso vnl_matrix
00036 template <class T>
00037 void x_write_tree(vcl_ostream & os, vnl_matrix<T> const& v,
00038                   vcl_string name="vnl_matrix");
00039 
00040 #define VNL_XIO_MATRIX_INSTANTIATE(T) extern "Please #include <vnl/xio/vnl_xio_matrix.txx> first"
00041 
00042 #endif // vnl_xio_matrix_h