X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fcolor.h;h=a6f8ea599e7b3a2ea709e42040b57c2345f860e0;hp=3237359ed72257df50dd421971e2296964eb75d7;hb=9eab44408b9213d8909b7a9e525f404ad06064dd;hpb=6b3768e8c544739ae53321539cb4d1e3112ded1b diff --git a/ginac/color.h b/ginac/color.h index 3237359e..a6f8ea59 100644 --- a/ginac/color.h +++ b/ginac/color.h @@ -2,19 +2,37 @@ * * Interface to GiNaC's color objects. */ -#ifndef _COLOR_H_ -#define _COLOR_H_ +/* + * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __GINAC_COLOR_H__ +#define __GINAC_COLOR_H__ #include #include +#include +#include -class color; +namespace GiNaC { -#include "indexed.h" - -#define MAX_REPRESENTATION_LABELS 4 -#define COLOR_EIGHT 8 // N*N-1 -#define COLOR_THREE 3 // N +const int MAX_REPRESENTATION_LABELS = 4; +const int COLOR_EIGHT = 8; // N*N-1 +const int COLOR_THREE = 3; // N /** Base class for color object */ class color : public indexed @@ -110,10 +128,16 @@ protected: extern const color some_color; extern type_info const & typeid_color; -// macros +// global functions +inline const color &ex_to_color(const ex &e) +{ + return static_cast(*e.bp); +} -#define ex_to_color(X) static_cast(*(X).bp) -#define ex_to_nonconst_color(X) static_cast(*(X).bp) +inline color &ex_to_nonconst_color(const ex &e) +{ + return static_cast(*e.bp); +} color color_ONE(unsigned const rl=0); color color_T(ex const & a, unsigned const rl=0); @@ -138,6 +162,6 @@ ex brute_force_sum_color_indices(ex const & e); void append_exvector_to_exvector(exvector & dest, exvector const & source); -#endif // ndef _COLOR_H_ - +} // namespace GiNaC +#endif // ndef __GINAC_COLOR_H__