Go to the documentation of this file.00001
00002 #ifndef vnl_matlab_print2_h_
00003 #define vnl_matlab_print2_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <vnl/vnl_matlab_print.h>
00031 #include <vcl_iosfwd.h>
00032
00033
00034 template <class T>
00035 struct vnl_matlab_print_proxy
00036 {
00037 T const &obj;
00038 char const *name;
00039 vnl_matlab_print_format format;
00040 vnl_matlab_print_proxy(T const &obj_,
00041 char const *name_,
00042 vnl_matlab_print_format format_)
00043 : obj(obj_), name(name_), format(format_) { }
00044 ~vnl_matlab_print_proxy() { }
00045 };
00046
00047
00048 template <class T>
00049 inline
00050 vcl_ostream &operator<<(vcl_ostream &os, vnl_matlab_print_proxy<T> const &mp)
00051 {
00052 return vnl_matlab_print(os, mp.obj, mp.name, mp.format);
00053 }
00054
00055
00056
00057
00058 template <class T>
00059 inline
00060 vnl_matlab_print_proxy<T>
00061 vnl_matlab_print(T const &obj,
00062 char const *name = 0,
00063 vnl_matlab_print_format format = vnl_matlab_print_format_default)
00064 {
00065 return vnl_matlab_print_proxy<T>(obj, name, format);
00066 }
00067
00068 #define VNL_MATLAB_PRINT2_INSTANTIATE(T) \
00069 template struct vnl_matlab_print_proxy<T >; \
00070 VCL_INSTANTIATE_INLINE(vcl_ostream& \
00071 operator<<(vcl_ostream&, vnl_matlab_print_proxy<T > const&)); \
00072 VCL_INSTANTIATE_INLINE(vnl_matlab_print_proxy<T > \
00073 vnl_matlab_print(T const&, char const*, vnl_matlab_print_format))
00074
00075 #endif // vnl_matlab_print2_h_