1 #ifndef ELEMENTENCODING_H
2 #define ELEMENTENCODING_H
5 enum ElementEncodingType {
6 ELEM_UNASSIGNED, ONEHOT, UNARY, BINARYINDEX, ONEHOTBINARY, BINARYVAL
9 typedef enum ElementEncodingType ElementEncodingType;
11 struct ElementEncoding {
12 ElementEncodingType type;
14 Constraint ** variables;/* List Variables Used To Encode Element */
15 uint64_t * encodingArray; /* List the Variables in the appropriate order */
16 uint64_t * inUseArray;/* Bitmap to track variables in use */
17 uint numVars; /* Number of variables */
20 void initElementEncoding(ElementEncoding *This, Element *element);
21 void deleteElementEncoding(ElementEncoding *This);
22 void baseBinaryIndexElementAssign(ElementEncoding *This);
23 void allocEncodingArrayElement(ElementEncoding *This, uint size);
24 void allocInUseArrayElement(ElementEncoding *This, uint size);
26 inline bool isinUseElement(ElementEncoding *This, uint offset) {
27 return (This->inUseArray[(offset>>6)] >> (offset & 63)) &0x1;
30 inline void setInUseElement(ElementEncoding *This, uint offset) {
31 This->inUseArray[(offset>>6)] |= 1 << (offset & 63);