X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fstructure.h;h=867cd42dd2cb786ead3d346ba72dfad0872ab5c3;hb=9ada7a7f5c47e512b7bf6057d4c013612be9a33b;hp=6c08618c7c4a7752e4033b0db2dbe65213ec3456;hpb=09988aee53a2bfef87fc887a434b4c78d6326c47;p=ginac.git diff --git a/ginac/structure.h b/ginac/structure.h index 6c08618c..867cd42d 100644 --- a/ginac/structure.h +++ b/ginac/structure.h @@ -3,7 +3,7 @@ * Wrapper template for making GiNaC classes out of C++ structures. */ /* - * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2011 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 @@ -20,10 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __GINAC_STRUCTURE_H__ -#define __GINAC_STRUCTURE_H__ - -#include +#ifndef GINAC_STRUCTURE_H +#define GINAC_STRUCTURE_H #include "ex.h" #include "ncmul.h" @@ -31,8 +29,9 @@ #include "operators.h" #include "print.h" -namespace GiNaC { +#include +namespace GiNaC { /** Comparison policy: all structures of one type are equal */ template @@ -117,13 +116,11 @@ class structure : public basic, public ComparisonPolicy { GINAC_DECLARE_REGISTERED_CLASS(structure, basic) // helpers - static tinfo_t get_tinfo() { return reg_info.options.get_id(); } static const char *get_class_name() { return "structure"; } - // constructors public: /** Construct structure as a copy of a given C++ structure. */ - structure(const T & t) : inherited(get_tinfo()), obj(t) { } + structure(const T & t) : obj(t) { } // functions overriding virtual functions from base classes // All these are just defaults that can be specialized by the user @@ -213,7 +210,7 @@ protected: GINAC_ASSERT(is_a(other)); const structure & o = static_cast(other); - return struct_is_equal(&obj, &o.obj); + return this->struct_is_equal(&obj, &o.obj); } unsigned calchash() const { return inherited::calchash(); } @@ -231,25 +228,7 @@ private: /** Default constructor */ template class CP> -structure::structure() : inherited(get_tinfo()) { } - -/** Construct object from archive_node. */ -template class CP> -structure::structure(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) {} - -/** Unarchive the object. */ -template class CP> -ex structure::unarchive(const archive_node &n, lst &sym_lst) -{ - return (new structure(n, sym_lst))->setflag(status_flags::dynallocated); -} - -/** Archive the object. */ -template class CP> -void structure::archive(archive_node &n) const -{ - inherited::archive(n); -} +structure::structure() { } /** Compare two structures of the same type. */ template class CP> @@ -258,13 +237,12 @@ int structure::compare_same_type(const basic & other) const GINAC_ASSERT(is_a(other)); const structure & o = static_cast(other); - return struct_compare(&obj, &o.obj); + return this->struct_compare(&obj, &o.obj); } template class CP> -registered_class_info structure::reg_info = registered_class_info(registered_class_options(structure::get_class_name(), "basic", typeid(structure), &structure::unarchive)); - +registered_class_info structure::reg_info = registered_class_info(registered_class_options(structure::get_class_name(), "basic", typeid(structure))); } // namespace GiNaC -#endif // ndef __GINAC_STRUCTURE_H__ +#endif // ndef GINAC_STRUCTURE_H