]> www.ginac.de Git - ginac.git/blobdiff - ginac/color.h
- put everything in "GiNaC" namespace
[ginac.git] / ginac / color.h
index d900d84f9b22dca82189d027699c49e2ddd79267..a6f8ea599e7b3a2ea709e42040b57c2345f860e0 100644 (file)
@@ -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
 
 #include <string>
 #include <vector>
+#include <ginac/indexed.h>
+#include <ginac/ex.h>
 
-#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
@@ -123,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<const color &>(*e.bp);
+}
 
-#define ex_to_color(X) static_cast<color const &>(*(X).bp)
-#define ex_to_nonconst_color(X) static_cast<color &>(*(X).bp)
+inline color &ex_to_nonconst_color(const ex &e)
+{
+       return static_cast<color &>(*e.bp);
+}
 
 color color_ONE(unsigned const rl=0);
 color color_T(ex const & a, unsigned const rl=0);
@@ -151,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__