PolyBoRi
|
00001 // -*- c++ -*- 00002 //***************************************************************************** 00014 //***************************************************************************** 00015 00016 // include basic definitions 00017 #include "pbori_defs.h" 00018 00019 // get functionals and algorithms 00020 #include "pbori_func.h" 00021 #include "pbori_algo.h" 00022 00023 #include "CStringLiteral.h" 00024 #include "CPrintOperation.h" 00025 00026 00027 00028 #ifndef CIdxVariable_h_ 00029 #define CIdxVariable_h_ 00030 00036 BEGIN_NAMESPACE_PBORI 00037 00038 template <class IdxType = CTypes::idx_type, 00039 class VarNameLit = 00040 CStringLiteral<CLiteralCodes::default_variable_name>, 00041 class VarHeadLit = 00042 CStringLiteral<CLiteralCodes::variable_head>, 00043 class VarTailLit = 00044 CStringLiteral<CLiteralCodes::variable_tail> > 00045 class CIdxVariable { 00046 00047 public: 00049 00050 typedef IdxType idx_type; 00051 typedef CTypes::ostream_type ostream_type; 00053 00055 typedef CIdxVariable<idx_type, VarNameLit, VarHeadLit, VarTailLit> self; 00056 00058 CIdxVariable(idx_type idx_ = 0): idx(idx_) {}; 00059 00061 CIdxVariable(const self& rhs): idx(rhs.idx) {}; 00062 00064 ~CIdxVariable() {}; 00065 00067 ostream_type& print(ostream_type& os) const { 00068 00069 os << VarNameLit()() << VarHeadLit()() << idx << VarTailLit()(); 00070 00071 return os; 00072 } 00073 00074 protected: 00075 idx_type idx; 00076 }; 00077 00079 template <class IdxType, class VarNameLit, class VarHeadLit, class VarTailLit> 00080 inline typename 00081 CIdxVariable<IdxType, VarNameLit, VarHeadLit, VarTailLit>::ostream_type& 00082 operator<<(typename CIdxVariable<IdxType, 00083 VarNameLit, VarHeadLit, VarTailLit>::ostream_type& os, 00084 const CIdxVariable<IdxType, 00085 VarNameLit, VarHeadLit, VarTailLit>& storage){ 00086 00087 return storage.print(os); 00088 } 00089 00090 END_NAMESPACE_PBORI 00091 00092 #endif