X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fstructure.h;h=62848b227a86b4f931ec9642ea453c3d1ef14ad4;hp=b1c8bef7480cde3dc4c953c1b1c5087d7f9e869e;hb=ad5f751e9387ba148cc54c9961d50c37ee879fae;hpb=6b3768e8c544739ae53321539cb4d1e3112ded1b diff --git a/ginac/structure.h b/ginac/structure.h index b1c8bef7..62848b22 100644 --- a/ginac/structure.h +++ b/ginac/structure.h @@ -2,69 +2,58 @@ * * Interface to 'abstract' class structure. */ -#ifndef _STRUCTURE_H_ -#define _STRUCTURE_H_ +/* + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + */ -class structure; +#ifndef __GINAC_STRUCTURE_H__ +#define __GINAC_STRUCTURE_H__ #include "basic.h" +namespace GiNaC { + struct registered_structure_info { - char const * name; + const char * name; }; /** The class structure is used to implement user defined classes - with named members which behave similar to ordinary C structs. - structure is an 'abstract' base class (it is possible but not - meaningful to make instances), the user defined structures - will be create by the perl script structure.pl */ + with named members which behave similar to ordinary C structs. + structure is an 'abstract' base class (it is possible but not + meaningful to make instances), the user defined structures + will be create by the perl script structure.pl */ class structure : public basic { -// member functions - - // default constructor, destructor, copy constructor assignment operator and helpers + GINAC_DECLARE_REGISTERED_CLASS(structure, basic) + + // functions overriding virtual functions from bases classes public: - structure(); - ~structure(); - structure(structure const & other); - structure const & operator=(structure const & other); + void print(const print_context & c, unsigned level=0) const; protected: - void copy(structure const & other); - void destroy(bool call_parent); - - // other constructors - // none - - // functions overriding virtual functions from bases classes -public: - basic * duplicate() const; - void printraw(ostream & os) const; - void print(ostream & os, unsigned upper_precedence=0) const; - void printtree(ostream & os, unsigned indent) const; - void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; -protected: - int compare_same_type(basic const & other) const; - bool is_equal_same_type(basic const & other) const; - - // new virtual functions which can be overridden by derived classes - // none - - // non-virtual functions in this class + bool is_equal_same_type(const basic & other) const; + + // non-virtual functions in this class protected: - static vector & registered_structures(void); + static std::vector & registered_structures(void); public: - static unsigned register_new(char const * nm); - -// member variables -// none - + static unsigned register_new(const char * nm); }; -// global constants - -extern const structure some_structure; -extern type_info const & typeid_structure; - -#endif // ndef _STRUCTURE_H_ +} // namespace GiNaC +#endif // ndef __GINAC_STRUCTURE_H__