summaryrefslogtreecommitdiff
path: root/src/expr/expr_template.h
diff options
context:
space:
mode:
authorAina Niemetz <aina.niemetz@gmail.com>2018-03-05 11:26:53 -0800
committerGitHub <noreply@github.com>2018-03-05 11:26:53 -0800
commit78cd7af7b3897d630ad375f72d43b4c67df6d557 (patch)
treec57b3ed2495c932d2487bbc2f004c0487c4910cb /src/expr/expr_template.h
parent5325b6e57714b49e8449cd5f962493aeb39d41b4 (diff)
Add uniform way to serialize containers of Expr to stream. (#1638)
Diffstat (limited to 'src/expr/expr_template.h')
-rw-r--r--src/expr/expr_template.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/expr/expr_template.h b/src/expr/expr_template.h
index cc9949c30..f406981a8 100644
--- a/src/expr/expr_template.h
+++ b/src/expr/expr_template.h
@@ -30,7 +30,10 @@ ${includes}
#include <iosfwd>
#include <iterator>
#include <string>
+#include <map>
+#include <set>
#include <unordered_map>
+#include <unordered_set>
#include "base/exception.h"
#include "options/language.h"
@@ -141,6 +144,57 @@ std::ostream& operator<<(std::ostream& out,
*/
std::ostream& operator<<(std::ostream& out, const Expr& e) CVC4_PUBLIC;
+/**
+ * Serialize a vector of expressions to given stream.
+ *
+ * @param out the output stream to use
+ * @param container the vector of expressions to output to the stream
+ * @return the stream
+ */
+std::ostream& operator<<(std::ostream& out, const std::vector<Expr>& container);
+
+/**
+ * Serialize a set of expressions to the given stream.
+ *
+ * @param out the output stream to use
+ * @param container the set of expressions to output to the stream
+ * @return the stream
+ */
+std::ostream& operator<<(std::ostream& out, const std::set<Expr>& container);
+
+/**
+ * Serialize an unordered_set of expressions to the given stream.
+ *
+ * @param out the output stream to use
+ * @param container the unordered_set of expressions to output to the stream
+ * @return the stream
+ */
+std::ostream& operator<<(
+ std::ostream& out,
+ const std::unordered_set<Expr, ExprHashFunction>& container);
+
+/**
+ * Serialize a map of expressions to the given stream.
+ *
+ * @param out the output stream to use
+ * @param container the map of expressions to output to the stream
+ * @return the stream
+ */
+template <typename V>
+std::ostream& operator<<(std::ostream& out, const std::map<Expr, V>& container);
+
+/**
+ * Serialize an unordered_map of expressions to the given stream.
+ *
+ * @param out the output stream to use
+ * @param container the unordered_map of expressions to output to the stream
+ * @return the stream
+ */
+template <typename V>
+std::ostream& operator<<(
+ std::ostream& out,
+ const std::unordered_map<Expr, V, ExprHashFunction>& container);
+
// for hash_maps, hash_sets..
struct ExprHashFunction {
size_t operator()(CVC4::Expr e) const;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback