]> www.ginac.de Git - ginac.git/blobdiff - ginac/symbol.h
refactor gcd() a little bit (no functional changes).
[ginac.git] / ginac / symbol.h
index 90013144ccd5d7f88e28a280055b54c814c193df..e38ed6763bbde01c7750099eaaf31ba9b8c09b2b 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to GiNaC's symbolic objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2006 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2008 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
@@ -41,6 +41,7 @@ class symbol : public basic
        GINAC_DECLARE_REGISTERED_CLASS(symbol, basic)
 
        friend class realsymbol;
+       friend class possymbol;
 
 // types
        
@@ -127,6 +128,19 @@ public:
 };
 
 
+/** Specialization of symbol to real domain */
+class possymbol : public symbol
+{
+       // constructors
+public:
+       possymbol();
+       explicit possymbol(const std::string & initname, unsigned domain = domain::positive);
+       possymbol(const std::string & initname, const std::string & texname, unsigned domain = domain::positive);
+       possymbol(const std::string & initname, unsigned rt, tinfo_t rtt, unsigned domain = domain::positive);
+       possymbol(const std::string & initname, const std::string & texname, unsigned rt, tinfo_t rtt, unsigned domain = domain::positive);
+};
+
+
 // utility functions
 
 /** Specialization of is_exactly_a<realsymbol>(obj) for realsymbol objects. */
@@ -138,6 +152,15 @@ template<> inline bool is_exactly_a<realsymbol>(const basic & obj)
        return domain==domain::real || domain==domain::positive;
 }
 
+/** Specialization of is_exactly_a<possymbol>(obj) for possymbol objects. */
+template<> inline bool is_exactly_a<possymbol>(const basic & obj)
+{
+       if (obj.tinfo() != &symbol::tinfo_static)
+               return false;
+       unsigned domain = static_cast<const symbol &>(obj).get_domain();
+       return domain == domain::positive;
+}
+
 // wrapper functions around member functions
 inline void unassign(symbol & symarg)
 { symarg.unassign(); }