1 #ifndef ELEMENTENCODING_H
2 #define ELEMENTENCODING_H
4 #include "naiveencoder.h"
5 #include "constraint.h"
7 typedef enum ElemEnc {EENC_UNKNOWN, EENC_NONE, EENC_BOTH} ElemEnc;
9 class ElementEncoding {
11 ElementEncoding(Element *element);
12 ElementEncodingType getElementEncodingType() {return type;}
14 void setElementEncodingType(ElementEncodingType type);
15 void deleteElementEncoding();
16 void allocEncodingArrayElement(uint size);
17 void allocInUseArrayElement(uint size);
18 uint numEncodingVars() {return numVars;}
19 bool isinUseElement(uint offset) { return (inUseArray[(offset >> 6)] >> (offset & 63)) & 0x1;}
20 void setInUseElement(uint offset) {inUseArray[(offset >> 6)] |= 1 << (offset & 63);}
21 void encodingArrayInitialization();
22 uint getSizeEncodingArray(uint setSize) {
25 return NEXTPOW2(setSize);
37 ElementEncodingType type;
39 Edge *variables;/* List Variables Used To Encode Element */
42 uint64_t *encodingArray; /* List the Variables in the appropriate order */
43 uint64_t *inUseArray; /* Bitmap to track variables in use */
45 Polarity *polarityArray;
50 uint64_t offset;/* Value = offset + encoded number (interpretted according to isBinaryValSigned) */
51 uint64_t low; /* Lowest value to encode */
52 uint64_t high;/* High value to encode. If low > high, we assume wrap around to include 0. */
54 bool isBinaryValSigned;
57 uint numVars; /* Number of variables */