27#ifndef NIDAS_CORE_IOSTREAM_H
28#define NIDAS_CORE_IOSTREAM_H
34namespace nidas {
namespace core {
104 size_t read(
void* buf,
size_t len);
167 size_t write(const struct iovec* iov,
int nbufs,
bool flush);
A channel for Input or Output of data.
Definition IOChannel.h:65
virtual const std::string & getName() const =0
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:229
A base class for buffering data.
Definition IOStream.h:41
void addNumInputBytes(int val)
Definition IOStream.h:211
virtual ~IOStream()
Definition IOStream.cc:48
size_t skip(size_t len)
If the internal buffer is empty, do an IOChannel::read into the buffer.
Definition IOStream.cc:133
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:84
void flush()
Flush buffer to physical device.
Definition IOStream.cc:304
size_t _nEAGAIN
Definition IOStream.h:263
long long getNumOutputBytes() const
Total number of bytes written with this IOStream.
Definition IOStream.h:218
char * _buffer
data buffer
Definition IOStream.h:234
bool isNewInput() const
Did last read(), or read(buf,len) call result in a new file being opened?
Definition IOStream.h:66
size_t _halflen
Definition IOStream.h:247
size_t _buflen
The actual buffer size.
Definition IOStream.h:245
void reallocateBuffer(size_t len)
Definition IOStream.cc:53
bool _newInput
Was the previous read performed on a newly opened file?
Definition IOStream.h:257
const std::string & getName() const
Definition IOStream.h:200
void addNumOutputBytes(int val)
Definition IOStream.h:222
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
char * _eob
One past end of buffer.
Definition IOStream.h:252
size_t write(const struct iovec *iov, int nbufs, bool flush)
Write data.
Definition IOStream.cc:214
long long getNumInputBytes() const
Number of bytes read with this IOStream.
Definition IOStream.h:207
char * _tail
where we remove bytes from the buffer
Definition IOStream.h:240
size_t available() const
Number of bytes available to be copied from the buffer of IOStream.
Definition IOStream.h:57
long long _nbytesIn
Definition IOStream.h:259
IOChannel & _iochannel
Definition IOStream.h:228
size_t backup()
Move the read buffer pointer backwards to the beginning of the buffer.
Definition IOStream.cc:194
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:193
IOStream(const IOStream &)
No copying.
IOStream & operator=(const IOStream &)
No assignment.
IOStream(IOChannel &input, size_t buflen=8192)
Create IOStream.
Definition IOStream.cc:39
long long _nbytesOut
Definition IOStream.h:261
size_t read()
Do an IOChannel::read into the internal buffer of IOStream.
Definition IOStream.cc:83
char * _head
where we insert bytes into the buffer
Definition IOStream.h:237
Sample * getSample(sampleType type, unsigned int len)
A convienence method for getting a sample of an enumerated type from a pool.
Definition Sample.cc:70
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:62
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31
int len
Definition sing.cc:948