pickler.h
Go to the documentation of this file.
/********************* */
#include "cvc4_public.h"
#ifndef __CVC4__PICKLER_H
#define __CVC4__PICKLER_H
#include "expr/variable_type_map.h"
#include "expr/expr.h"
#include "util/exception.h"
#include <exception>
#include <stack>
namespace CVC4 {
class ExprManager;
namespace expr {
namespace pickle {
class Pickler;
class PicklerPrivate;
class PickleData;// CVC4-internal representation
class CVC4_PUBLIC Pickle {
PickleData* d_data;
friend class Pickler;
friend class PicklerPrivate;
public:
Pickle();
Pickle(const Pickle& p);
~Pickle();
Pickle& operator=(const Pickle& other);
};/* class Pickle */
class CVC4_PUBLIC PicklingException : public Exception {
public:
PicklingException() :
Exception("Pickling failed") {
}
};/* class PicklingException */
class CVC4_PUBLIC Pickler {
PicklerPrivate* d_private;
friend class PicklerPrivate;
protected:
virtual uint64_t variableToMap(uint64_t x) const
throw(PicklingException) {
return x;
}
virtual uint64_t variableFromMap(uint64_t x) const {
return x;
}
public:
Pickler(ExprManager* em);
~Pickler();
void toPickle(Expr e, Pickle& p) throw(PicklingException);
Expr fromPickle(Pickle& p);
static void debugPickleTest(Expr e);
};/* class Pickler */
class CVC4_PUBLIC MapPickler : public Pickler {
private:
const VarMap& d_toMap;
const VarMap& d_fromMap;
public:
MapPickler(ExprManager* em, const VarMap& to, const VarMap& from):
Pickler(em),
d_toMap(to),
d_fromMap(from) {
}
virtual ~MapPickler() throw() {}
protected:
virtual uint64_t variableToMap(uint64_t x) const
throw(PicklingException) {
VarMap::const_iterator i = d_toMap.find(x);
if(i != d_toMap.end()) {
return i->second;
} else {
throw PicklingException();
}
}
virtual uint64_t variableFromMap(uint64_t x) const;
};/* class MapPickler */
}/* CVC4::expr::pickle namespace */
}/* CVC4::expr namespace */
}/* CVC4 namespace */
#endif /* __CVC4__PICKLER_H */
ExprManager
void * ExprManager
Definition c_interface_defs.h:43
CVC4::Exception
Definition exception.h:32
CVC4::ExprManager
Definition expr_manager.h:124
CVC4::Expr
Class encapsulating CVC4 expressions and methods for constructing new expressions.
Definition expr.h:227
CVC4::expr::pickle::MapPickler
Definition pickler.h:102
CVC4::expr::pickle::MapPickler::variableFromMap
virtual uint64_t variableFromMap(uint64_t x) const
CVC4::expr::pickle::MapPickler::~MapPickler
virtual ~MapPickler()
Definition pickler.h:114
CVC4::expr::pickle::MapPickler::MapPickler
MapPickler(ExprManager *em, const VarMap &to, const VarMap &from)
Definition pickler.h:108
CVC4::expr::pickle::MapPickler::variableToMap
virtual uint64_t variableToMap(uint64_t x) const
Definition pickler.h:118
CVC4::expr::pickle::Pickle
Definition pickler.h:43
CVC4::expr::pickle::Pickle::~Pickle
~Pickle()
CVC4::expr::pickle::Pickle::Pickle
Pickle()
CVC4::expr::pickle::Pickle::Pickle
Pickle(const Pickle &p)
CVC4::expr::pickle::Pickle::operator=
Pickle & operator=(const Pickle &other)
CVC4::expr::pickle::Pickler
Definition pickler.h:61
CVC4::expr::pickle::Pickler::~Pickler
~Pickler()
CVC4::expr::pickle::Pickler::variableFromMap
virtual uint64_t variableFromMap(uint64_t x) const
Definition pickler.h:71
CVC4::expr::pickle::Pickler::Pickler
Pickler(ExprManager *em)
CVC4::expr::pickle::Pickler::debugPickleTest
static void debugPickleTest(Expr e)
CVC4::expr::pickle::Pickler::fromPickle
Expr fromPickle(Pickle &p)
Constructs a node from a Pickle.
CVC4::expr::pickle::Pickler::variableToMap
virtual uint64_t variableToMap(uint64_t x) const
Definition pickler.h:67
CVC4::expr::pickle::Pickler::toPickle
void toPickle(Expr e, Pickle &p)
Constructs a new Pickle of the node n.
CVC4::expr::pickle::PicklingException
Definition pickler.h:54
CVC4::expr::pickle::PicklingException::PicklingException
PicklingException()
Definition pickler.h:56
cvc4_public.h
Macros that should be defined everywhere during the building of the libraries and driver binary,...
CVC4_PUBLIC
#define CVC4_PUBLIC
Definition cvc4_public.h:30
exception.h
CVC4's exception base class and some associated utilities.
expr.h
CVC4
Definition expr.h:106
CVC4::VarMap
__gnu_cxx::hash_map< uint64_t, uint64_t > VarMap
Definition variable_type_map.h:52
variable_type_map.h
[[ Add one-line brief description here ]]