// File name: $Workfile: str_base.h $ // Last modified: $Modtime: 9/20/00 11:42a $ // Last modified by: $Author: Bill $ // // VCS archive path: $Archive: /Hank/DMM/FirmWare/Level3/ObDatMgr/str_base.h $ // VCS revision: $Revision: 6 $ // External interfaces class CPQDIF_StreamProcessor; class CPQDIF_StreamIO { public: CPQDIF_StreamIO(); virtual ~CPQDIF_StreamIO(); // Attributes public: // Operations public: virtual bool SeekPos( int pos ) = 0; virtual bool GetPos( int& pos ) = 0; virtual bool SeekEnd( void ) = 0; virtual BYTE * ReadBlock( long size, int& actualSize ) = 0; virtual bool CanWriteFull( void ) const { return m_canWriteFull; } virtual bool CanWriteIncremental( void ) const { return m_canWriteInc; } virtual bool BeginBlock( void ); virtual bool AppendBlock( BYTE * buffer, long size ); virtual bool WriteBlock( int &sizeActual ) = 0; virtual void Flush( void ) {} // Optional (default behavior: nothing) virtual bool ConnectProcessor( CPQDIF_StreamProcessor * proc ); virtual long GetChecksum( void ); virtual void ResetChecksum( void ); // Called by the processor // ======================= // Dereferences data buffered in the stream for the processor to read. // The number of bytes available is returned in sizeActual. If max is 0, // the total remaining length of the input buffer is returned. // Returns FALSE when at end of buffer, TRUE otherwise. virtual bool ProcessRead ( const BYTE * &buffer, long max, long& sizeActual ); // Reserves storage in the stream for the processor to write // data into. virtual bool ProcessWriteReserve( BYTE * &buffer, long size ); // This function is set the actual size of the buffer reserved // by preceeding ProceWriteReserve call. virtual bool ProcessWriteRelease( long sizeActual ); // Implementation protected: virtual bool ExecuteProcessorEncode( void ); virtual bool ExecuteProcessorDecode( void ); // Member data protected: // This is connected to the object, but not owned by it. CPQDIF_StreamProcessor * m_processor; // These are owned by the stream object bool m_canWriteFull; bool m_canWriteInc; CPQByteArray m_buffRead; long m_sizeRead; long m_posRead; CPQByteArray m_buffWrite; long m_sizeWrite; long m_posWrite; };