* Implementation of 'abstract' class structure. */
/*
- * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2002 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <iostream>
#include <string>
#include "structure.h"
#include "archive.h"
-#include "debugmsg.h"
#include "utils.h"
+#include "print.h"
namespace GiNaC {
GINAC_IMPLEMENT_REGISTERED_CLASS(structure, basic)
//////////
-// default ctor, dtor, copy ctor assignment operator and helpers
+// default ctor, dtor, copy ctor, assignment operator and helpers
//////////
DEFAULT_CTORS(structure)
DEFAULT_ARCHIVING(structure)
//////////
-// functions overriding virtual functions from bases classes
+// functions overriding virtual functions from base classes
//////////
-void structure::printraw(std::ostream & os) const
+void structure::print(const print_context & c, unsigned level) const
{
- debugmsg("structure printraw",LOGLEVEL_PRINT);
+ if (is_a<print_tree>(c)) {
- os << class_name() << "(hash=" << hashvalue << ",flags=" << flags << ")";
-}
-
-void structure::print(std::ostream & os, unsigned upper_precedence) const
-{
- debugmsg("structure print",LOGLEVEL_PRINT);
-
- os << class_name() << "()";
-}
-
-void structure::printtree(std::ostream & os, unsigned indent) const
-{
- debugmsg("structure printtree",LOGLEVEL_PRINT);
-
- 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
bool structure::is_equal_same_type(const basic & other) const
{
- GINAC_ASSERT(is_of_type(other, structure));
+ GINAC_ASSERT(is_a<structure>(other));
return true; // all structures are the same
}