1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// BranchCoder.h
2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __COMPRESS_BRANCH_CODER_H
4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __COMPRESS_BRANCH_CODER_H
5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Common/MyCom.h"
7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
8baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../ICoder.h"
9baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
10baa3858d3f5d128a5c8466b700098109edcad5f2repo syncclass CBranchConverter:
11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public ICompressFilter,
12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public CMyUnknownImp
13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
14baa3858d3f5d128a5c8466b700098109edcad5f2repo syncprotected:
15baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 _bufferPos;
16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  virtual void SubInit() {}
17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  virtual UInt32 SubFilter(Byte *data, UInt32 size) = 0;
18baa3858d3f5d128a5c8466b700098109edcad5f2repo syncpublic:
19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  MY_UNKNOWN_IMP;
20baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  STDMETHOD(Init)();
21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
22baa3858d3f5d128a5c8466b700098109edcad5f2repo sync};
23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define MyClassEncoderA(Name) class C ## Name: public CBranchConverter \
25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  { public: UInt32 SubFilter(Byte *data, UInt32 size); };
26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define MyClassDecoderA(Name) class C ## Name: public CBranchConverter \
28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  { public: UInt32 SubFilter(Byte *data, UInt32 size); };
29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
30baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define MyClassEncoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \
31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT};
32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define MyClassDecoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \
34baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT};
35baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
36baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define MyClassA(Name, id, subId)  \
37baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMyClassEncoderA(Name ## _Encoder) \
38baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMyClassDecoderA(Name ## _Decoder)
39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
40baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define MyClassB(Name, id, subId, ADD_ITEMS, ADD_INIT)  \
41baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMyClassEncoderB(Name ## _Encoder, ADD_ITEMS, ADD_INIT) \
42baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMyClassDecoderB(Name ## _Decoder, ADD_ITEMS, ADD_INIT)
43baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
44baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif
45