comptrie_packer.h 648 B

123456789101112131415161718192021
  1. #pragma once
  2. #include <library/cpp/packers/packers.h>
  3. template <class T>
  4. class TCompactTriePacker {
  5. public:
  6. void UnpackLeaf(const char* p, T& t) const {
  7. NPackers::TPacker<T>().UnpackLeaf(p, t);
  8. }
  9. void PackLeaf(char* buffer, const T& data, size_t computedSize) const {
  10. NPackers::TPacker<T>().PackLeaf(buffer, data, computedSize);
  11. }
  12. size_t MeasureLeaf(const T& data) const {
  13. return NPackers::TPacker<T>().MeasureLeaf(data);
  14. }
  15. size_t SkipLeaf(const char* p) const // this function better be fast because it is very frequently used
  16. {
  17. return NPackers::TPacker<T>().SkipLeaf(p);
  18. }
  19. };