*
* 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
*
* 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
struct property_info {
property_info() {}
property_info(property_type t, const std::string &n, unsigned c = 1) : type(t), name(n), count(c) {}
struct property_info {
property_info() {}
property_info(property_type t, const std::string &n, unsigned c = 1) : type(t), name(n), count(c) {}
archive_node() : a(*dummy_ar_creator()), has_expression(false) {} // hack for cint which always requires a default constructor
archive_node(archive &ar) : a(ar), has_expression(false) {}
archive_node(archive &ar, const ex &expr);
archive_node() : a(*dummy_ar_creator()), has_expression(false) {} // hack for cint which always requires a default constructor
archive_node(archive &ar) : a(ar), has_expression(false) {}
archive_node(archive &ar, const ex &expr);
const archive_node &operator=(const archive_node &other);
/** Add property of type "bool" to node. */
const archive_node &operator=(const archive_node &other);
/** Add property of type "bool" to node. */
/** Retrieve property of type "ex" from node.
* @return "true" if property was found, "false" otherwise */
/** Retrieve property of type "ex" from node.
* @return "true" if property was found, "false" otherwise */
- bool find_ex(const std::string &name, ex &ret, const lst &sym_lst, unsigned index = 0) const;
+ bool find_ex(const std::string &name, ex &ret, lst &sym_lst, unsigned index = 0) const;
/** Archived property (data type, name and associated data) */
struct property {
property() {}
property(archive_atom n, property_type t, unsigned v) : type(t), name(n), value(v) {}
/** Archived property (data type, name and associated data) */
struct property {
property() {}
property(archive_atom n, property_type t, unsigned v) : type(t), name(n), value(v) {}
void archive_ex(const ex &e, const char *name);
/** Retrieve expression from archive by name.
void archive_ex(const ex &e, const char *name);
/** Retrieve expression from archive by name.
ex unarchive_ex(const lst &sym_lst, const char *name) const;
/** Retrieve expression from archive by index.
* @param sym_lst list of pre-defined symbols
ex unarchive_ex(const lst &sym_lst, const char *name) const;
/** Retrieve expression from archive by index.
* @param sym_lst list of pre-defined symbols
* @see count_expressions */
ex unarchive_ex(const lst &sym_lst, unsigned index = 0) const;
/** Retrieve expression and its name from archive by index.
* @param sym_lst list of pre-defined symbols
* @param name receives the name of the expression
* @see count_expressions */
ex unarchive_ex(const lst &sym_lst, unsigned index = 0) const;
/** Retrieve expression and its name from archive by index.
* @param sym_lst list of pre-defined symbols
* @param name receives the name of the expression
* @see count_expressions */
ex unarchive_ex(const lst &sym_lst, std::string &name, unsigned index = 0) const;
/** Return number of archived expressions. */
* @see count_expressions */
ex unarchive_ex(const lst &sym_lst, std::string &name, unsigned index = 0) const;
/** Return number of archived expressions. */
/** Return reference to top node of an expression specified by index. */
const archive_node &get_top_node(unsigned index = 0) const;
/** Clear all archived expressions. */
/** Return reference to top node of an expression specified by index. */
const archive_node &get_top_node(unsigned index = 0) const;
/** Clear all archived expressions. */
private:
/** Vector of atomized strings (using a vector allows faster unarchiving). */
mutable std::vector<std::string> atoms;
private:
/** Vector of atomized strings (using a vector allows faster unarchiving). */
mutable std::vector<std::string> atoms;
+
+ /** Map of stored expressions to nodes for faster archiving */
+ typedef std::map<ex, archive_node_id, ex_is_less>::iterator mapit;
+ mutable std::map<ex, archive_node_id, ex_is_less> exprtable;