X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fsymbol.h;h=425f85b953d427685b20975d2e74337b569f8671;hb=4e3a4ac2bcb0837611ea31bc8fc05d84a20c33ac;hp=d547b1d6c996da49a815fc94bc8034ed649422df;hpb=703c6cebb5d3d395437e73e6935f3691aed68e0a;p=ginac.git diff --git a/ginac/symbol.h b/ginac/symbol.h index d547b1d6..425f85b9 100644 --- a/ginac/symbol.h +++ b/ginac/symbol.h @@ -3,7 +3,7 @@ * Interface to GiNaC's symbolic objects. */ /* - * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany + * 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 @@ -27,9 +27,7 @@ #include "basic.h" #include "ex.h" -#ifndef NO_NAMESPACE_GINAC namespace GiNaC { -#endif // ndef NO_NAMESPACE_GINAC /** Basic CAS symbol. It has a name because it must know how to output itself. * It may be assigned an expression, but this feature is only intended for @@ -39,34 +37,38 @@ namespace GiNaC { * first place. */ class symbol : public basic { - GINAC_DECLARE_REGISTERED_CLASS(symbol, basic) - + GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS(symbol, basic) + // types - - /** Symbols as keys to expressions. */ + + /** Symbols as keys to expressions - this is deprecated. */ class assigned_ex_info { public: - assigned_ex_info(); //!< Default ctor - bool is_assigned; //!< True if there is an expression assigned - ex assigned_expression; //!< The actual expression - unsigned refcount; //!< Yet another refcounter. PLEASE EXPLAIN! + assigned_ex_info(); ///< Default ctor + bool is_assigned; ///< True if there is an expression assigned + ex assigned_expression; ///< The actual expression + unsigned refcount; ///< Reference counter }; // member functions - - // default constructor, destructor, copy constructor assignment operator and helpers + + // default ctor, dtor, copy ctor assignment operator and helpers public: symbol(); - ~symbol(); + ~symbol() + { + /*debugmsg("symbol dtor", LOGLEVEL_DESTRUCT);*/ + destroy(false); + } symbol(const symbol & other); protected: void copy(const symbol & other); void destroy(bool call_parent); - - // other constructors + + // other ctors public: explicit symbol(const std::string & initname); - + // functions overriding virtual functions from base classes public: basic * duplicate() const; @@ -105,17 +107,13 @@ private: // member variables protected: - assigned_ex_info * asexinfop; - unsigned serial; //!< unique serial number for comparision - std::string name; + assigned_ex_info * asexinfop; ///< ptr to assigned expression, deprecated + unsigned serial; ///< unique serial number for comparison + std::string name; ///< printname of this symbol private: static unsigned next_serial; }; -// global constants - -extern const symbol some_symbol; -extern const type_info & typeid_symbol; // utility functions inline const symbol &ex_to_symbol(const ex &e) @@ -123,9 +121,10 @@ inline const symbol &ex_to_symbol(const ex &e) return static_cast(*e.bp); } + // wrapper functions around member functions inline void unassign(symbol & symarg) -{ return symarg.unassign(); } +{ symarg.unassign(); } inline int degree(const symbol & a, const symbol & s) { return a.degree(s); } @@ -133,8 +132,6 @@ inline int degree(const symbol & a, const symbol & s) inline int ldegree(const symbol & a, const symbol & s) { return a.ldegree(s); } -#ifndef NO_NAMESPACE_GINAC } // namespace GiNaC -#endif // ndef NO_NAMESPACE_GINAC #endif // ndef __GINAC_SYMBOL_H__