1 #ifndef ELEMENTENCODING_H
2 #define ELEMENTENCODING_H
4 #include "naiveencoder.h"
6 enum ElementEncodingType {
7 ELEM_UNASSIGNED, ONEHOT, UNARY, BINARYINDEX, ONEHOTBINARY, BINARYVAL
10 typedef enum ElementEncodingType ElementEncodingType;
12 struct ElementEncoding {
13 ElementEncodingType type;
15 Constraint ** variables;/* List Variables Used To Encode Element */
16 uint64_t * encodingArray; /* List the Variables in the appropriate order */
17 uint64_t * inUseArray;/* Bitmap to track variables in use */
19 uint numVars; /* Number of variables */
22 void initElementEncoding(ElementEncoding *This, Element *element);
23 void setElementEncodingType(ElementEncoding* This, ElementEncodingType type);
24 void deleteElementEncoding(ElementEncoding *This);
25 void allocEncodingArrayElement(ElementEncoding *This, uint size);
26 void allocInUseArrayElement(ElementEncoding *This, uint size);
27 static inline bool isinUseElement(ElementEncoding *This, uint offset) {
28 return (This->inUseArray[(offset>>6)] >> (offset & 63)) &0x1;
31 static inline void setInUseElement(ElementEncoding *This, uint offset) {
32 This->inUseArray[(offset>>6)] |= 1 << (offset & 63);
35 void generateBinaryIndexEncodingVars(SATEncoder* encode, ElementEncoding* This);
36 void generateElementEncodingVariables(SATEncoder* encoder, ElementEncoding* This);