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)] |= ((uint64_t)1) << (offset & 63);}
21 void encodingArrayInitialization();
22 uint getSizeEncodingArray(uint setSize) {
25 return NEXTPOW2(setSize);
36 ElementEncodingType type;
38 Edge *variables;/* List Variables Used To Encode Element */
41 uint64_t *encodingArray; /* List the Variables in the appropriate order */
42 uint64_t *inUseArray; /* Bitmap to track variables in use */
44 Polarity *polarityArray;
49 uint64_t offset;/* Value = offset + encoded number (interpretted according to isBinaryValSigned) */
50 uint64_t low; /* Lowest value to encode */
51 uint64_t high;/* High value to encode. If low > high, we assume wrap around to include 0. */
53 bool isBinaryValSigned;
56 uint numVars; /* Number of variables */