]> www.ginac.de Git - ginac.git/blobdiff - ginac/symbol.h
- changed old-style power() to new-style pow()
[ginac.git] / ginac / symbol.h
index 5bd60159dd9553fab62a027f8d221dbb23056c72..d633a473c3812965bc08cb6f2909d3792085b0a0 100644 (file)
@@ -1,8 +1,9 @@
 /** @file symbol.h
  *
- *  Interface to GiNaC's symbolic objects.
- *
- *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
+ *  Interface to GiNaC's symbolic objects. */
+
+/*
+ *  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/basic.h>
 #include <ginac/ex.h>
 
+#ifndef NO_GINAC_NAMESPACE
+namespace GiNaC {
+#endif // ndef NO_GINAC_NAMESPACE
+
 /** Basic CAS symbol.  It has a name because it must know how to output itself.
  *  It may be assigned an expression, but this feature is only intended for
  *  programs like 'ginsh' that want to associate symbols with expressions.
  *  first place. */
 class symbol : public basic
 {
+    GINAC_DECLARE_REGISTERED_CLASS(symbol, basic)
+
 // types
+
     /** Symbols as keys to expressions. */
     class assigned_ex_info {
     public:
@@ -62,9 +70,9 @@ public:
     // functions overriding virtual functions from base classes
 public:
     basic * duplicate() const;
+    void print(ostream & os, unsigned upper_precedence=0) const;
     void printraw(ostream & os) const;
     void printtree(ostream & os, unsigned indent) const;
-    void print(ostream & os, unsigned upper_precedence=0) const;
     void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
     bool info(unsigned inf) const;
     ex expand(unsigned options=0) const;
@@ -74,6 +82,7 @@ public:
     ex coeff(symbol const & s, int const n = 1) const;
     ex eval(int level = 0) const;
     ex diff(symbol const & s) const;
+    ex series(symbol const & s, ex const & point, int order) const;
     ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
     ex subs(lst const & ls, lst const & lr) const;
 protected:
@@ -108,9 +117,11 @@ private:
 extern const symbol some_symbol;
 extern type_info const & typeid_symbol;
 
-// macros
-
-#define ex_to_symbol(X) static_cast<symbol const &>(*(X).bp)
+// utility functions
+inline const symbol &ex_to_symbol(const ex &e)
+{
+       return static_cast<const symbol &>(*e.bp);
+}
 
 // wrapper functions around member functions
 inline void unassign(symbol & symarg)
@@ -122,4 +133,8 @@ inline int degree(symbol const & a, symbol const & s)
 inline int ldegree(symbol const & a, symbol const & s)
 { return a.ldegree(s); }
 
+#ifndef NO_GINAC_NAMESPACE
+} // namespace GiNaC
+#endif // ndef NO_GINAC_NAMESPACE
+
 #endif // ndef __GINAC_SYMBOL_H__