X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fstructure.cpp;h=c084096c49ff3d8509924d87ef4174e0ff934c89;hp=4aa4f10c6aa13cb1a9a5114df7a6c6380721ede4;hb=cdc62c4635574f52c1ab5156a5abe4e5c0b99d1a;hpb=e5362a33f72613b324b3714524a8c2e5f7b7f46f diff --git a/ginac/structure.cpp b/ginac/structure.cpp index 4aa4f10c..c084096c 100644 --- a/ginac/structure.cpp +++ b/ginac/structure.cpp @@ -25,99 +25,48 @@ #include "structure.h" #include "archive.h" #include "debugmsg.h" +#include "utils.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); - tinfo_key = TINFO_structure; -} - -// protected - -void structure::copy(const structure & other) -{ - basic::copy(other); -} - -void structure::destroy(bool call_parent) -{ - if (call_parent) basic::destroy(call_parent); -} - -////////// -// other constructors -////////// - -// none +DEFAULT_CTORS(structure) ////////// // 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); -} +DEFAULT_ARCHIVING(structure) ////////// -// structures overriding virtual structures from bases classes +// functions overriding virtual functions from bases classes ////////// -// public - -basic * structure::duplicate() const -{ - debugmsg("structure duplicate",LOGLEVEL_DUPLICATE); - return new structure(*this); -} - 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 { debugmsg("structure printtree",LOGLEVEL_PRINT); - os << std::string(indent,' ') << "structure " - << "hash=" << hashvalue - << " (0x" << std::hex << hashvalue << std::dec << ")" - << ", flags=" << flags << std::endl; + os << std::string(indent,' ') << class_name() << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec + << std::endl; } void structure::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const @@ -129,11 +78,7 @@ void structure::printcsrc(std::ostream & os, unsigned type, unsigned upper_prece // protected -int structure::compare_same_type(const basic & other) const -{ - GINAC_ASSERT(is_of_type(other, structure)); - return 0; // all structures are the same -} +DEFAULT_COMPARE(structure) bool structure::is_equal_same_type(const basic & other) const { @@ -142,13 +87,7 @@ bool structure::is_equal_same_type(const basic & other) const } ////////// -// new virtual structures which can be overridden by derived classes -////////// - -// none - -////////// -// non-virtual structures in this class +// non-virtual functions in this class ////////// // protected @@ -168,6 +107,4 @@ unsigned structure::register_new(const char * nm) return registered_structures().size()-1; } -#ifndef NO_NAMESPACE_GINAC } // namespace GiNaC -#endif // ndef NO_NAMESPACE_GINAC