1 /** @file structure.cpp
3 * Implementation of 'abstract' class structure. */
6 * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "structure.h"
32 GINAC_IMPLEMENT_REGISTERED_CLASS(structure, basic)
35 // default ctor, dtor, copy ctor, assignment operator and helpers
38 DEFAULT_CTORS(structure)
44 DEFAULT_ARCHIVING(structure)
47 // functions overriding virtual functions from base classes
50 void structure::print(const print_context & c, unsigned level) const
52 if (is_a<print_tree>(c)) {
54 c.s << std::string(level, ' ') << class_name()
55 << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
59 c.s << class_name() << "()";
64 DEFAULT_COMPARE(structure)
66 bool structure::is_equal_same_type(const basic & other) const
68 GINAC_ASSERT(is_a<structure>(other));
69 return true; // all structures are the same
73 // non-virtual functions in this class
78 std::vector<registered_structure_info> & structure::registered_structures(void)
80 static std::vector<registered_structure_info> * rs = new std::vector<registered_structure_info>;
86 unsigned structure::register_new(const char * nm)
88 registered_structure_info rsi={nm};
89 registered_structures().push_back(rsi);
90 return registered_structures().size()-1;