]> www.ginac.de Git - ginac.git/blobdiff - ginac/structure.cpp
- simplify_indexed() renames dummy indices so, e.g., "a.i*a.i+a.j*a.j" gets
[ginac.git] / ginac / structure.cpp
index 0bd1d4fb6e869e178a760470df0af0967d721e3a..54dc1dfc62ae7f592eb50d362a6716a441e3ed38 100644 (file)
@@ -26,6 +26,7 @@
 #include "archive.h"
 #include "debugmsg.h"
 #include "utils.h"
+#include "print.h"
 
 namespace GiNaC {
 
@@ -47,35 +48,18 @@ DEFAULT_ARCHIVING(structure)
 // functions overriding virtual functions from bases classes
 //////////
 
-void structure::printraw(std::ostream & os) const
-{
-       debugmsg("structure printraw",LOGLEVEL_PRINT);
-
-       os << class_name() << "(hash=" << hashvalue << ",flags=" << flags << ")";
-}
-
-void structure::print(std::ostream & os, unsigned upper_precedence) const
+void structure::print(const print_context & c, unsigned level) const
 {
        debugmsg("structure print",LOGLEVEL_PRINT);
 
-       os << class_name() << "()";
-}
-
-void structure::printtree(std::ostream & os, unsigned indent) const
-{
-       debugmsg("structure printtree",LOGLEVEL_PRINT);
+       if (is_of_type(c, print_tree)) {
 
-       os << std::string(indent,' ') << "structure "
-          << "hash=" << hashvalue
-          << " (0x" << std::hex << hashvalue << std::dec << ")"
-          << ", flags=" << flags << std::endl;
-}
-
-void structure::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
-{
-       debugmsg("structure print csrc",LOGLEVEL_PRINT);
+               c.s << std::string(level, ' ') << class_name()
+                   << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
+                   << std::endl;
 
-       os << "structure()";
+       } else
+               c.s << class_name() << "()";
 }
 
 // protected