PolyBoRi
|
00001 // -*- c++ -*- 00002 //***************************************************************************** 00031 //***************************************************************************** 00032 00033 // include basic definitions 00034 #include "pbori_defs.h" 00035 00036 // get functionals and algorithms 00037 #include "pbori_func.h" 00038 #include "pbori_algo.h" 00039 00040 #include "CStringLiteral.h" 00041 #include "CPrintOperation.h" 00042 00043 00044 00045 #ifndef CIdxVariable_h_ 00046 #define CIdxVariable_h_ 00047 00053 BEGIN_NAMESPACE_PBORI 00054 00055 template <class IdxType = CTypes::idx_type, 00056 class VarNameLit = 00057 CStringLiteral<CLiteralCodes::default_variable_name>, 00058 class VarHeadLit = 00059 CStringLiteral<CLiteralCodes::variable_head>, 00060 class VarTailLit = 00061 CStringLiteral<CLiteralCodes::variable_tail> > 00062 class CIdxVariable { 00063 00064 public: 00066 00067 typedef IdxType idx_type; 00068 typedef CTypes::ostream_type ostream_type; 00070 00072 typedef CIdxVariable<idx_type, VarNameLit, VarHeadLit, VarTailLit> self; 00073 00075 CIdxVariable(idx_type idx_ = 0): idx(idx_) {}; 00076 00078 CIdxVariable(const self& rhs): idx(rhs.idx) {}; 00079 00081 ~CIdxVariable() {}; 00082 00084 ostream_type& print(ostream_type& os) const { 00085 00086 os << VarNameLit()() << VarHeadLit()() << idx << VarTailLit()(); 00087 00088 return os; 00089 } 00090 00091 protected: 00092 idx_type idx; 00093 }; 00094 00096 template <class IdxType, class VarNameLit, class VarHeadLit, class VarTailLit> 00097 inline typename 00098 CIdxVariable<IdxType, VarNameLit, VarHeadLit, VarTailLit>::ostream_type& 00099 operator<<(typename CIdxVariable<IdxType, 00100 VarNameLit, VarHeadLit, VarTailLit>::ostream_type& os, 00101 const CIdxVariable<IdxType, 00102 VarNameLit, VarHeadLit, VarTailLit>& storage){ 00103 00104 return storage.print(os); 00105 } 00106 00107 END_NAMESPACE_PBORI 00108 00109 #endif