heap.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef __HEAP_HPP__
  2. #define __HEAP_HPP__
  3. #include "types.hpp"
  4. #include "mpcio.hpp"
  5. #include "coroutine.hpp"
  6. #include "options.hpp"
  7. #include "mpcops.hpp"
  8. class HEAP {
  9. private:
  10. Duoram<RegAS> *oram;
  11. // RegXS root;
  12. size_t MAX_SIZE;
  13. // std::tuple<RegXS, RegBS> insert(MPCTIO &tio, yield_t &yield, RegXS ptr,
  14. // const Node &new_node, Duoram<Node>::Flat &A, int TTL, RegBS isDummy);
  15. // void insert(MPCTIO &tio, yield_t &yield, const Node &node, Duoram<Node>::Flat &A);
  16. // int del(MPCTIO &tio, yield_t &yield, RegXS ptr, RegAS del_key,
  17. // Duoram<Node>::Flat &A, RegBS F_af, RegBS F_fs, int TTL,
  18. // del_return &ret_struct);
  19. public:
  20. size_t num_items = 0;
  21. HEAP(int num_players, size_t size) {
  22. this->initialize(num_players, size);
  23. };
  24. ~HEAP() {
  25. if(oram)
  26. delete oram;
  27. };
  28. void initialize(int num_players, size_t size);
  29. RegAS extract_min(MPCTIO tio, yield_t &yield);
  30. int insert(MPCTIO tio, yield_t &yield, RegAS val);
  31. int verify_heap_property(MPCTIO tio, yield_t &yield);
  32. RegXS restore_heap_property(MPCTIO tio, yield_t &yield, RegXS index);
  33. RegXS restore_heap_property_at_root(MPCTIO tio, yield_t &yield, size_t index);
  34. };
  35. void Heap(MPCIO &mpcio,
  36. const PRACOptions &opts, char **args);
  37. //#include "heap.tcc"
  38. #endif