00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00030 #ifdef _MSC_VER
00031 #pragma once
00032 #endif // _MSC_VER
00033
00034 #ifndef _EXMAT_EXPINFO_H
00035 #define _EXMAT_EXPINFO_H
00036
00037 #include <iostream>
00038 #include "ExpTmp.h"
00039
00040 namespace exmat {
00041
00042 template<class EXP>
00043 class ExpInfo {
00044 public:
00045 ExpInfo(const EXP& exp_) : exp(exp_) {}
00046 private:
00047 const EXP& exp;
00048 };
00049
00050 template<class EXP>
00051 void printExpInfo(const EXP& exp) {
00052 using std::cout;
00053 using std::endl;
00054
00055 enum {
00056 IsScalar = HasTagOf<EXP,ScalarTag>::RET,
00057 IsRowVec = (EXP::ROWS == 1),
00058 IsColVec = (EXP::COLS == 1),
00059 IsRowStatic = (EXP::ROWS > 0),
00060 IsColStatic = (EXP::COLS > 0),
00061 IsRowMajor = HasTagOf<EXP,RowMajorTag>::RET,
00062 IsColMajor = HasTagOf<EXP,ColMajorTag>::RET
00063 };
00064
00065 typedef typename EXP::ErrChecker ErrChecker;
00066 cout << "Error checker: " << (
00067 ISSAMETYPE<ErrChecker, EmptyErrorChecker>::RET ? "EmptyErrorChecker" :
00068 ISSAMETYPE<ErrChecker, DefaultErrorChecker>::RET ? "DefaultErrorChecker" :
00069 "FullErrorChecker"
00070 )<< endl;
00071 if(IsRowVec) cout << "It's a row vector\n";
00072 else if(IsColVec) cout << "It's a column vector\n";
00073 cout << "Rows: " << (IsRowStatic ? "static, " : "dynamic, ") << exp.rows() << endl;
00074 cout << "Cols: " << (IsColStatic ? "static, " : "dynamic, ") << exp.cols() << endl;
00075 cout << "TNOP: " << EXP::TNOP << endl;
00076
00077 if(IsRowMajor)
00078 cout << "It's row major\n";
00079 if(IsColMajor)
00080 cout << "It's row major\n";
00081
00082
00083 }
00084
00085 };
00086
00087
00088
00089
00090 template<class EXP>
00091 std::ostream& operator<<(std::ostream &os, const exmat::ExpInfo<EXP>& expinfo) {
00092 return os;
00093 }
00094
00095 #endif // _EXMAT_EXPINFO_H