X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fcolor.h;h=a6f8ea599e7b3a2ea709e42040b57c2345f860e0;hp=877e7de5f9cf2f1fb8490bf4eb9c73262791021e;hb=9eab44408b9213d8909b7a9e525f404ad06064dd;hpb=487e5659efe401683eee0381b0d23f967ffffc3c;ds=inline diff --git a/ginac/color.h b/ginac/color.h index 877e7de5..a6f8ea59 100644 --- a/ginac/color.h +++ b/ginac/color.h @@ -26,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 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 @@ -125,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); @@ -153,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__