aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/containers/comptrie/write_trie_backwards.h
blob: 634e6b811a4ca27a18e6c3b78940366b83d01e8a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include "minimize.h"

#include <util/generic/vector.h>
#include <util/stream/output.h>
#include <cstddef>

namespace NCompactTrie {
    class TReverseNodeEnumerator {
    public:
        virtual ~TReverseNodeEnumerator() = default;
        virtual bool Move() = 0;
        virtual size_t GetLeafLength() const = 0;
        virtual size_t RecreateNode(char* buffer, size_t resultLength) = 0;
    };

    struct TOpaqueTrie;

    size_t WriteTrieBackwards(IOutputStream& os, TReverseNodeEnumerator& enumerator, bool verbose);
    size_t WriteTrieBackwardsNoAlloc(IOutputStream& os, TReverseNodeEnumerator& enumerator, TOpaqueTrie& trie, EMinimizeMode mode);

}