X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fbasic.cpp;h=7b6a6fbeb5b2ffda4ebeb267d32d8ddf6bcef82b;hp=0b713b8855049acb71982079349bbfcd997d9cba;hb=955cb185a85535ab328ffedbfccdc508ce80fa91;hpb=66c0f31c678e6c1938d637636b230ea376c157c1 diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 0b713b88..7b6a6fbe 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -1,7 +1,8 @@ /** @file basic.cpp * - * Implementation of GiNaC's ABC. - * + * Implementation of GiNaC's ABC. */ + +/* * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify @@ -31,6 +32,11 @@ #include "lst.h" #include "ncmul.h" #include "utils.h" +#include "debugmsg.h" + +#ifndef NO_GINAC_NAMESPACE +namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE ////////// // default constructor, destructor, copy constructor assignment operator and helpers @@ -49,7 +55,7 @@ basic::~basic() { debugmsg("basic destructor",LOGLEVEL_DESTRUCT); destroy(0); - ASSERT((!(flags & status_flags::dynallocated))||(refcount==0)); + GINAC_ASSERT((!(flags & status_flags::dynallocated))||(refcount==0)); } basic::basic(basic const & other) : flags(0), refcount(0), tinfo_key(TINFO_BASIC) @@ -104,6 +110,59 @@ basic::basic(unsigned ti) : flags(0), refcount(0), tinfo_key(ti) // public +/** Output to stream formatted to be useful as ginsh input. */ +void basic::print(ostream & os, unsigned upper_precedence) const +{ + debugmsg("basic print",LOGLEVEL_PRINT); + os << "[basic object]"; +} + +/** Output to stream in ugly raw format, so brave developers can have a look + * at the underlying structure. */ +void basic::printraw(ostream & os) const +{ + debugmsg("basic printraw",LOGLEVEL_PRINT); + os << "[basic object]"; +} + +/** Output to stream formatted in tree- (indented-) form, so developers can + * have a look at the underlying structure. */ +void basic::printtree(ostream & os, unsigned indent) const +{ + debugmsg("basic printtree",LOGLEVEL_PRINT); + os << string(indent,' ') << "type=" << typeid(*this).name() + << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")" + << ", flags=" << flags + << ", nops=" << nops() << endl; + for (int i=0; i0) { for (int i=0; i