]> www.ginac.de Git - ginac.git/blobdiff - ginac/basic.h
- implemented nops() and op() for pseries objects
[ginac.git] / ginac / basic.h
index a0e3f6ed94021f9012118bd3b248c1bd43c161fe..ecf120a111983a734d535ec8f58d86f7d4c42493 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's ABC. */
 
 /*
- *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
+ *  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 <typeinfo>
 #include <vector>
 
+// CINT needs <algorithm> to work properly with <vector> 
+#include <algorithm>
+
 #include <ginac/flags.h>
 #include <ginac/tinfos.h>
 #include <ginac/assertion.h>
+#include <ginac/registrar.h>
 
+#ifndef NO_GINAC_NAMESPACE
 namespace GiNaC {
+#endif // ndef NO_GINAC_NAMESPACE
 
 class basic;
 class ex;
 class symbol;
 class lst;
 class numeric;
+class archive_node;
 
-typedef vector<ex> exvector;
+//typedef vector<ex> exvector;
+typedef vector<ex,malloc_alloc> exvector; // CINT does not like vector<...,default_alloc>
 
 #define INLINE_BASIC_CONSTRUCTORS
 
@@ -47,6 +55,8 @@ typedef vector<ex> exvector;
  *  It is responsible for the reference counting. */
 class basic
 {
+    GINAC_DECLARE_REGISTERED_CLASS(basic, void)
+
     friend class ex;
 
 // member functions
@@ -108,14 +118,14 @@ protected:
     // new virtual functions which can be overridden by derived classes
 public: // only const functions please (may break reference counting)
     virtual basic * duplicate() const;
+    virtual void print(ostream & os,unsigned upper_precedence=0) const;
     virtual void printraw(ostream & os) const;
     virtual void printtree(ostream & os, unsigned indent) const;
-    virtual void print(ostream & os,unsigned upper_precedence=0) const;
     virtual void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
     virtual void dbgprint(void) const;
     virtual void dbgprinttree(void) const;
     virtual bool info(unsigned inf) const;
-    virtual int nops() const;
+    virtual unsigned nops() const;
     virtual ex op(int const i) const;
     virtual ex & let_op(int const i);
     virtual ex operator[](ex const & index) const;
@@ -132,7 +142,7 @@ public: // only const functions please (may break reference counting)
     virtual ex subs(lst const & ls, lst const & lr) const;
     virtual ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
     virtual numeric integer_content(void) const;
-    virtual ex smod(numeric const &xi) const;
+    virtual ex smod(const numeric &xi) const;
     virtual numeric max_coefficient(void) const;
     virtual exvector get_indices(void) const;
     virtual ex simplify_ncmul(exvector const & v) const;
@@ -180,6 +190,8 @@ extern int max_recursion_level;
 
 // convenience macros
 
+#ifndef NO_GINAC_NAMESPACE
+
 #define is_of_type(OBJ,TYPE) \
     (dynamic_cast<TYPE *>(const_cast<GiNaC::basic *>(&OBJ))!=0)
 
@@ -192,6 +204,24 @@ extern int max_recursion_level;
 #define is_ex_exactly_of_type(OBJ,TYPE) \
     ((*(OBJ).bp).tinfo()==GiNaC::TINFO_##TYPE)
 
+#else // ndef NO_GINAC_NAMESPACE
+
+#define is_of_type(OBJ,TYPE) \
+    (dynamic_cast<TYPE *>(const_cast<basic *>(&OBJ))!=0)
+
+#define is_exactly_of_type(OBJ,TYPE) \
+    ((OBJ).tinfo()==TINFO_##TYPE)
+
+#define is_ex_of_type(OBJ,TYPE) \
+    (dynamic_cast<TYPE *>(const_cast<basic *>((OBJ).bp))!=0)
+
+#define is_ex_exactly_of_type(OBJ,TYPE) \
+    ((*(OBJ).bp).tinfo()==TINFO_##TYPE)
+
+#endif // ndef NO_GINAC_NAMESPACE
+
+#ifndef NO_GINAC_NAMESPACE
 } // namespace GiNaC
+#endif // ndef NO_GINAC_NAMESPACE
 
 #endif // ndef __GINAC_BASIC_H__