public:
BooleanPredicate(Predicate *_predicate, Element **_inputs, uint _numInputs, BooleanEdge _undefinedStatus);
Boolean *clone(CSolver *solver, CloneMap *map);
- CMEMALLOC;
+ Predicate *getPredicate() {return predicate;}
+ FunctionEncoding *getFunctionEncoding() {return &encoding;}
+ void updateParents();
+ void serialize(Serializer *serializer );
+
++ CMEMALLOC;
+
Predicate *predicate;
FunctionEncoding encoding;
Array<Element *> inputs;
BooleanEdge overflowstatus;
FunctionEncoding functionencoding;
Element *clone(CSolver *solver, CloneMap *map);
+ virtual void serialize(Serializer* serializer);
Set * getRange();
void updateParents();
+ Function * getFunction() {return function;}
CMEMALLOC;
+ private:
+ Function *function;
};
static inline ElementEncoding *getElementEncoding(Element *e) {
PredicateOperator(CompOp op, Set **domain, uint numDomain);
bool evalPredicateOperator(uint64_t *inputs);
Predicate *clone(CSolver *solver, CloneMap *map);
- CompOp getOp() {return op;}
+ virtual void serialize(Serializer* serializer);
- CompOp op;
Array<Set *> domains;
++ CompOp getOp() {return op;}
CMEMALLOC;
+ private:
+ CompOp op;
};
class PredicateTable : public Predicate {
typedef Hashset<Boolean *, uintptr_t, PTRSHIFT> HashsetBoolean;
typedef Hashset<Element *, uintptr_t, PTRSHIFT> HashsetElement;
typedef SetIterator<Boolean *, uintptr_t, PTRSHIFT> SetIteratorBoolean;
+typedef Hashset<uint64_t, uint64_t, 0> Hashset64Int;
+
+
typedef Hashtable<OrderNode *, HashsetOrderNode *, uintptr_t, PTRSHIFT> HashtableNodeToNodeSet;
typedef Hashtable<OrderPair *, OrderPair *, uintptr_t, PTRSHIFT, order_pair_hash_function, order_pair_equals> HashtableOrderPair;
typedef Hashtable<void *, void *, uintptr_t, PTRSHIFT> CloneMap;
-typedef Hashtable<Set *, EncodingNode *, uintptr_t, PTRSHIFT> HashTableEncoding;
+typedef Hashtable<Set *, EncodingNode *, uintptr_t, PTRSHIFT> HashtableEncoding;
- typedef Hashset<EncodingNode *, uintptr_t, PTRSHIFT> HashsetEncodingNode;
- typedef SetIterator<EncodingNode *, uintptr_t, PTRSHIFT> SetIteratorEncodingNode;
+
typedef SetIterator<TableEntry *, uintptr_t, PTRSHIFT, table_entry_hash_function, table_entry_equals> SetIteratorTableEntry;
typedef SetIterator<OrderEdge *, uintptr_t, PTRSHIFT, order_edge_hash_function, order_edge_equals> SetIteratorOrderEdge;
--- /dev/null
+
+ /*
+ * File: serializer.h
+ * Author: hamed
+ *
+ * Created on September 7, 2017, 3:38 PM
+ */
+
+ #ifndef SERIALIZER_H
+ #define SERIALIZER_H
+ #include "mymemory.h"
++#include "classlist.h"
+ #include "structs.h"
+
++
+ class Serializer {
+ public:
+ Serializer(const char *file);
+ void mywrite(const void *__buf, size_t __n);
+ inline bool isSerialized(void *obj);
+ inline void addObject(void *obj) { map.put(obj, obj);}
+ virtual ~Serializer();
+ CMEMALLOC;
+ private:
+ int filedesc;
+ CloneMap map;
+ };
+
+ inline bool Serializer::isSerialized(void* obj){
+ return map.contains(obj);
+ }
+
+
+
+
+ void serializeBooleanEdge(Serializer* serializer, BooleanEdge be);
+
+ #endif /* SERIALIZER_H */
+