]> www.ginac.de Git - ginac.git/blobdiff - ginac/color.h
#ifndef around namespace GiNaC { }
[ginac.git] / ginac / color.h
index 266496b2cd1fa94bc868437103393b6508e50582..f72034d8a3a8382546c6f82349b5c5d7b7938af5 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
+#ifndef NO_GINAC_NAMESPACE
+namespace GiNaC {
+#endif // ndef NO_GINAC_NAMESPACE
+
+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 +130,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);
@@ -152,6 +164,8 @@ ex brute_force_sum_color_indices(ex const & e);
 
 void append_exvector_to_exvector(exvector & dest, exvector const & source);
 
-#endif // ndef __GINAC_COLOR_H__
-
+#ifndef NO_GINAC_NAMESPACE
+} // namespace GiNaC
+#endif // ndef NO_GINAC_NAMESPACE
 
+#endif // ndef __GINAC_COLOR_H__