00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 #ifndef TVMET_XPR_MATRIX_COL_H
00025 #define TVMET_XPR_MATRIX_COL_H
00026 
00027 namespace tvmet {
00028 
00029 
00034 template<class E, std::size_t Rows, std::size_t Cols>
00035 class XprMatrixCol
00036   : public TvmetBase< XprMatrixCol<E, Rows, Cols> >
00037 {
00038   XprMatrixCol();
00039   XprMatrixCol& operator=(const XprMatrixCol&);
00040 
00041 public:
00042   typedef typename E::value_type      value_type;
00043 
00044 public:
00046   enum {
00047     ops_expr  = E::ops,
00048     ops       = ops_expr/Cols 
00049   };
00050 
00051 public:
00053   explicit XprMatrixCol(const E& e, std::size_t no)
00054     : m_expr(e), m_col(no)
00055   {
00056     TVMET_RT_CONDITION(no < Cols, "XprMatrixCol Bounce Violation")
00057   }
00058 
00060 #if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR)
00061   XprMatrixCol(const XprMatrixCol& e)
00062     : m_expr(e.m_expr), m_col(e.m_col)
00063   { }
00064 #endif
00065 
00066   value_type operator()(std::size_t i) const {
00067     TVMET_RT_CONDITION(i < Rows, "XprMatrixCol Bounce Violation")
00068     return m_expr(i, m_col);
00069   }
00070 
00071 public: 
00072   void print_xpr(std::ostream& os, std::size_t l=0) const {
00073     os << IndentLevel(l++)
00074        << "XprMatrixCol[O=" << ops << ", (O=" << ops_expr << ")]<"
00075        << std::endl;
00076     m_expr.print_xpr(os, l);
00077     os << IndentLevel(l)
00078        << "R=" << Rows << ", C=" << Cols << std::endl
00079        << IndentLevel(--l) << ">"
00080        << ((l != 0) ? "," : "") << std::endl;
00081   }
00082 
00083 private:
00084   const E           m_expr;
00085   const std::size_t         m_col;
00086 };
00087 
00088 
00089 }
00090 
00091 #endif // TVMET_XPR_MATRIX_COL_H
00092 
00093 
00094 
00095 
00096