]> www.ginac.de Git - ginac.git/commitdiff
the destructor, copy constructor, and assignment operator (which were the
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 15 Feb 2001 22:54:52 +0000 (22:54 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 15 Feb 2001 22:54:52 +0000 (22:54 +0000)
same for all subclasses of basic, with very few exceptions) are now included
in the GINAC_IMPLEMENT_REGISTERED_CLASS macro; the GINAC_DECLARE_REGISTERED_CLASS
macro also defines these (and other common) member functions

49 files changed:
ginac/add.cpp
ginac/add.h
ginac/basic.cpp
ginac/basic.h
ginac/clifford.cpp
ginac/clifford.h
ginac/color.cpp
ginac/color.h
ginac/coloridx.cpp
ginac/coloridx.h
ginac/constant.cpp
ginac/constant.h
ginac/container.pl
ginac/expairseq.cpp
ginac/expairseq.h
ginac/fail.cpp
ginac/fail.h
ginac/function.pl
ginac/idx.cpp
ginac/idx.h
ginac/indexed.cpp
ginac/indexed.h
ginac/isospin.cpp
ginac/isospin.h
ginac/lorentzidx.cpp
ginac/lorentzidx.h
ginac/lortensor.cpp
ginac/lortensor.h
ginac/matrix.cpp
ginac/matrix.h
ginac/mul.cpp
ginac/mul.h
ginac/ncmul.cpp
ginac/ncmul.h
ginac/numeric.cpp
ginac/numeric.h
ginac/power.cpp
ginac/power.h
ginac/pseries.cpp
ginac/pseries.h
ginac/registrar.h
ginac/relational.cpp
ginac/relational.h
ginac/simp_lor.cpp
ginac/simp_lor.h
ginac/structure.cpp
ginac/structure.h
ginac/symbol.cpp
ginac/symbol.h

index 74a373283a033687efbb73b55d5693987f2b34be..574a8e8ec662eb96e71f5414dcce322a4e59776b 100644 (file)
@@ -47,28 +47,6 @@ add::add()
        tinfo_key = TINFO_add;
 }
 
-add::~add()
-{
-       debugmsg("add destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-add::add(const add & other)
-{
-       debugmsg("add copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const add & add::operator=(const add & other)
-{
-       debugmsg("add operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void add::copy(const add & other)
index c30034dfd282fc03eceabf73cc98117f593bf386..924eb407ce893d0e9ac5e5116ebb2cc439a1402d 100644 (file)
@@ -38,18 +38,6 @@ class add : public expairseq
        friend class ncmul;
        friend class power;
 
-// member functions
-
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       add();
-       ~add();
-       add(const add & other);
-       const add & operator=(const add & other);
-protected:
-       void copy(const add & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        add(const ex & lh, const ex & rh);
index daefabb8461e64e51961dd12d6ff073836af12db..9f0bbf534640162ef1f0f9909e0f8d81937d046b 100644 (file)
@@ -39,7 +39,7 @@
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
-GINAC_IMPLEMENT_REGISTERED_CLASS(basic, void)
+GINAC_IMPLEMENT_REGISTERED_CLASS_NO_CTORS(basic, void)
 
 //////////
 // default constructor, destructor, copy constructor assignment operator and helpers
index 05ee4f23ab2312cf447c00226b1fddc2f6ab69af..e7238e5705ac2c74f29736bf47cff6d194c2580b 100644 (file)
@@ -61,7 +61,7 @@ typedef std::vector<ex> exvector;
  *  It is responsible for the reference counting. */
 class basic
 {
-       GINAC_DECLARE_REGISTERED_CLASS(basic, void)
+       GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS(basic, void)
 
        friend class ex;
 
index 37e1d8df89d43930bc0ca1f7e09e57cf49fa8f82..c3c0d9f3a3ba9b9944f1bd96626aed8863c99ed3 100644 (file)
@@ -48,28 +48,6 @@ clifford::clifford()
        tinfo_key = TINFO_clifford;
 }
 
-clifford::~clifford()
-{
-       debugmsg("clifford destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-clifford::clifford(const clifford & other)
-{
-       debugmsg("clifford copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const clifford & clifford::operator=(const clifford & other)
-{
-       debugmsg("clifford operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void clifford::copy(const clifford & other)
index e7b05f532208c567f24aa10c3017ebb0e326d1c3..2d02ebcb8df7a4c6bc3db1d12c0fb34ca00aeae2 100644 (file)
@@ -42,18 +42,6 @@ class clifford : public lortensor
 
        friend clifford clifford_gamma(const ex & mu);
 
-// member functions
-
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       clifford();
-       ~clifford();
-       clifford(const clifford & other);
-       const clifford & operator=(const clifford & other);
-protected:
-       void copy(const clifford & other); 
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        clifford(const std::string & n, const ex & mu);
index 9f3b3000c321600eddbc1e773310935d29384a44..4b59877aeb4e03ba228f66330782cd92b0715bf9 100644 (file)
@@ -54,28 +54,6 @@ color::color() : inherited(TINFO_color), type(invalid), representation_label(0)
        debugmsg("color default constructor",LOGLEVEL_CONSTRUCT);
 }
 
-color::~color()
-{
-       debugmsg("color destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-color::color(const color & other)
-{
-       debugmsg("color copy constructor",LOGLEVEL_CONSTRUCT);
-       copy (other);
-}
-
-const color & color::operator=(const color & other)
-{
-       debugmsg("color operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void color::copy(const color & other)
index 2b607e3c8e9dd41db9db81b9f8edb2a28ee209ee..2d44aa8f530177581235e9f444afc166765a8e86 100644 (file)
@@ -94,16 +94,6 @@ public:
        
 // member functions
 
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       color();
-       ~color();
-       color(const color & other);
-       const color & operator=(const color & other);
-protected:
-       void copy(const color & other); 
-       void destroy(bool call_parent);
-
        // other constructors
 protected:
        color(color_types const t, unsigned rl=0);
index b9568a85d376ee422cc9b2e320c3ec2892567a37..221e86b6aeaf261e995d7fb823b25131a8bf81cf 100644 (file)
@@ -47,28 +47,6 @@ coloridx::coloridx()
        tinfo_key=TINFO_coloridx;
 }
 
-coloridx::~coloridx() 
-{
-       debugmsg("coloridx destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-coloridx::coloridx(const coloridx & other)
-{
-       debugmsg("coloridx copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const coloridx & coloridx::operator=(const coloridx & other)
-{
-       debugmsg("coloridx operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void coloridx::copy(const coloridx & other)
index 4b40a3a7768d806b3039147df6563d0eed1f7a2b..780aac4275e0d3bc246be7883b9af90acae33371 100644 (file)
@@ -45,18 +45,6 @@ class coloridx : public idx
 
        friend class color;
 
-// member functions
-
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       coloridx();
-       ~coloridx();
-       coloridx (const coloridx & other);
-       const coloridx & operator=(const coloridx & other);
-protected:
-       void copy(const coloridx & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        explicit coloridx(bool cov);
index 3e6c667de63b79fe27e976c3d3536ff9bb71e389..ae71579c777bd25d3ea5ceeb51a0d76bba396a9f 100644 (file)
@@ -46,18 +46,6 @@ constant::constant() : basic(TINFO_constant), name(""), ef(0), number(0), serial
        debugmsg("constant default constructor",LOGLEVEL_CONSTRUCT);
 }
 
-constant::~constant()
-{
-       debugmsg("constant destructor",LOGLEVEL_DESTRUCT);
-       destroy(0);
-}
-
-constant::constant(const constant & other)
-{
-       debugmsg("constant copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
 // protected
 
 void constant::copy(const constant & other)
index 70b2816e35a2885f58c3c639577af9b94ae60a5b..0c9394f88c24eea75e4ab4b749b639a44709d0bc 100644 (file)
@@ -42,16 +42,6 @@ class constant : public basic
 
 // member functions
 
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       constant();
-       ~constant();
-       constant(const constant & other);
-       // const constant & operator=(const constant & other); /* it's pervert! */
-protected:
-       void copy(const constant & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        constant(const std::string & initname, evalffunctype efun=0);
index bbeb3b4a0f5de0a251b1a56a31791c6e719f5e8b..232d299c6fc12e0bb073ab5aa59c9a7923b1d694 100755 (executable)
@@ -200,15 +200,6 @@ 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
@@ -343,28 +334,6 @@ ${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;
-}
-
 // protected
 
 void ${CONTAINER}::copy(${CONTAINER} const & other)
index 3daa4da5fefc7ffa6670c7cb258c4e4d66b4958e..56fcba68fda4489dc60ef2f32629f76f7be2aff8 100644 (file)
@@ -38,7 +38,7 @@ namespace GiNaC {
 #error "FIXME: expair_needs_further_processing not yet implemented for hashtabs, sorry. A.F."
 #endif // def EXPAIRSEQ_USE_HASHTAB
 
-GINAC_IMPLEMENT_REGISTERED_CLASS(expairseq, basic)
+GINAC_IMPLEMENT_REGISTERED_CLASS_NO_CTORS(expairseq, basic)
 
 //////////
 // helper classes
index d9cc0b31140c1bd955686743e307f3d7c4a084c4..bba0902dcc1a103be4d5cc1060364fa59f663890 100644 (file)
@@ -57,7 +57,7 @@ typedef std::vector<epplist> epplistvector;
  *  the same way.) */
 class expairseq : public basic
 {
-       GINAC_DECLARE_REGISTERED_CLASS(expairseq, basic)
+       GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS(expairseq, basic)
 
 // member functions
 
index 8a281e8ab97a2c938242c63b3e2c1f9540bf0a09..c11180406ad3a654f2c0d31a1af726ada1d8758a 100644 (file)
@@ -42,28 +42,6 @@ fail::fail() : inherited(TINFO_fail)
        debugmsg("fail default constructor",LOGLEVEL_CONSTRUCT);
 }
 
-fail::~fail()
-{
-       debugmsg("fail destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-fail::fail(const fail & other)
-{
-       debugmsg("fail copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const fail & fail::operator=(const fail & other)
-{
-       debugmsg("fail operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void fail::copy(const fail & other)
index d6bf22d013bf0c36a7aefc4aee9bf39f9be12d75..248c593c6d1002805e53458b0e6e165717c8de85 100644 (file)
@@ -34,16 +34,6 @@ class fail : public basic
 {
        GINAC_DECLARE_REGISTERED_CLASS(fail, basic)
 
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       fail();
-       ~fail();
-       fail(const fail & other);
-       const fail & operator=(const fail & other);
-protected:
-       void copy(const fail & other);
-       void destroy(bool call_parent);
-
        // other constructors
        // none
 
@@ -62,8 +52,8 @@ protected:
        // non-virtual functions in this class
        // none
 
-// member variables
-// none
+       // member variables
+       // none
 };
 
 #ifndef NO_NAMESPACE_GINAC
index d97e58f674e916b0b81109afdbd7dae20b732008..8a96a3290ff852cfca3c8f6552c8524695b93459 100755 (executable)
@@ -386,16 +386,6 @@ class function : public exprseq
 
 // member functions
 
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       function();
-       ~function();
-       function(const function & other);
-       const function & operator=(const function & other);
-protected:
-       void copy(const function & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        function(unsigned ser);
@@ -630,28 +620,6 @@ function::function() : serial(0)
        tinfo_key = TINFO_function;
 }
 
-function::~function()
-{
-       debugmsg("function destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-function::function(const function & other)
-{
-       debugmsg("function copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const function & function::operator=(const function & other)
-{
-       debugmsg("function operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void function::copy(const function & other)
index 34d5c854c00f55c47be8b64b4959a8bffdd844f5..af463a80f4a71cfe9c3ebf33ec486f1fed16c1e3 100644 (file)
@@ -49,28 +49,6 @@ idx::idx() : inherited(TINFO_idx), symbolic(true), covariant(false)
        name=autoname_prefix()+ToString(serial);
 }
 
-idx::~idx() 
-{
-       debugmsg("idx destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-idx::idx(const idx & other)
-{
-       debugmsg("idx copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const idx & idx::operator=(const idx & other)
-{
-       debugmsg("idx operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void idx::copy(const idx & other)
index 8b991ac1ffad1ef843863c14c2e153ad432a2915..981fee68d041f66e321c9f7addbf611c0d5773ac 100644 (file)
@@ -40,16 +40,6 @@ class idx : public basic
 {
        GINAC_DECLARE_REGISTERED_CLASS(idx, basic)
 
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       idx();
-       ~idx();
-       idx (const idx & other);
-       const idx & operator=(const idx & other);
-protected:
-       void copy(const idx & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        explicit idx(bool cov);
index 8e05dbf22a7d534cf0a1e6e8f4ccd1be82d85b2a..7127e9a4786a9b201443a96396b7ad794059a1ca 100644 (file)
@@ -45,28 +45,6 @@ indexed::indexed()
        tinfo_key=TINFO_indexed;
 }
 
-indexed::~indexed()
-{
-       debugmsg("indexed destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-indexed::indexed(const indexed & other)
-{
-       debugmsg("indexed copy constructor",LOGLEVEL_CONSTRUCT);
-       copy (other);
-}
-
-const indexed & indexed::operator=(const indexed & other)
-{
-       debugmsg("indexed operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void indexed::copy(const indexed & other)
index c43d4aded9c61f2169ecdfa27c8790bfa820007f..b1d8844aaf83995bd0ac0020db66ebad0a98c4f4 100644 (file)
@@ -36,18 +36,6 @@ class indexed : public exprseq
 {
        GINAC_DECLARE_REGISTERED_CLASS(indexed, exprseq)
 
-// member functions
-
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       indexed();
-       ~indexed();
-       indexed(const indexed & other);
-       const indexed & operator=(const indexed & other);
-protected:
-       void copy(const indexed & other); 
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        indexed(const ex & i1);
index 911c86f4e7c4a1ff1d8169a6949435fea65ac112..a74e05f79eb01100206a0f25b525bc79b0bffdfe 100644 (file)
@@ -51,28 +51,6 @@ isospin::isospin()
        tinfo_key=TINFO_isospin;
 }
 
-isospin::~isospin()
-{
-       debugmsg("isospin destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-isospin::isospin(const isospin & other)
-{
-       debugmsg("isospin copy constructor",LOGLEVEL_CONSTRUCT);
-       copy (other);
-}
-
-const isospin & isospin::operator=(const isospin & other)
-{
-       debugmsg("isospin operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void isospin::copy(const isospin & other)
index 313c1309c02880ad12466c1c561d98a140cab5d2..3facb90bf0094c5034e24c8a0002226af33ebf64 100644 (file)
@@ -35,18 +35,6 @@ class isospin : public indexed
 {
        GINAC_DECLARE_REGISTERED_CLASS(isospin, indexed)
 
-// member functions
-
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       isospin();
-       ~isospin();
-       isospin(const isospin & other);
-       const isospin & operator=(const isospin & other);
-protected:
-       void copy(const isospin & other); 
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        explicit isospin(const std::string & initname);
index 67e5576b8730979d6cf42874f6965488f771c987..6a367be65c1deec6068f2e08546de67dbec7efbf 100644 (file)
@@ -49,28 +49,6 @@ lorentzidx::lorentzidx() : orthogonal_only(false), dim_parallel_space(0)
        tinfo_key = TINFO_lorentzidx;
 }
 
-lorentzidx::~lorentzidx() 
-{
-       debugmsg("lorentzidx destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-lorentzidx::lorentzidx(const lorentzidx & other)
-{
-       debugmsg("lorentzidx copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const lorentzidx & lorentzidx::operator=(const lorentzidx & other)
-{
-       debugmsg("lorentzidx operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void lorentzidx::copy(const lorentzidx & other)
index 3d5355b7ec3dbb53ac0896f09f2b5853dc717df1..099f36b528dc3c8edc1f7f6abcbcf79cf3702b42 100644 (file)
@@ -48,16 +48,6 @@ class lorentzidx : public idx
 
 // member functions
 
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       lorentzidx();
-       ~lorentzidx();
-       lorentzidx (const lorentzidx & other);
-       const lorentzidx & operator=(const lorentzidx & other);
-protected:
-       void copy(const lorentzidx & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        explicit lorentzidx(bool cov, bool oonly=false, unsigned dimp=0);
index 0238adcb629a8f4ad3b98ff59ab98e727123c3e8..7a97887ae71852fc33974827dc55778a126c9b6d 100644 (file)
@@ -60,28 +60,6 @@ lortensor::lortensor() : inherited(TINFO_lortensor), type(invalid)
        name=autoname_prefix()+ToString(serial);
 }
 
-lortensor::~lortensor()
-{
-       debugmsg("lortensor destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-lortensor::lortensor(const lortensor & other)
-{
-       debugmsg("lortensor copy constructor",LOGLEVEL_CONSTRUCT);
-       copy (other);
-}
-
-const lortensor & lortensor::operator=(const lortensor & other)
-{
-       debugmsg("lortensor operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != & other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 //protected
 
 void lortensor::copy(const lortensor & other)
@@ -350,7 +328,7 @@ ex lortensor::eval(int level) const
                                return _ex0();
                        }
                } else if (idx1.is_symbolic() && idx1.is_co_contra_pair(idx2)) {
-                       return Dim() - 2;
+                       return Dim();
                }
        }
        return this -> hold();
index 977be9840c13fd9e147858d55f822ef466f7444d..d25211fe053d9285eacfe343610d65e7fb01f56e 100644 (file)
@@ -67,16 +67,6 @@ public:
 
 // member functions
 
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       lortensor();
-       ~lortensor();
-       lortensor(const lortensor & other);
-       const lortensor & operator=(const lortensor & other);
-protected:
-       void copy(const lortensor & other);
-       void destroy(bool call_parent);
-
        // other constructors
 protected:
        lortensor(lortensor_types const lt, const std::string & n);
index ec7ee2c8e004415bd04eb4e8df44acc9d3fa7294..0b87ed5d3ba843511e144bc3c316bd99dd0a4d50 100644 (file)
@@ -54,28 +54,6 @@ matrix::matrix() : inherited(TINFO_matrix), row(1), col(1)
        m.push_back(_ex0());
 }
 
-matrix::~matrix()
-{
-       debugmsg("matrix destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-matrix::matrix(const matrix & other)
-{
-       debugmsg("matrix copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const matrix & matrix::operator=(const matrix & other)
-{
-       debugmsg("matrix operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void matrix::copy(const matrix & other)
index 279ddfc12ad1402abceffff59088076d19414682..7c2b9c0178a6627e7d482167c6afbc35e9a48354 100644 (file)
@@ -36,21 +36,6 @@ class matrix : public basic
 {
        GINAC_DECLARE_REGISTERED_CLASS(matrix, basic)
 
-// friends
-// (none)
-// member functions
-
-       // default constructor, destructor, copy constructor, assignment operator
-       // and helpers:
-public:
-       matrix();
-       ~matrix();
-       matrix(const matrix & other);
-       const matrix & operator=(const matrix & other);
-protected:
-       void copy(const matrix & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        matrix(unsigned r, unsigned c);
index 23927729895d3dfc5e9f0321044f8e42babb0b25..80901d773573f19973546880ea2378dceba82f3c 100644 (file)
@@ -48,28 +48,6 @@ mul::mul()
        tinfo_key = TINFO_mul;
 }
 
-mul::~mul()
-{
-       debugmsg("mul destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-mul::mul(const mul & other)
-{
-       debugmsg("mul copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const mul & mul::operator=(const mul & other)
-{
-       debugmsg("mul operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void mul::copy(const mul & other)
index 78954963711ca18c521078b7329b4cb646cc1935..c6d607dbeb844a71cbd0fd2ce98aa20267db0d1d 100644 (file)
@@ -38,18 +38,6 @@ class mul : public expairseq
        friend class ncmul;
        friend class power;
 
-// member functions
-
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       mul();
-       ~mul();
-       mul(const mul & other);
-       const mul & operator=(const mul & other);
-protected:
-       void copy(const mul & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        mul(const ex & lh, const ex & rh);
index 8964d6b7ddf2f946fa417be53ab5c7587f8ffb48..86b76e718aa85f250247185968043655789779c6 100644 (file)
@@ -50,28 +50,6 @@ ncmul::ncmul()
        tinfo_key = TINFO_ncmul;
 }
 
-ncmul::~ncmul()
-{
-       debugmsg("ncmul destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-ncmul::ncmul(const ncmul & other)
-{
-       debugmsg("ncmul copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const ncmul & ncmul::operator=(const ncmul & other)
-{
-       debugmsg("ncmul operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void ncmul::copy(const ncmul & other)
index a604eead140b3ee536e76622cc181955dedc8e7d..a4a77eb027e5423becdf5aff1f7dd437336ec38c 100644 (file)
@@ -40,16 +40,6 @@ class ncmul : public exprseq
 
 // member functions
 
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       ncmul();
-       ~ncmul();
-       ncmul(const ncmul & other);
-       const ncmul & operator=(const ncmul & other);
-protected:
-       void copy(const ncmul & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        ncmul(const ex & lh, const ex & rh);
index 32bb7fb2295b376e8b362aa4020b8c2923a51d73..3398f60db6aca79a82bd5b27244a03ebe8b70cf9 100644 (file)
@@ -87,28 +87,6 @@ numeric::numeric() : basic(TINFO_numeric)
                status_flags::hash_calculated);
 }
 
-numeric::~numeric()
-{
-       debugmsg("numeric destructor" ,LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-numeric::numeric(const numeric & other)
-{
-       debugmsg("numeric copy constructor", LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const numeric & numeric::operator=(const numeric & other)
-{
-       debugmsg("numeric operator=", LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void numeric::copy(const numeric & other)
index 247951aa750c284dce9aaf11d7cad55c43d5ee11..1eda94d44b5affd180942ad2d23498f20c4190c0 100644 (file)
@@ -73,22 +73,8 @@ class numeric : public basic
 {
        GINAC_DECLARE_REGISTERED_CLASS(numeric, basic)
 
-// friends
-// (none)
-
 // member functions
 
-       // default constructor, destructor, copy constructor assignment
-       // operator and helpers
-public:
-       numeric();
-       ~numeric();
-       numeric(const numeric & other);
-       const numeric & operator=(const numeric & other);
-protected:
-       void copy(const numeric & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        explicit numeric(int i);
index 9d224d1b2f07726fa2c28d8f1d8cfc8c7c715fe6..30697335c437e2a88b5415d145652fe473c6809d 100644 (file)
@@ -55,28 +55,6 @@ power::power() : basic(TINFO_power)
        debugmsg("power default constructor",LOGLEVEL_CONSTRUCT);
 }
 
-power::~power()
-{
-       debugmsg("power destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-power::power(const power & other)
-{
-       debugmsg("power copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const power & power::operator=(const power & other)
-{
-       debugmsg("power operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void power::copy(const power & other)
index 6bdafa00048167d5975f3765a76e4d13189a81d8..65c86b7e8618cd68a3b4875e9eaa9dcad7d81a8f 100644 (file)
@@ -43,16 +43,6 @@ class power : public basic
 
 // member functions
 
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       power();
-       ~power();
-       power(const power & other);
-       const power & operator=(const power & other);
-protected:
-       void copy(const power & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        power(const ex & lh, const ex & rh);
index 9adc8fc4fbd898daa646df026fc8e716a677d8cf..d447aaa64de9d98e135beb67ec7e32a03509cc62 100644 (file)
@@ -50,28 +50,6 @@ pseries::pseries() : basic(TINFO_pseries)
        debugmsg("pseries default constructor", LOGLEVEL_CONSTRUCT);
 }
 
-pseries::~pseries()
-{
-       debugmsg("pseries destructor", LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-pseries::pseries(const pseries &other)
-{
-       debugmsg("pseries copy constructor", LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const pseries &pseries::operator=(const pseries & other)
-{
-       debugmsg("pseries operator=", LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 void pseries::copy(const pseries &other)
 {
        inherited::copy(other);
index 0b0d92f1fb7466cc6a0840879e9bb93a25e1db5b..14b011af6af401b09ca558f55763697e2aaa1f4f 100644 (file)
@@ -38,16 +38,6 @@ class pseries : public basic
 {
        GINAC_DECLARE_REGISTERED_CLASS(pseries, basic)
 
-       // default constructor, destructor, copy constructor, assignment operator and helpers
-public:
-       pseries();
-       ~pseries();
-       pseries(const pseries &other);
-       const pseries &operator=(const pseries &other);
-protected:
-       void copy(const pseries &other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        pseries(const ex &rel_, const epvector &ops_);
index e800001973abeb8242a2eb0ccf26d2b19f40b8a4..f665ccd87cd830969479262469a659fdb7e87148 100644 (file)
@@ -61,22 +61,54 @@ struct registered_class_info {
 };
 
 
-/** Macro for inclusion in the declaration of each registered class. */
-#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername) \
+#define GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS(classname, supername) \
 public: \
        typedef supername inherited; \
        static registered_class_info reg_info; \
        virtual const char *class_name(void) const; \
        classname(const archive_node &n, const lst &sym_lst); \
        virtual void archive(archive_node &n) const; \
-       static ex unarchive(const archive_node &n, const lst &sym_lst); \
+       static ex unarchive(const archive_node &n, const lst &sym_lst);
+
+/** Macro for inclusion in the declaration of each registered class. */
+#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername) \
+       GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS(classname, supername) \
+public: \
+       classname(); \
+       ~classname(); \
+       classname(const classname & other); \
+       const classname & operator=(const classname & other); \
+protected: \
+       void copy(const classname & other); \
+       void destroy(bool call_parent); \
 private:
 
-/** Macro for inclusion in the implementation of each registered class. */
-#define GINAC_IMPLEMENT_REGISTERED_CLASS(classname, supername) \
+#define GINAC_IMPLEMENT_REGISTERED_CLASS_NO_CTORS(classname, supername) \
        registered_class_info classname::reg_info(#classname, #supername, TINFO_##classname, &classname::unarchive); \
        const char *classname::class_name(void) const {return reg_info.name;}
 
+/** Macro for inclusion in the implementation of each registered class. */
+#define GINAC_IMPLEMENT_REGISTERED_CLASS(classname, supername) \
+       GINAC_IMPLEMENT_REGISTERED_CLASS_NO_CTORS(classname, supername) \
+classname::~classname() \
+{ \
+       debugmsg(#classname " destructor", LOGLEVEL_DESTRUCT); \
+       destroy(false); \
+} \
+classname::classname(const classname & other) \
+{ \
+       debugmsg(#classname " copy constructor", LOGLEVEL_CONSTRUCT); \
+       copy(other); \
+} \
+const classname & classname::operator=(const classname & other) \
+{ \
+       debugmsg(#classname " operator=", LOGLEVEL_ASSIGNMENT); \
+       if (this != &other) { \
+               destroy(true); \
+               copy(other); \
+       } \
+       return *this; \
+}
 
 /** Find TINFO_* key by class name. */
 extern unsigned int find_tinfo_key(const std::string &class_name);
index 7ed651c90c74ccbfc0949bfc0b2843afa7f9ed89..c8b504313bde667710232fd5ad8d6b2c22029cd3 100644 (file)
@@ -45,28 +45,6 @@ relational::relational() : basic(TINFO_relational)
        debugmsg("relational default constructor",LOGLEVEL_CONSTRUCT);
 }
 
-relational::~relational()
-{
-       debugmsg("relational destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-relational::relational(const relational & other)
-{
-       debugmsg("relational copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const relational & relational::operator=(const relational & other)
-{
-       debugmsg("relational operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void relational::copy(const relational & other)
index 85d9db1dc40c024edade64f8daca588e35c4c87b..5a9fe443164d9d9120210905ad1b665e2cd22e47 100644 (file)
@@ -47,18 +47,6 @@ public:
                greater_or_equal
        };
        
-// member functions
-
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       relational();
-       ~relational();
-       relational(const relational & other);
-       const relational & operator=(const relational & other);
-protected:
-       void copy(const relational & other);
-       void destroy(bool call_parent);
-
        // other constructors
 public:
        relational(const ex & lhs, const ex & rhs, operators oper=equal);
index 06e79da182fd38bdf575fb6613f4de61f64543e0..23bd24a31bca5e375935a2ce4a2ff36476fa0eb6 100644 (file)
@@ -31,6 +31,7 @@
 #include "simp_lor.h"
 #include "ex.h"
 #include "mul.h"
+#include "archive.h"
 #include "debugmsg.h"
 #include "utils.h"
 
@@ -38,6 +39,8 @@
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
+GINAC_IMPLEMENT_REGISTERED_CLASS(simp_lor, indexed)
+
 //////////
 // default constructor, destructor, copy constructor assignment operator and helpers
 //////////
@@ -50,28 +53,6 @@ simp_lor::simp_lor() : type(invalid)
        tinfo_key=TINFO_simp_lor;
 }
 
-simp_lor::~simp_lor()
-{
-       debugmsg("simp_lor destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-simp_lor::simp_lor(const simp_lor & other)
-{
-       debugmsg("simp_lor copy constructor",LOGLEVEL_CONSTRUCT);
-       copy (other);
-}
-
-const simp_lor & simp_lor::operator=(const simp_lor & other)
-{
-       debugmsg("simp_lor operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void simp_lor::copy(const simp_lor & other)
@@ -132,6 +113,36 @@ simp_lor::simp_lor(simp_lor_types const t, const std::string & n, exvector * ivp
        GINAC_ASSERT(all_of_type_lorentzidx());
 }
 
+//////////
+// archiving
+//////////
+
+/** Construct object from archive_node. */
+simp_lor::simp_lor(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
+{
+       debugmsg("simp_lor constructor from archive_node", LOGLEVEL_CONSTRUCT);
+       unsigned int ty;
+       if (!(n.find_unsigned("type", ty)))
+               throw (std::runtime_error("unknown simp_lor type in archive"));
+       type = (simp_lor_types)ty;
+       n.find_string("name", name);
+}
+
+/** Unarchive the object. */
+ex simp_lor::unarchive(const archive_node &n, const lst &sym_lst)
+{
+       return (new simp_lor(n, sym_lst))->setflag(status_flags::dynallocated);
+}
+
+/** Archive the object. */
+void simp_lor::archive(archive_node &n) const
+{
+       inherited::archive(n);
+       n.add_unsigned("type", type);
+       n.add_string("name", name);
+}
+
+
 //////////
 // functions overriding virtual functions from bases classes
 //////////
index 8a62621705dd5ee81654b35f4f82bdc91c4277b7..d76f6c5694da7c1a113809309bdfff1ec438d64b 100644 (file)
@@ -70,6 +70,8 @@ protected:
 /** Base class for simp_lor object */
 class simp_lor : public indexed
 {
+       GINAC_DECLARE_REGISTERED_CLASS(simp_lor, indexed)
+
 // friends
 
        friend class scalar_products;
@@ -87,18 +89,6 @@ public:
                simp_lor_vec
        } simp_lor_types;
        
-// member functions
-
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       simp_lor();
-       ~simp_lor();
-       simp_lor(const simp_lor & other);
-       const simp_lor & operator=(const simp_lor & other);
-protected:
-       void copy(const simp_lor & other); 
-       void destroy(bool call_parent);
-
        // other constructors
 protected:
        simp_lor(simp_lor_types const t);
index ddd953dffc5424c28aabe0b0e70d014404db10e6..4aa4f10c6aa13cb1a9a5114df7a6c6380721ede4 100644 (file)
 #include <string>
 
 #include "structure.h"
+#include "archive.h"
 #include "debugmsg.h"
 
 #ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
+GINAC_IMPLEMENT_REGISTERED_CLASS(structure, basic)
+
 //////////
 // default constructor, destructor, copy constructor assignment operator and helpers
 //////////
@@ -41,28 +44,6 @@ structure::structure()
        tinfo_key = TINFO_structure;
 }
 
-structure::~structure()
-{
-       debugmsg("structure destructor",LOGLEVEL_DESTRUCT);
-       destroy(false);
-}
-
-structure::structure(const structure & other)
-{
-       debugmsg("structure copy constructor",LOGLEVEL_CONSTRUCT);
-       copy(other);
-}
-
-const structure & structure::operator=(const structure & other)
-{
-       debugmsg("structure operator=",LOGLEVEL_ASSIGNMENT);
-       if (this != &other) {
-               destroy(true);
-               copy(other);
-       }
-       return *this;
-}
-
 // protected
 
 void structure::copy(const structure & other)
@@ -81,6 +62,28 @@ void structure::destroy(bool call_parent)
 
 // none
 
+//////////
+// archiving
+//////////
+
+/** Construct object from archive_node. */
+structure::structure(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
+{
+       debugmsg("structure constructor from archive_node", LOGLEVEL_CONSTRUCT);
+}
+
+/** Unarchive the object. */
+ex structure::unarchive(const archive_node &n, const lst &sym_lst)
+{
+       return (new structure(n, sym_lst))->setflag(status_flags::dynallocated);
+}
+
+/** Archive the object. */
+void structure::archive(archive_node &n) const
+{
+       inherited::archive(n);
+}
+
 //////////
 // structures overriding virtual structures from bases classes
 //////////
index 28abe6adaf8c40f9f390fdf18f87b00ac6fdde14..6c5400336732bafef22bab16c9ddd5dd4b88793a 100644 (file)
@@ -41,17 +41,7 @@ struct registered_structure_info {
 
 class structure : public basic
 {
-// member functions
-
-       // default constructor, destructor, copy constructor assignment operator and helpers
-public:
-       structure();
-       ~structure();
-       structure(const structure & other);
-       const structure & operator=(const structure & other);
-protected:
-       void copy(const structure & other);
-       void destroy(bool call_parent);
+       GINAC_DECLARE_REGISTERED_CLASS(structure, basic)
 
        // other constructors
        // none
index 7ff75ec74bb41ea904e35847af9b2ef245eafc18..2657900a99524f43901fa9617aa1d608b508fe20 100644 (file)
@@ -34,7 +34,7 @@
 namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC
 
-GINAC_IMPLEMENT_REGISTERED_CLASS(symbol, basic)
+GINAC_IMPLEMENT_REGISTERED_CLASS_NO_CTORS(symbol, basic)
 
 //////////
 // default constructor, destructor, copy constructor assignment operator and helpers
index 20c5468b0b19c6becb5b568d29075590bb743aa2..21b7e41122d16dad954e1fd3c6ed85f8f4039d7f 100644 (file)
@@ -39,7 +39,7 @@ namespace GiNaC {
  *  first place. */
 class symbol : public basic
 {
-       GINAC_DECLARE_REGISTERED_CLASS(symbol, basic)
+       GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS(symbol, basic)
 
 // types