27 #ifndef NIDAS_CORE_IOSTREAM_H
28 #define NIDAS_CORE_IOSTREAM_H
34 namespace nidas {
namespace core {
74 size_t read() throw(nidas::util::IOException);
140 size_t readUntil(
void* buf,
size_t len,
char term) throw(nidas::util::IOException);
157 size_t write(const struct iovec* iov,
int nbufs,
bool flush)
158 throw(nidas::util::IOException);
160 size_t write(const
void*buf,
size_t len,
bool flush) throw (nidas::util::IOException);
167 void flush() throw(nidas::util::IOException);
char * _buffer
data buffer
Definition: IOStream.h:208
size_t _nEAGAIN
Definition: IOStream.h:237
A base class for buffering data.
Definition: IOStream.h:41
size_t backup()
Move the read buffer pointer backwards to the beginning of the buffer.
Definition: IOStream.cc:195
void addNumOutputBytes(int val)
Definition: IOStream.h:198
bool isNewInput() const
Did last read(), or read(buf,len) call result in a new file being opened?
Definition: IOStream.h:66
long long _nbytesOut
Definition: IOStream.h:235
const std::string & getName() const
Definition: IOStream.h:184
char * _head
where we insert bytes into the buffer
Definition: IOStream.h:211
IOStream(IOChannel &input, size_t buflen=8192)
Create IOStream.
Definition: IOStream.cc:39
char * _eob
One past end of buffer.
Definition: IOStream.h:226
long long _nbytesIn
Definition: IOStream.h:233
long long dsm_time_t
Posix time in microseconds, the number of non-leap microseconds since 1970 Jan 1 00:00 UTC...
Definition: Sample.h:61
char * _tail
where we remove bytes from the buffer
Definition: IOStream.h:214
size_t _buflen
The actual buffer size.
Definition: IOStream.h:219
virtual dsm_time_t createFile(dsm_time_t t, bool exact)
Request that an IOChannel open a new file, with a name based on a time.
Definition: IOChannel.h:207
IOChannel & _iochannel
Definition: IOStream.h:202
size_t write(const struct iovec *iov, int nbufs, bool flush)
Write data.
Definition: IOStream.cc:215
long long getNumOutputBytes() const
Total number of bytes written with this IOStream.
Definition: IOStream.h:196
virtual ~IOStream()
Definition: IOStream.cc:48
A channel for Input or Output of data.
Definition: IOChannel.h:64
size_t _halflen
Definition: IOStream.h:221
size_t available() const
Number of bytes available to be copied from the buffer of IOStream.
Definition: IOStream.h:57
dsm_time_t createFile(dsm_time_t t, bool exact)
Request that IOChannel object open a new file, with a name based on a time.
Definition: IOStream.h:177
void reallocateBuffer(size_t len)
Definition: IOStream.cc:53
size_t readUntil(void *buf, size_t len, char term)
Read into the user buffer until a terminating character is found or len-1 bytes have been read...
Definition: IOStream.cc:149
size_t readBuf(void *buf, size_t len)
Copy available bytes from the internal buffer to buf, returning the number of bytes copied...
Definition: IOStream.h:82
int len
Definition: sing.cc:934
void flush()
Flush buffer to physical device.
Definition: IOStream.cc:305
bool _newInput
Was the previous read performed on a newly opened file?
Definition: IOStream.h:231
Definition: IOException.h:37
size_t read()
Do an IOChannel::read into the internal buffer of IOStream.
Definition: IOStream.cc:83
IOStream & operator=(const IOStream &)
No assignment.
void addNumInputBytes(int val)
Definition: IOStream.h:191
size_t skip(size_t len)
If the internal buffer is empty, do an IOChannel::read into the buffer.
Definition: IOStream.cc:133
long long getNumInputBytes() const
Number of bytes read with this IOStream.
Definition: IOStream.h:189
virtual const std::string & getName() const =0