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