]> www.ginac.de Git - ginac.git/blobdiff - ginac/simp_lor.cpp
the destructor, copy constructor, and assignment operator (which were the
[ginac.git] / ginac / simp_lor.cpp
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
 //////////