X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Farchive.h;h=8b7a3e4a566b971701ff35f346dcab34133b9f4c;hb=c97593c0903a847e84c7ae4aad182bafb6430ffd;hp=30c36b6b7231dde84336455d7ff86f2f4d4c2007;hpb=0052e44b34c982b13b08454fd6c9429fe7a90f71;p=ginac.git diff --git a/ginac/archive.h b/ginac/archive.h index 30c36b6b..8b7a3e4a 100644 --- a/ginac/archive.h +++ b/ginac/archive.h @@ -3,7 +3,7 @@ * Archiving of GiNaC expressions. */ /* - * GiNaC Copyright (C) 1999-2016 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2024 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 @@ -82,8 +82,10 @@ public: unsigned value; /**< Stored value. */ }; typedef std::vector::const_iterator archive_node_cit; + struct archive_node_cit_range { + archive_node_cit begin, end; + }; - 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); @@ -114,17 +116,22 @@ public: bool find_string(const std::string &name, std::string &ret, unsigned index = 0) const; /** Find the location in the vector of properties of the first/last - * property with a given name. */ + * property with a given name. */ archive_node_cit find_first(const std::string &name) const; archive_node_cit find_last(const std::string &name) const; + /** Find a range of locations in the vector of properties. The result + * begins at the first property with name1 and ends one past the last + * property with name2. */ + archive_node_cit_range find_property_range(const std::string &name1, const std::string &name2) const; + /** Retrieve property of type "ex" from node. * @return "true" if property was found, "false" otherwise */ bool find_ex(const std::string &name, ex &ret, lst &sym_lst, unsigned index = 0) const; /** Retrieve property of type "ex" from the node if it is known - * that this node in fact contains such a property at the given - * location. This is much more efficient than the preceding function. */ + * that this node in fact contains such a property at the given + * location. This is much more efficient than the preceding function. */ void find_ex_by_loc(archive_node_cit loc, ex &ret, lst &sym_lst) const; /** Retrieve property of type "ex" from node, returning the node of @@ -143,8 +150,6 @@ public: void printraw(std::ostream &os) const; private: - static archive* dummy_ar_creator(); - /** Reference to the archive to which this node belongs. */ archive &a; @@ -274,14 +279,14 @@ public: /** Retrieve expression from archive by index. * @param sym_lst list of pre-defined symbols * @param index index of expression - * @see count_expressions */ + * @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 * @param index index of expression - * @see count_expressions */ + * @see count_expressions */ ex unarchive_ex(const lst &sym_lst, std::string &name, unsigned index = 0) const; /** Return number of archived expressions. */ @@ -329,7 +334,6 @@ private: mutable std::map inverse_atoms; /** Map of stored expressions to nodes for faster archiving */ - typedef std::map::iterator mapit; mutable std::map exprtable; };