aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/codecs/comptable_codec.h
blob: d0f436178067952a5c045fc60867156e922724c5 (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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include "codecs.h"

#include <util/generic/ptr.h>

namespace NCodecs {
    class TCompTableCodec: public ICodec { 
        class TImpl; 
        TIntrusivePtr<TImpl> Impl; 

    public: 
        enum EQuality { 
            Q_LOW = 0, 
            Q_HIGH = 1 
        }; 

        explicit TCompTableCodec(EQuality q = Q_HIGH); 
        ~TCompTableCodec() override; 

        static TStringBuf MyNameHQ() { 
            return "comptable-hq"; 
        } 
        static TStringBuf MyNameLQ() { 
            return "comptable-lq"; 
        } 

        TString GetName() const override; 

        ui8 Encode(TStringBuf in, TBuffer& out) const override; 

        void Decode(TStringBuf in, TBuffer& out) const override; 

    protected: 
        void DoLearn(ISequenceReader& in) override; 
        void Save(IOutputStream* out) const override; 
        void Load(IInputStream* in) override; 
    }; 

}