haiku/headers/build/os/support/BufferIO.h
Ingo Weinhold 338b8dc301 Merged changes from branch build_system_redesign at revision 14573.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-29 16:27:43 +00:00

74 lines
1.5 KiB
C++

/******************************************************************************
/
/ File: BufferIO.h
/
/ Description: A buffered adapter for BPositionIO
/
/ Copyright 1998, Be Incorporated
/
******************************************************************************/
#if !defined(_BUFFER_IO_H)
#define _BUFFER_IO_H
#include <DataIO.h>
class BBufferIO : public BPositionIO
{
public:
enum {
DEFAULT_BUF_SIZE = 65536L
};
BBufferIO(
BPositionIO * stream,
size_t buf_size = DEFAULT_BUF_SIZE,
bool owns_stream = true);
virtual ~BBufferIO();
virtual ssize_t ReadAt(
off_t pos,
void *buffer,
size_t size);
virtual ssize_t WriteAt(
off_t pos,
const void *buffer,
size_t size);
virtual off_t Seek(
off_t position,
uint32 seek_mode);
virtual off_t Position() const;
virtual status_t SetSize(
off_t size);
virtual status_t Flush();
BPositionIO * Stream() const;
size_t BufferSize() const;
bool OwnsStream() const;
void SetOwnsStream(
bool owns_stream);
void PrintToStream() const;
private:
off_t m_buffer_start;
BPositionIO * m_stream;
char * m_buffer;
size_t m_buffer_phys;
size_t m_buffer_used;
uint32 _reserved_ints[6];
bool m_buffer_dirty;
bool m_owns_stream;
bool _reserved_bools[6];
virtual status_t _Reserved_BufferIO_0(void *);
virtual status_t _Reserved_BufferIO_1(void *);
virtual status_t _Reserved_BufferIO_2(void *);
virtual status_t _Reserved_BufferIO_3(void *);
virtual status_t _Reserved_BufferIO_4(void *);
};
#endif /* _BUFFER_IO_H */