]> www.ginac.de Git - ginac.git/blobdiff - ginac/wildcard.cpp
mention the "dummy()" function option
[ginac.git] / ginac / wildcard.cpp
index 97fab9e919e101895a52d13d7cb9058886236906..fa4153f1b5bff0b5fc5009ad1afa5f48c74f597a 100644 (file)
 #include <iostream>
 
 #include "wildcard.h"
-#include "print.h"
 #include "archive.h"
 #include "utils.h"
 
 namespace GiNaC {
 
-GINAC_IMPLEMENT_REGISTERED_CLASS(wildcard, basic)
+GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(wildcard, basic,
+  print_func<print_context>(&wildcard::do_print).
+  print_func<print_tree>(&wildcard::do_print_tree).
+  print_func<print_python_repr>(&wildcard::do_print_python_repr))
 
 //////////
 // default constructor
@@ -82,16 +84,21 @@ int wildcard::compare_same_type(const basic & other) const
                return label < o.label ? -1 : 1;
 }
 
-void wildcard::print(const print_context & c, unsigned level) const
+void wildcard::do_print(const print_context & c, unsigned level) const
 {
-       if (is_a<print_tree>(c)) {
-               c.s << std::string(level, ' ') << class_name() << " (" << label << ")"
-                   << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
-                   << std::endl;
-       } else if (is_a<print_python_repr>(c)) {
-               c.s << class_name() << '(' << label << ')';
-       } else
-               c.s << "$" << label;
+       c.s << "$" << label;
+}
+
+void wildcard::do_print_tree(const print_tree & c, unsigned level) const
+{
+       c.s << std::string(level, ' ') << class_name() << "(" << label << ")" << " @" << this
+           << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
+           << std::endl;
+}
+
+void wildcard::do_print_python_repr(const print_python_repr & c, unsigned level) const
+{
+       c.s << class_name() << '(' << label << ')';
 }
 
 unsigned wildcard::calchash() const