Guest User

byte_dict.h

a guest
Oct 26th, 2018
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #ifndef DICT
  2. #define DICT
  3.  
  4. #include <unordered_set>
  5.  
  6. #include "bit_utils.h"
  7.  
  8. class byte_dict
  9. {
  10.     public:
  11.    
  12.     byte_dict();
  13.    
  14.     /* fill the dictionary with the indexes of the bytes, return number of bytes inserted */
  15.     int fill(bits b, int index);
  16.    
  17.     /* return the set of indexes of a byte*/
  18.     std::unordered_set<int> get(byte b);
  19.    
  20.     /* remove all entries < min, return entries removed*/
  21.     int remove(int min);
  22.    
  23.     /* remove elements < offset and decrement all entries by offset */
  24.     int update(int offset);
  25.    
  26.     int size();
  27.    
  28.     private:
  29.    
  30.     std::unordered_set<int> dict[256];
  31.     int load;
  32.    
  33. };
  34.  
  35. #endif
Advertisement
Add Comment
Please, Sign In to add comment