00001 // This is core/vnl/xio/vnl_xio_vector.h 00002 #ifndef vnl_xio_vector_h 00003 #define vnl_xio_vector_h 00004 //: 00005 // \file 00006 // \brief XML write a vnl_vector 00007 // Two functions which write a valid XML fragment to an ostream. 00008 // The vector length is output as an attribute 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 2-level XML fragment: one top element node, 00012 // and one level below it for the individual vector elements 00013 // (element nodes named "element" with a single value each). 00014 // The name of the top node can be chosen; by default, it is "vnl_vector". 00015 // \author Gamze Tunali 00016 // \date 30-Dec-2005 00017 // \verbatim 00018 // Modifications 00019 // 29 July 2011 - Peter Vanroose - added documentation, tests, and x_write_tree() 00020 // \endverbatim 00021 00022 #include <vnl/vnl_vector.h> 00023 #include <vcl_string.h> 00024 #include <vcl_iosfwd.h> 00025 00026 //: XML save vnl_vector to stream. 00027 // \relatesalso vnl_vector 00028 template <class T> 00029 void x_write(vcl_ostream & os, vnl_vector<T> const& v, 00030 vcl_string name="vnl_vector"); 00031 00032 //: XML save vnl_vector as a 2-level tree to stream. 00033 // \relatesalso vnl_vector 00034 template <class T> 00035 void x_write_tree(vcl_ostream & os, vnl_vector<T> const& v, 00036 vcl_string name="vnl_vector"); 00037 00038 #define VNL_XIO_VECTOR_INSTANTIATE(T) extern "Please #include <vnl/xio/vnl_xio_vector.txx> first" 00039 00040 #endif // vnl_xio_vector_h