X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fcolor.h;h=9967f4517e02082ae4878fc1adbc927aeff41518;hp=266496b2cd1fa94bc868437103393b6508e50582;hb=68c28e9c4381f874acf0cd7a690d36098ac9db23;hpb=66c0f31c678e6c1938d637636b230ea376c157c1 diff --git a/ginac/color.h b/ginac/color.h index 266496b2..9967f451 100644 --- a/ginac/color.h +++ b/ginac/color.h @@ -1,7 +1,8 @@ /** @file color.h * - * Interface to GiNaC's color objects. - * + * Interface to GiNaC's color objects. */ + +/* * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify @@ -25,10 +26,13 @@ #include #include #include +#include -#define MAX_REPRESENTATION_LABELS 4 -#define COLOR_EIGHT 8 // N*N-1 -#define COLOR_THREE 3 // N +namespace GiNaC { + +const unsigned MAX_REPRESENTATION_LABELS = 4; +const unsigned COLOR_EIGHT = 8; // N*N-1 +const unsigned COLOR_THREE = 3; // N /** Base class for color object */ class color : public indexed @@ -124,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); @@ -152,6 +162,6 @@ ex brute_force_sum_color_indices(ex const & e); void append_exvector_to_exvector(exvector & dest, exvector const & source); -#endif // ndef __GINAC_COLOR_H__ - +} // namespace GiNaC +#endif // ndef __GINAC_COLOR_H__