* Implementation of GiNaC's wildcard objects. */
/*
- * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2016 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
-
#include "wildcard.h"
#include "archive.h"
#include "utils.h"
+#include "hash_seed.h"
+
+#include <iostream>
namespace GiNaC {
// archiving
//////////
-wildcard::wildcard(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst)
+void wildcard::read_archive(const archive_node& n, lst& sym_lst)
{
+ inherited::read_archive(n, sym_lst);
n.find_unsigned("label", label);
setflag(status_flags::evaluated | status_flags::expanded);
}
+GINAC_BIND_UNARCHIVER(wildcard);
void wildcard::archive(archive_node &n) const
{
n.add_unsigned("label", label);
}
-DEFAULT_UNARCHIVE(wildcard)
-
//////////
// functions overriding virtual functions from base classes
//////////
// this is where the schoolbook method
// (golden_ratio_hash(typeid(*this).name()) ^ label)
// is not good enough yet...
- const void* this_tinfo = (const void*)typeid(*this).name();
- hashvalue = golden_ratio_hash(golden_ratio_hash((p_int)this_tinfo) ^ label);
+ unsigned seed = make_hash_seed(typeid(*this));
+ hashvalue = golden_ratio_hash(seed ^ label);
setflag(status_flags::hash_calculated);
return hashvalue;
}