3 * Implementation of GiNaC's color indices. */
11 // default constructor, destructor, copy constructor assignment operator and helpers
18 debugmsg("coloridx default constructor",LOGLEVEL_CONSTRUCT);
19 // serial is incremented in idx::idx()
20 name="color"+ToString(serial);
21 tinfo_key=TINFO_COLORIDX;
26 debugmsg("coloridx destructor",LOGLEVEL_DESTRUCT);
30 coloridx::coloridx(coloridx const & other)
32 debugmsg("coloridx copy constructor",LOGLEVEL_CONSTRUCT);
36 coloridx const & coloridx::operator=(coloridx const & other)
38 debugmsg("coloridx operator=",LOGLEVEL_ASSIGNMENT);
48 void coloridx::copy(coloridx const & other)
53 void coloridx::destroy(bool call_parent)
55 if (call_parent) idx::destroy(call_parent);
64 coloridx::coloridx(bool cov) : idx(cov)
66 debugmsg("coloridx constructor from bool",LOGLEVEL_CONSTRUCT);
67 // serial is incremented in idx::idx(bool)
68 name="color"+ToString(serial);
69 tinfo_key=TINFO_COLORIDX;
72 coloridx::coloridx(string const & n, bool cov) : idx(n,cov)
74 debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT);
75 tinfo_key=TINFO_COLORIDX;
78 coloridx::coloridx(char const * n, bool cov) : idx(n,cov)
80 debugmsg("coloridx constructor from char*,bool",LOGLEVEL_CONSTRUCT);
81 tinfo_key=TINFO_COLORIDX;
84 coloridx::coloridx(unsigned const v, bool cov) : idx(v,cov)
86 debugmsg("coloridx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT);
87 tinfo_key=TINFO_COLORIDX;
91 // functions overriding virtual functions from bases classes
96 basic * coloridx::duplicate() const
98 debugmsg("coloridx duplicate",LOGLEVEL_DUPLICATE);
99 return new coloridx(*this);
102 void coloridx::printraw(ostream & os) const
104 debugmsg("coloridx printraw",LOGLEVEL_PRINT);
109 os << "symbolic,name=" << name;
111 os << "non symbolic,value=" << value;
117 os << ",contravariant";
120 os << ",serial=" << serial;
121 os << ",hash=" << hashvalue << ",flags=" << flags;
125 void coloridx::printtree(ostream & os, unsigned indent) const
127 debugmsg("coloridx printtree",LOGLEVEL_PRINT);
129 os << string(indent,' ') << "coloridx: ";
132 os << "symbolic,name=" << name;
134 os << "non symbolic,value=" << value;
140 os << ",contravariant";
143 os << ", serial=" << serial
144 << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
145 << ", flags=" << flags << endl;
148 void coloridx::print(ostream & os, unsigned upper_precedence) const
150 debugmsg("coloridx print",LOGLEVEL_PRINT);
164 bool coloridx::info(unsigned inf) const
166 if (inf==info_flags::coloridx) return true;
167 return idx::info(inf);
171 // new virtual functions which can be overridden by derived classes
177 // non-virtual functions in this class
183 // static member variables
192 const coloridx some_coloridx;
193 type_info const & typeid_coloridx=typeid(some_coloridx);