/** basic copy constructor: implicitly assumes that the other class is of
* the exact same type (as it's used by duplicate()), so it can copy the
* tinfo_key and the hash value. */
-basic::basic(const basic & other) : tinfo_key(other.tinfo_key), flags(other.flags & ~status_flags::dynallocated), hashvalue(other.hashvalue), refcount(0)
+basic::basic(const basic & other) : tinfo_key(other.tinfo_key), flags(other.flags & ~status_flags::dynallocated), hashvalue(other.hashvalue)
{
GINAC_ASSERT(typeid(*this) == typeid(other));
}
hashvalue = other.hashvalue;
}
flags = fl;
- refcount = 0;
+ set_refcount(0);
return *this;
}
//////////
/** Construct object from archive_node. */
-basic::basic(const archive_node &n, lst &sym_lst) : flags(0), refcount(0)
+basic::basic(const archive_node &n, lst &sym_lst) : flags(0)
{
// Reconstruct tinfo_key from class name
std::string class_name;
/** Tree output to stream. */
void basic::do_print_tree(const print_tree & c, unsigned level) const
{
- c.s << std::string(level, ' ') << class_name()
+ c.s << std::string(level, ' ') << class_name() << " @" << this
<< std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec;
if (nops())
c.s << ", nops=" << nops();
* is not the case. */
void basic::ensure_if_modifiable() const
{
- if (refcount > 1)
+ if (get_refcount() > 1)
throw(std::runtime_error("cannot modify multiply referenced object"));
clearflag(status_flags::hash_calculated | status_flags::evaluated);
}