PolyBoRi
CIdxVariable.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
31 //*****************************************************************************
32 
33 // include basic definitions
34 #include "pbori_defs.h"
35 
36 // get functionals and algorithms
37 #include "pbori_func.h"
38 #include "pbori_algo.h"
39 
40 #include "CStringLiteral.h"
41 #include "CPrintOperation.h"
42 
43 
44 
45 #ifndef CIdxVariable_h_
46 #define CIdxVariable_h_
47 
54 
55 template <class IdxType = CTypes::idx_type,
56  class VarNameLit =
57  CStringLiteral<CLiteralCodes::default_variable_name>,
58  class VarHeadLit =
59  CStringLiteral<CLiteralCodes::variable_head>,
60  class VarTailLit =
61  CStringLiteral<CLiteralCodes::variable_tail> >
62 class CIdxVariable {
63 
64 public:
66 
67  typedef IdxType idx_type;
70 
73 
75  CIdxVariable(idx_type idx_ = 0): idx(idx_) {};
76 
78  CIdxVariable(const self& rhs): idx(rhs.idx) {};
79 
82 
85 
86  os << VarNameLit()() << VarHeadLit()() << idx << VarTailLit()();
87 
88  return os;
89  }
90 
91 protected:
93 };
94 
96 template <class IdxType, class VarNameLit, class VarHeadLit, class VarTailLit>
97 inline typename
99 operator<<(typename CIdxVariable<IdxType,
100  VarNameLit, VarHeadLit, VarTailLit>::ostream_type& os,
101  const CIdxVariable<IdxType,
102  VarNameLit, VarHeadLit, VarTailLit>& storage){
103 
104  return storage.print(os);
105 }
106 
108 
109 #endif