cvc4-1.4
pickler.h
Go to the documentation of this file.
1/********************* */
19#include "cvc4_public.h"
20
21#ifndef __CVC4__PICKLER_H
22#define __CVC4__PICKLER_H
23
25#include "expr/expr.h"
26#include "util/exception.h"
27
28#include <exception>
29#include <stack>
30
31namespace CVC4 {
32
33class ExprManager;
34
35namespace expr {
36namespace pickle {
37
38class Pickler;
39class PicklerPrivate;
40
41class PickleData;// CVC4-internal representation
42
44 PickleData* d_data;
45 friend class Pickler;
46 friend class PicklerPrivate;
47public:
49 Pickle(const Pickle& p);
51 Pickle& operator=(const Pickle& other);
52};/* class Pickle */
53
55public:
57 Exception("Pickling failed") {
58 }
59};/* class PicklingException */
60
62 PicklerPrivate* d_private;
63
64 friend class PicklerPrivate;
65
66protected:
67 virtual uint64_t variableToMap(uint64_t x) const
68 throw(PicklingException) {
69 return x;
70 }
71 virtual uint64_t variableFromMap(uint64_t x) const {
72 return x;
73 }
74
75public:
78
89
97
98 static void debugPickleTest(Expr e);
99
100};/* class Pickler */
101
103private:
104 const VarMap& d_toMap;
105 const VarMap& d_fromMap;
106
107public:
108 MapPickler(ExprManager* em, const VarMap& to, const VarMap& from):
109 Pickler(em),
110 d_toMap(to),
111 d_fromMap(from) {
112 }
113
114 virtual ~MapPickler() throw() {}
115
116protected:
117
118 virtual uint64_t variableToMap(uint64_t x) const
119 throw(PicklingException) {
120 VarMap::const_iterator i = d_toMap.find(x);
121 if(i != d_toMap.end()) {
122 return i->second;
123 } else {
124 throw PicklingException();
125 }
126 }
127
128 virtual uint64_t variableFromMap(uint64_t x) const;
129};/* class MapPickler */
130
131}/* CVC4::expr::pickle namespace */
132}/* CVC4::expr namespace */
133}/* CVC4 namespace */
134
135#endif /* __CVC4__PICKLER_H */
void * ExprManager
Class encapsulating CVC4 expressions and methods for constructing new expressions.
Definition expr.h:227
virtual uint64_t variableFromMap(uint64_t x) const
MapPickler(ExprManager *em, const VarMap &to, const VarMap &from)
Definition pickler.h:108
virtual uint64_t variableToMap(uint64_t x) const
Definition pickler.h:118
Pickle(const Pickle &p)
Pickle & operator=(const Pickle &other)
virtual uint64_t variableFromMap(uint64_t x) const
Definition pickler.h:71
Pickler(ExprManager *em)
static void debugPickleTest(Expr e)
Expr fromPickle(Pickle &p)
Constructs a node from a Pickle.
virtual uint64_t variableToMap(uint64_t x) const
Definition pickler.h:67
void toPickle(Expr e, Pickle &p)
Constructs a new Pickle of the node n.
Macros that should be defined everywhere during the building of the libraries and driver binary,...
#define CVC4_PUBLIC
Definition cvc4_public.h:30
CVC4's exception base class and some associated utilities.
Definition expr.h:106
__gnu_cxx::hash_map< uint64_t, uint64_t > VarMap
[[ Add one-line brief description here ]]