26 #ifndef NIDAS_CORE_IODEVICE_H
27 #define NIDAS_CORE_IODEVICE_H
32 #include <sys/ioctl.h>
34 namespace nidas {
namespace core {
52 virtual void setName(
const std::string& val)
57 virtual const std::string&
getName()
const
67 virtual void open(
int flags)
133 virtual void ioctl(
int request,
void* buf,
size_t len)
139 virtual void close() throw(nidas::util::IOException) = 0;
158 IODevice& operator=(const IODevice&);
IODevice()
Definition: IODevice.h:45
virtual void setName(const std::string &val)
Set the device name to be opened for this sensor.
Definition: IODevice.h:52
virtual int getWriteFd() const =0
The file descriptor used when writing to this sensor.
virtual size_t write(const void *buf, size_t len)=0
Write to the sensor.
#define err(format, arg...)
Definition: ck_lams.cc:55
virtual const std::string & getName() const
Definition: IODevice.h:57
virtual ~IODevice()
Definition: IODevice.h:47
An interface to an IO device.
Definition: IODevice.h:41
virtual size_t read(void *buf, size_t len)=0
Read from the sensor.
virtual int getReadFd() const =0
The file descriptor used when reading from this sensor.
int len
Definition: sing.cc:934
Definition: IOException.h:37
std::string _devname
Whether to reopen this sensor on an IOException.
Definition: IODevice.h:148
virtual size_t getBytesAvailable() const
Return how many bytes are available to read on this IODevice.
Definition: IODevice.h:114
virtual void open(int flags)=0
Open the device.
virtual void ioctl(int request, void *buf, size_t len)=0
virtual void close()=0
Close the device.
Definition: InvalidParameterException.h:35