]> www.ginac.de Git - ginac.git/blobdiff - ginac/container.pl
* ginac/pseries.cpp (pseries::compare_same_type): optimized.
[ginac.git] / ginac / container.pl
index f642e4114c33f13b217dd2340a0cf4193f4f9c28..80fb9fac3729982171c80f5b51d2c379265ada28 100755 (executable)
@@ -132,7 +132,7 @@ $constructors_implementation=generate(
        <<'END_OF_CONSTRUCTORS_IMPLEMENTATION','const ex & param${N}',', ','    seq.push_back(param${N});',"\n");
 ${CONTAINER}::${CONTAINER}(${SEQ1}) : basic(TINFO_${CONTAINER})
 {
-       debugmsg(\"${CONTAINER} constructor from ${N}*ex\",LOGLEVEL_CONSTRUCT);
+       debugmsg(\"${CONTAINER} ctor from ${N}*ex\",LOGLEVEL_CONSTRUCT);
        RESERVE(seq,${N});
 ${SEQ2}
 }
@@ -155,7 +155,7 @@ $interface=<<END_OF_INTERFACE;
  *                        \$close_bracket=${close_bracket}
  *                        \$maxargs=${maxargs}
  *
- *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2001 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
@@ -183,33 +183,27 @@ $interface=<<END_OF_INTERFACE;
 #include "basic.h"
 #include "ex.h"
 
-#ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
-#endif // ndef NO_NAMESPACE_GINAC
 
-// typedef std::${STLHEADER}<ex> ${STLT};
-typedef std::${STLHEADER}<ex,malloc_alloc> ${STLT}; // CINT does not like ${STLHEADER}<...,default_alloc>
+
+// Cint does not like ${STLHEADER}<..,default_alloc> but malloc_alloc is
+// unstandardized and not supported by newer GCCs.
+#if defined(__GNUC__) && ((__GNUC__ == 2) && (__GNUC_MINOR__ < 97))
+typedef std::${STLHEADER}<ex,malloc_alloc> ${STLT};
+#else
+typedef std::${STLHEADER}<ex> ${STLT};
+#endif
 
 class ${CONTAINER} : public basic
 {
        GINAC_DECLARE_REGISTERED_CLASS(${CONTAINER}, basic)
 
-public:
-       ${CONTAINER}();
-       ~${CONTAINER}();
-       ${CONTAINER}(${CONTAINER} const & other);
-       ${CONTAINER} const & operator=(${CONTAINER} const & other);
-protected:
-       void copy(${CONTAINER} const & other);
-       void destroy(bool call_parent);
-
 public:
        ${CONTAINER}(${STLT} const & s, bool discardable=0);
        ${CONTAINER}(${STLT} * vp); // vp will be deleted
 ${constructors_interface}
 
 public:
-       basic * duplicate() const;
        void printraw(std::ostream & os) const;
        void print(std::ostream & os, unsigned upper_precedence=0) const;
        void printtree(std::ostream & os, unsigned indent) const;
@@ -224,7 +218,6 @@ public:
        ex derivative(const symbol & s) const;
        ex subs(const lst & ls, const lst & lr) const;
 protected:
-       int compare_same_type(const basic & other) const;
        bool is_equal_same_type(const basic & other) const;
        unsigned return_type(void) const;
 
@@ -255,7 +248,7 @@ protected:
 // global constants
 
 extern const ${CONTAINER} some_${CONTAINER};
-extern const type_info & typeid_${CONTAINER};
+extern const std::type_info & typeid_${CONTAINER};
 
 // utility functions
 inline const ${CONTAINER} &ex_to_${CONTAINER}(const ex &e)
@@ -268,9 +261,7 @@ inline ${CONTAINER} &ex_to_nonconst_${CONTAINER}(const ex &e)
        return static_cast<${CONTAINER} &>(*e.bp);
 }
 
-#ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
-#endif // ndef NO_NAMESPACE_GINAC
 
 #endif // ndef __GINAC_${CONTAINER_UC}_H__
 
@@ -293,7 +284,7 @@ $implementation=<<END_OF_IMPLEMENTATION;
  *                        \$close_bracket=${close_bracket}
  *                        \$maxargs=${maxargs}
  *
- *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2001 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
@@ -318,45 +309,21 @@ $implementation=<<END_OF_IMPLEMENTATION;
 #include "archive.h"
 #include "debugmsg.h"
 
-#ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
-#endif // ndef NO_NAMESPACE_GINAC
 
 GINAC_IMPLEMENT_REGISTERED_CLASS(${CONTAINER}, basic)
 
 ${RESERVE_IMPLEMENTATION}
 
 //////////
-// default constructor, destructor, copy constructor assignment operator and helpers
+// default ctor, dtor, copy ctor assignment operator and helpers
 //////////
 
 // public
 
 ${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER})
 {
-       debugmsg("${CONTAINER} default constructor",LOGLEVEL_CONSTRUCT);
-}
-
-${CONTAINER}::~${CONTAINER}()
-{
-       debugmsg("${CONTAINER} destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-${CONTAINER}::${CONTAINER}(${CONTAINER} const & other)
-{
-       debugmsg("${CONTAINER} copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-${CONTAINER} const & ${CONTAINER}::operator=(${CONTAINER} const & other)
-{
-       debugmsg("${CONTAINER} operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
+       debugmsg("${CONTAINER} default ctor",LOGLEVEL_CONSTRUCT);
 }
 
 // protected
@@ -374,14 +341,14 @@ void ${CONTAINER}::destroy(bool call_parent)
 }
 
 //////////
-// other constructors
+// other ctors
 //////////
 
 // public
 
 ${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) :  basic(TINFO_${CONTAINER})
 {
-       debugmsg("${CONTAINER} constructor from ${STLT}", LOGLEVEL_CONSTRUCT);
+       debugmsg("${CONTAINER} ctor from ${STLT}", LOGLEVEL_CONSTRUCT);
        if (discardable) {
                seq.swap(const_cast<${STLT} &>(s));
        } else {
@@ -391,7 +358,7 @@ ${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) :  basic(TINFO_$
 
 ${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER})
 {
-       debugmsg("${CONTAINER} constructor from ${STLT} *",LOGLEVEL_CONSTRUCT);
+       debugmsg("${CONTAINER} ctor from ${STLT} *",LOGLEVEL_CONSTRUCT);
        GINAC_ASSERT(vp!=0);
        seq.swap(*vp);
        delete vp;
@@ -406,7 +373,7 @@ ${constructors_implementation}
 /** Construct object from archive_node. */
 ${CONTAINER}::${CONTAINER}(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
 {
-       debugmsg("${CONTAINER} constructor from archive_node", LOGLEVEL_CONSTRUCT);
+       debugmsg("${CONTAINER} ctor from archive_node", LOGLEVEL_CONSTRUCT);
        for (unsigned int i=0; true; i++) {
                ex e;
                if (n.find_ex("seq", e, sym_lst, i))
@@ -439,12 +406,6 @@ void ${CONTAINER}::archive(archive_node &n) const
 
 // public
 
-basic * ${CONTAINER}::duplicate() const
-{
-       debugmsg("${CONTAINER} duplicate",LOGLEVEL_DUPLICATE);
-       return new ${CONTAINER}(*this);
-}
-
 void ${CONTAINER}::printraw(std::ostream & os) const
 {
        debugmsg("${CONTAINER} printraw",LOGLEVEL_PRINT);
@@ -786,18 +747,16 @@ ${STLT} * ${CONTAINER}::subschildren(const lst & ls, const lst & lr) const
 
 // protected
 
-unsigned ${CONTAINER}::precedence=10;
+unsigned ${CONTAINER}::precedence = 10;
 
 //////////
 // global constants
 //////////
 
 const ${CONTAINER} some_${CONTAINER};
-const type_info & typeid_${CONTAINER}=typeid(some_${CONTAINER});
+const std::type_info & typeid_${CONTAINER} = typeid(some_${CONTAINER});
 
-#ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
-#endif // ndef NO_NAMESPACE_GINAC
 
 END_OF_IMPLEMENTATION