]> www.ginac.de Git - ginac.git/blobdiff - ginac/ncmul.h
- implemented global class registry (for class basic and derived classes)
[ginac.git] / ginac / ncmul.h
index 5a8b732b3846b3f070a3d19b531a4deaa62fb9c5..10477938504795cc7390861e07191b5cc09ea278 100644 (file)
@@ -1,8 +1,9 @@
 /** @file ncmul.h
  *
- *  Interface to GiNaC's non-commutative products of expressions.
- *
- *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
+ *  Interface to GiNaC's non-commutative products of expressions. */
+
+/*
+ *  GiNaC Copyright (C) 1999-2000 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
 
 #include <ginac/exprseq.h>
 
+#ifndef NO_GINAC_NAMESPACE
+namespace GiNaC {
+#endif // ndef NO_GINAC_NAMESPACE
+
 /** Non-commutative product of expressions. */
 class ncmul : public exprseq
 {
+    GINAC_DECLARE_REGISTERED_CLASS(ncmul, exprseq)
+
     friend class power;
     friend ex nonsimplified_ncmul(exvector const & v);
     friend ex simplified_ncmul(exvector const & v);
@@ -59,8 +66,8 @@ public:
     // functions overriding virtual functions from bases classes
 public:
     basic * duplicate() const;
-    void printraw(ostream & os) const;
     void print(ostream & os, unsigned upper_precedence) const;
+    void printraw(ostream & os) const;
     void printcsrc(ostream & os, unsigned upper_precedence) const;
     bool info(unsigned inf) const;
     int degree(symbol const & s) const;
@@ -105,7 +112,14 @@ extern type_info const & typeid_ncmul;
 ex nonsimplified_ncmul(exvector const & v);
 ex simplified_ncmul(exvector const & v);
 
-#define ex_to_ncmul(X) static_cast<ncmul const &>(*(X).bp)
+// utility functions
+inline const ncmul &ex_to_ncmul(const ex &e)
+{
+       return static_cast <const ncmul &>(*e.bp);
+}
+
+#ifndef NO_GINAC_NAMESPACE
+} // namespace GiNaC
+#endif // ndef NO_GINAC_NAMESPACE
 
 #endif // ndef __GINAC_NCMUL_H__
-