3 * Implementation of GiNaC's color indices. */
6 * GiNaC Copyright (C) 1999-2000 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 #ifndef NO_GINAC_NAMESPACE
31 #endif // ndef NO_GINAC_NAMESPACE
34 // default constructor, destructor, copy constructor assignment operator and helpers
41 debugmsg("coloridx default constructor",LOGLEVEL_CONSTRUCT);
42 // serial is incremented in idx::idx()
43 name="color"+ToString(serial);
44 tinfo_key=TINFO_coloridx;
49 debugmsg("coloridx destructor",LOGLEVEL_DESTRUCT);
53 coloridx::coloridx(coloridx const & other)
55 debugmsg("coloridx copy constructor",LOGLEVEL_CONSTRUCT);
59 coloridx const & coloridx::operator=(coloridx const & other)
61 debugmsg("coloridx operator=",LOGLEVEL_ASSIGNMENT);
71 void coloridx::copy(coloridx const & other)
76 void coloridx::destroy(bool call_parent)
78 if (call_parent) idx::destroy(call_parent);
87 coloridx::coloridx(bool cov) : idx(cov)
89 debugmsg("coloridx constructor from bool",LOGLEVEL_CONSTRUCT);
90 // serial is incremented in idx::idx(bool)
91 name="color"+ToString(serial);
92 tinfo_key=TINFO_coloridx;
95 coloridx::coloridx(string const & n, bool cov) : idx(n,cov)
97 debugmsg("coloridx constructor from string,bool",LOGLEVEL_CONSTRUCT);
98 tinfo_key=TINFO_coloridx;
101 coloridx::coloridx(char const * n, bool cov) : idx(n,cov)
103 debugmsg("coloridx constructor from char*,bool",LOGLEVEL_CONSTRUCT);
104 tinfo_key=TINFO_coloridx;
107 coloridx::coloridx(unsigned const v, bool cov) : idx(v,cov)
109 debugmsg("coloridx constructor from unsigned,bool",LOGLEVEL_CONSTRUCT);
110 tinfo_key=TINFO_coloridx;
114 // functions overriding virtual functions from bases classes
119 basic * coloridx::duplicate() const
121 debugmsg("coloridx duplicate",LOGLEVEL_DUPLICATE);
122 return new coloridx(*this);
125 void coloridx::printraw(ostream & os) const
127 debugmsg("coloridx printraw",LOGLEVEL_PRINT);
132 os << "symbolic,name=" << name;
134 os << "non symbolic,value=" << value;
140 os << ",contravariant";
143 os << ",serial=" << serial;
144 os << ",hash=" << hashvalue << ",flags=" << flags;
148 void coloridx::printtree(ostream & os, unsigned indent) const
150 debugmsg("coloridx printtree",LOGLEVEL_PRINT);
152 os << string(indent,' ') << "coloridx: ";
155 os << "symbolic,name=" << name;
157 os << "non symbolic,value=" << value;
163 os << ",contravariant";
166 os << ", serial=" << serial
167 << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
168 << ", flags=" << flags << endl;
171 void coloridx::print(ostream & os, unsigned upper_precedence) const
173 debugmsg("coloridx print",LOGLEVEL_PRINT);
187 bool coloridx::info(unsigned inf) const
189 if (inf==info_flags::coloridx) return true;
190 return idx::info(inf);
194 // new virtual functions which can be overridden by derived classes
200 // non-virtual functions in this class
206 // static member variables
215 const coloridx some_coloridx;
216 type_info const & typeid_coloridx=typeid(some_coloridx);
218 #ifndef NO_GINAC_NAMESPACE
220 #endif // ndef NO_GINAC_NAMESPACE