3 * Implementation of GiNaC's color indices. */
6 * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 // default constructor, destructor, copy constructor assignment operator and helpers
36 debugmsg("coloridx default constructor",LOGLEVEL_CONSTRUCT);
37 // serial is incremented in idx::idx()
38 name="color"+ToString(serial);
39 tinfo_key=TINFO_coloridx;
44 debugmsg("coloridx destructor",LOGLEVEL_DESTRUCT);
48 coloridx::coloridx(coloridx const & other)
50 debugmsg("coloridx copy constructor",LOGLEVEL_CONSTRUCT);
54 coloridx const & coloridx::operator=(coloridx const & other)
56 debugmsg("coloridx operator=",LOGLEVEL_ASSIGNMENT);
66 void coloridx::copy(coloridx const & other)
71 void coloridx::destroy(bool call_parent)
73 if (call_parent) idx::destroy(call_parent);
82 coloridx::coloridx(bool cov) : idx(cov)
84 debugmsg("coloridx constructor from bool",LOGLEVEL_CONSTRUCT);
85 // serial is incremented in idx::idx(bool)
86 name="color"+ToString(serial);
87 tinfo_key=TINFO_coloridx;
90 coloridx::coloridx(string const & n, bool cov) : idx(n,cov)
92 debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT);
93 tinfo_key=TINFO_coloridx;
96 coloridx::coloridx(char const * n, bool cov) : idx(n,cov)
98 debugmsg("coloridx constructor from char*,bool",LOGLEVEL_CONSTRUCT);
99 tinfo_key=TINFO_coloridx;
102 coloridx::coloridx(unsigned const v, bool cov) : idx(v,cov)
104 debugmsg("coloridx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT);
105 tinfo_key=TINFO_coloridx;
109 // functions overriding virtual functions from bases classes
114 basic * coloridx::duplicate() const
116 debugmsg("coloridx duplicate",LOGLEVEL_DUPLICATE);
117 return new coloridx(*this);
120 void coloridx::printraw(ostream & os) const
122 debugmsg("coloridx printraw",LOGLEVEL_PRINT);
127 os << "symbolic,name=" << name;
129 os << "non symbolic,value=" << value;
135 os << ",contravariant";
138 os << ",serial=" << serial;
139 os << ",hash=" << hashvalue << ",flags=" << flags;
143 void coloridx::printtree(ostream & os, unsigned indent) const
145 debugmsg("coloridx printtree",LOGLEVEL_PRINT);
147 os << string(indent,' ') << "coloridx: ";
150 os << "symbolic,name=" << name;
152 os << "non symbolic,value=" << value;
158 os << ",contravariant";
161 os << ", serial=" << serial
162 << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
163 << ", flags=" << flags << endl;
166 void coloridx::print(ostream & os, unsigned upper_precedence) const
168 debugmsg("coloridx print",LOGLEVEL_PRINT);
182 bool coloridx::info(unsigned inf) const
184 if (inf==info_flags::coloridx) return true;
185 return idx::info(inf);
189 // new virtual functions which can be overridden by derived classes
195 // non-virtual functions in this class
201 // static member variables
210 const coloridx some_coloridx;
211 type_info const & typeid_coloridx=typeid(some_coloridx);