|
1 // OutStreamWithCRC.h |
|
2 |
|
3 #ifndef __OUTSTREAMWITHCRC_H |
|
4 #define __OUTSTREAMWITHCRC_H |
|
5 |
|
6 #include "../../../Common/CRC.h" |
|
7 #include "../../../Common/MyCom.h" |
|
8 #include "../../IStream.h" |
|
9 |
|
10 class COutStreamWithCRC: |
|
11 public ISequentialOutStream, |
|
12 public CMyUnknownImp |
|
13 { |
|
14 public: |
|
15 MY_UNKNOWN_IMP |
|
16 |
|
17 STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); |
|
18 private: |
|
19 CCRC _crc; |
|
20 CMyComPtr<ISequentialOutStream> _stream; |
|
21 public: |
|
22 void Init(ISequentialOutStream *stream) |
|
23 { |
|
24 _stream = stream; |
|
25 _crc.Init(); |
|
26 } |
|
27 void ReleaseStream() { _stream.Release(); } |
|
28 UInt32 GetCRC() const { return _crc.GetDigest(); } |
|
29 void InitCRC() { _crc.Init(); } |
|
30 |
|
31 }; |
|
32 |
|
33 #endif |