X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;ds=sidebyside;f=ginac%2Fstructure.cpp;h=fae3b2aecc7bdb0f75189a46d887f175e2554a29;hb=2bb16a36176246de7cd5c1ab2044c43f5a35115b;hp=c8c0e2b0dd7812859720b93da8b1d2a8748f9d03;hpb=e7cc6a764ff67b5885d6633385fac23ccc1dc9a7;p=ginac.git diff --git a/ginac/structure.cpp b/ginac/structure.cpp index c8c0e2b0..fae3b2ae 100644 --- a/ginac/structure.cpp +++ b/ginac/structure.cpp @@ -1,9 +1,9 @@ /** @file structure.cpp * - * Implementation of 'abstract' class structure. */ + * Wrapper template for making GiNaC classes out of C++ structures. */ /* - * GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2005 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 @@ -17,78 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include - #include "structure.h" -#include "archive.h" -#include "utils.h" -#include "print.h" namespace GiNaC { -GINAC_IMPLEMENT_REGISTERED_CLASS(structure, basic) - -////////// -// default ctor, dtor, copy ctor, assignment operator and helpers -////////// - -DEFAULT_CTORS(structure) - -////////// -// archiving -////////// - -DEFAULT_ARCHIVING(structure) - -////////// -// functions overriding virtual functions from base classes -////////// - -void structure::print(const print_context & c, unsigned level) const -{ - if (is_a(c)) { - - c.s << std::string(level, ' ') << class_name() - << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec - << std::endl; - - } else - c.s << class_name() << "()"; -} - -// protected - -DEFAULT_COMPARE(structure) - -bool structure::is_equal_same_type(const basic & other) const -{ - GINAC_ASSERT(is_a(other)); - return true; // all structures are the same -} - -////////// -// non-virtual functions in this class -////////// - -// protected - -std::vector & structure::registered_structures(void) -{ - static std::vector * rs = new std::vector; - return *rs; -} - -// public - -unsigned structure::register_new(const char * nm) -{ - registered_structure_info rsi={nm}; - registered_structures().push_back(rsi); - return registered_structures().size()-1; -} +/** Next free tinfo_key for structure types. */ +unsigned next_structure_tinfo_key = TINFO_structure; } // namespace GiNaC