]> www.ginac.de Git - ginac.git/blobdiff - ginac/symbol.h
- introduced info_flags::cinteger, info_flags::crational,
[ginac.git] / ginac / symbol.h
index ade8d776d8a56312012e0de9f80ccf62a0f04384..21c004c906143932ffda5e5a337754794d96e103 100644 (file)
 #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.
@@ -63,9 +67,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;
@@ -109,9 +113,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)
@@ -123,4 +129,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__