#include "graphstructs.h"
class NodeValuePair {
- public:
- NodeValuePair(EncodingNode *n, uint64_t val) : node(n), value(val) {}
+public:
+ NodeValuePair(EncodingNode *n, uint64_t val) : node(n), value(val) {}
EncodingNode *node;
uint64_t value;
};
typedef SetIterator<EncodingValue *, uintptr_t, PTRSHIFT> SetIteratorEncodingValue;
class EncodingValue {
- public:
- EncodingValue(uint64_t _val) : value(_val), encoding(0), inComparison(false), assigned(false) {}
+public:
+ EncodingValue(uint64_t _val) : value(_val), encoding(0), inComparison(false), assigned(false) {}
void merge(EncodingValue *value);
uint64_t value;
uint encoding;
typedef Hashtable<NodeValuePair *, EncodingValue *, uintptr_t, 0, hashNodeValuePair, equalsNodeValuePair> NVPMap;
class EncodingSubGraph {
- public:
+public:
EncodingSubGraph();
+ ~EncodingSubGraph();
void addNode(EncodingNode *n);
- SetIteratorEncodingNode * nodeIterator();
+ SetIteratorEncodingNode *nodeIterator();
void encode();
-
+ uint getEncoding(EncodingNode *n, uint64_t val);
+ uint getEncodingMaxVal(EncodingNode *n) { return maxEncodingVal;}
+
CMEMALLOC;
- private:
+private:
uint estimateNewSize(EncodingNode *n);
uint estimateNewSize(EncodingSubGraph *sg);
void traverseValue(EncodingNode *node, uint64_t value);
NVPMap map;
uint encodingSize;
uint numElements;
+ uint maxEncodingVal;
friend class EncodingGraph;
};