Go to the documentation of this file.00001
00002 #ifndef vbl_sparse_array_1d_h_
00003 #define vbl_sparse_array_1d_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 #include <vbl/vbl_sparse_array_base.h>
00020 #include <vcl_iostream.h>
00021
00022
00023 template <class T>
00024 class vbl_sparse_array_1d: public vbl_sparse_array_base<T, unsigned>
00025 {
00026 public:
00027 typedef typename vbl_sparse_array_base<T,unsigned>::const_iterator const_iterator;
00028
00029
00030 vcl_ostream& print(vcl_ostream& out) const
00031 {
00032 for (const_iterator p = this->begin(); p != this->end(); ++p)
00033 out << '(' << (*p).first << "): " << (*p).second << vcl_endl;
00034 return out;
00035 }
00036 };
00037
00038
00039 template <class T>
00040 inline vcl_ostream& operator<< (vcl_ostream& s, const vbl_sparse_array_1d<T>& a)
00041 {
00042 return a.print(s);
00043 }
00044
00045 #ifndef VBL_SPARSE_ARRAY_BASE_INSTANTIATE
00046 #define VBL_SPARSE_ARRAY_BASE_INSTANTIATE(T) \
00047 extern "please include vbl/vbl_sparse_array_base.txx instead"
00048 #endif // VBL_SPARSE_ARRAY_BASE_INSTANTIATE
00049 #define VBL_SPARSE_ARRAY_1D_INSTANTIATE(T) \
00050 extern "please include vbl/vbl_sparse_array_1d.txx instead"
00051
00052 #endif // vbl_sparse_array_1d_h_