X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fstructure.cpp;h=e9c3b0213f45cb9055cbd2f3404604b4325328b7;hb=c20f44225542fd9e4c0cda17660af6a276d3ed9f;hp=06d07fb7c140d5883badd3fbe974d00c0fadd969;hpb=9e2d60e206395fc9908e1f9025e50c76b3d7c182;p=ginac.git diff --git a/ginac/structure.cpp b/ginac/structure.cpp index 06d07fb7..e9c3b021 100644 --- a/ginac/structure.cpp +++ b/ginac/structure.cpp @@ -3,7 +3,7 @@ * Implementation of 'abstract' class structure. */ /* - * 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 @@ -23,46 +23,25 @@ #include #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 +// default ctor, dtor, copy ctor assignment operator and helpers ////////// // public structure::structure() { - debugmsg("structure default constructor",LOGLEVEL_CONSTRUCT); + debugmsg("structure default ctor",LOGLEVEL_CONSTRUCT); 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) @@ -76,35 +55,51 @@ void structure::destroy(bool call_parent) } ////////// -// other constructors +// other ctors ////////// // none ////////// -// structures overriding virtual structures from bases classes +// archiving ////////// -// public +/** Construct object from archive_node. */ +structure::structure(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +{ + debugmsg("structure ctor 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); +} -basic * structure::duplicate() const +/** Archive the object. */ +void structure::archive(archive_node &n) const { - debugmsg("structure duplicate",LOGLEVEL_DUPLICATE); - return new structure(*this); + inherited::archive(n); } +////////// +// structures overriding virtual structures from bases classes +////////// + +// public + void structure::printraw(std::ostream & os) const { debugmsg("structure printraw",LOGLEVEL_PRINT); - os << "structure(hash=" << hashvalue << ",flags=" << flags << ")"; + os << class_name() << "(hash=" << hashvalue << ",flags=" << flags << ")"; } void structure::print(std::ostream & os, unsigned upper_precedence) const { debugmsg("structure print",LOGLEVEL_PRINT); - os << "structure()"; + os << class_name() << "()"; } void structure::printtree(std::ostream & os, unsigned indent) const @@ -165,19 +160,4 @@ unsigned structure::register_new(const char * nm) return registered_structures().size()-1; } -////////// -// static member variables -////////// - -// none - -////////// -// global constants -////////// - -const structure some_structure; -const std::type_info & typeid_structure = typeid(some_structure); - -#ifndef NO_NAMESPACE_GINAC } // namespace GiNaC -#endif // ndef NO_NAMESPACE_GINAC