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