1 #ifndef UTIL_COMPRESS__STREAM__HPP
2 #define UTIL_COMPRESS__STREAM__HPP
131 fOwnProcessor = fOwnReader + fOwnWriter,
132 fOwnAll = fOwnStream + fOwnProcessor
176 int& status,
string& description);
226 EDeleteProcessor need_delete = eNoDelete,
239 return m_Processor && m_Processor->IsBusy() && m_State != eDone;
454 int& status,
string& description) {
519 char* out_buf,
size_t out_size,
522 virtual EStatus Flush (
char* out_buf,
size_t out_size,
524 virtual EStatus Finish (
char* out_buf,
size_t out_size,
526 virtual EStatus End (
int abandon = 0);
543 streamsize in_bufsize,
544 streamsize out_bufsize
CTransparentProcessor – memory-copy processor.
CTransparentStreamProcessor – stream processor to copy data "as is".
CT_CHAR_TYPE * m_OutBuf
Buffer of processed data.
virtual void Finalize(CCompressionStream::EDirection dir=CCompressionStream::eWrite)
Finalize stream's compression/decompression process for read/write.
CCompressionStreambuf * m_StreamBuf
Stream buffer.
CCompressionStreamProcessor * m_Writer
Write processor.
void operator<<(bool) const
Disable operator<<(bool)
bool x_GetError(CCompressionStream::EDirection dir, int &status, string &description)
Get error code and description of last compressor/decompressor stream operation.
CCompressionStreamProcessor * m_Reader
Read processor.
virtual bool AllowEmptyData() const
Return TRUE if fAllowEmptyData flag is set for this compression.
bool GetError(int &status, string &description)
Get error code and description of last compressor/decompressor stream operation.
TOwnership m_Ownership
Bitwise OR of EOwnership.
CTransparentProcessor(void)
EState m_State
Stream processor state.
void Create(CNcbiIos &, CCompressionStreamProcessor *, CCompressionStreamProcessor *, TOwnership ownership=0)
Define this method to avoid compiler warnings only.
CCompressionIOStream(void)
Default constructor.
virtual void Finalize(CCompressionStream::EDirection dir=CCompressionStream::eReadWrite)
Finalize stream's compression/decompression process for read/write.
CCompressionProcessor::EStatus GetStatus(void)
Get status of last compression/decompression stream operation.
size_t GetProcessedSize(CCompressionStream::EDirection dir)
Get total number of bytes processed by specified "stream_processor".
void Create(CNcbiIos &stream, CCompressionStreamProcessor *stream_processor, TOwnership ownership=0)
Create stream with specific characteristics later, not necessary in the constructor.
CCompressionIStream(CNcbiIos &stream, CCompressionStreamProcessor *stream_processor, TOwnership ownership=0)
EDeleteProcessor
If to delete the used compression processor in the destructor.
size_t GetProcessedSize(void)
Get total number of bytes processed by "stream_processor".
size_t GetOutputSize(CCompressionStream::EDirection dir)
Get total number of bytes, that "stream_processor" returns.
CCompressionIStream(void)
Default constructor.
size_t GetProcessedSize(void)
Get total number of bytes processed by "stream_processor".
CCompressionProcessor * GetProcessor(void) const
Return a pointer to currently used stream processor.
CCompressionProcessor::EStatus GetStatus(CCompressionStream::EDirection dir)
Get status of last compression/decompression stream operation.
size_t GetOutputSize(void)
Get total number of bytes, that "stream_processor" returns.
CCompressionOStream(CNcbiIos &stream, CCompressionStreamProcessor *stream_processor, TOwnership ownership=0)
size_t x_GetProcessedSize(CCompressionStream::EDirection dir)
Return number of processed bytes.
streamsize m_OutBufSize
Processed data buffer size.
CT_CHAR_TYPE * m_Begin
Begin and end of the pre/post.
CCompressionProcessor::EStatus x_GetStatus(CCompressionStream::EDirection dir)
Get status of last compression/decompression stream operation.
void Create(CNcbiIos &, CCompressionStreamProcessor *, CCompressionStreamProcessor *, TOwnership ownership=0)
Define this method to avoid compiler warnings only.
void Create(CNcbiIos &stream, CCompressionStreamProcessor *read_sp, CCompressionStreamProcessor *write_sp, TOwnership ownership=0)
Create stream with specific characteristics later, not necessary in the constructor.
bool GetError(int &status, string &description)
Get error code and description of last compressor/decompressor stream operation.
CNcbiIos * m_Stream
Underlying stream.
size_t GetOutputSize(void)
Get total number of bytes, that "stream_processor" returns.
CTransparentStreamProcessor(streamsize in_bufsize, streamsize out_bufsize)
Full constructor.
void operator>>(bool) const
Disable operator>>(bool)
bool GetError(CCompressionStream::EDirection dir, int &status, string &description)
Get error code and description of last compressor/decompressor stream operation.
virtual void Finalize(CCompressionStream::EDirection dir=CCompressionStream::eReadWrite)
Finalize stream's compression/decompression process for read/write.
CTransparentStreamProcessor(void)
Conventional constructor.
CCompressionStream(const CCompressionStream &)
Private copy constructor to prohibit copy.
CCompressionProcessor::EStatus m_LastStatus
Last compressor status.
CCompressionProcessor * m_Processor
(De)compression processor.
CCompressionStreamProcessor(const CCompressionStreamProcessor &)
Private copy constructor to prohibit copy.
CCompressionOStream(void)
Default constructor.
streamsize m_InBufSize
Unprocessed data buffer size.
bool IsOkay(void) const
Get stream processor's status.
CCompressionIOStream(CNcbiIos &stream, CCompressionStreamProcessor *read_sp, CCompressionStreamProcessor *write_sp, TOwnership ownership=0)
EDeleteProcessor m_NeedDelete
m_Processor auto-deleting flag.
CCompressionProcessor::EStatus GetStatus(void)
Get status of last compression/decompression stream operation.
EDirection
Stream processing direction.
CT_CHAR_TYPE * m_InBuf
Buffer of unprocessed data.
EOwnership
Which of the objects (passed in the constructor) should be deleted on this object's destruction.
size_t x_GetOutputSize(CCompressionStream::EDirection dir)
Return number of output bytes.
void Create(CNcbiIos &stream, CCompressionStreamProcessor *stream_processor, TOwnership ownership=0)
Create stream with specific characteristics.
int TOwnership
Bitwise OR of EOwnership.
CT_CHAR_TYPE * m_End
processed data in the buffer.
@ eActive
Processor ready to read/write.
@ eFinalize
Finalize() already done, but End() not yet.
@ eInit
Init() is done, but no data to process.
@ eDelete
Do delete processor object.
@ eWrite
Writing into stream.
@ eRead
Reading from stream.
@ eReadWrite
eRead + eWrite
const streamsize kCompressionDefaultBufSize
Default compression I/O stream buffer size.
EStatus
Type of the result of all basic functions.
void Read(CObjectIStream &in, TObjectPtr object, const CTypeRef &type)
void Write(CObjectOStream &out, TConstObjectPtr object, const CTypeRef &type)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::iostream CNcbiIostream
Portable alias for iostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ios CNcbiIos
Portable alias for ios.
virtual void Process(SOCK sock)=0
Runs asynchronously (from a separate thread) for each request.
NCBI_XUTIL_EXPORT
Parameter to control printing diagnostic message about conversion of static array data from a differe...