class mrpt::io::CPipeBaseEndPoint¶
Common interface of read & write pipe end-points.
#include <mrpt/io/CPipe.h> class CPipeBaseEndPoint: public mrpt::io::CStream { public: // fields unsigned int timeout_read_start_us {0}; unsigned int timeout_read_between_us {0}; // construction CPipeBaseEndPoint(); CPipeBaseEndPoint(const CPipeBaseEndPoint&); CPipeBaseEndPoint(const std::string& serialized); // methods CPipeBaseEndPoint& operator = (const CPipeBaseEndPoint&); std::string serialize(); bool isOpen() const; void close(); virtual size_t Read(void* Buffer, size_t Count); virtual size_t Write(const void* Buffer, size_t Count); virtual uint64_t Seek(int64_t of, CStream::TSeekOrigin o = sFromBeginning); virtual uint64_t getTotalBytesCount() const; virtual uint64_t getPosition() const; }; // direct descendants class CPipeReadEndPoint; class CPipeWriteEndPoint;
Inherited Members¶
public: // methods virtual size_t Read(void* Buffer, size_t Count) = 0; virtual size_t Write(const void* Buffer, size_t Count) = 0; virtual uint64_t getTotalBytesCount() const = 0; virtual uint64_t getPosition() const = 0;
Fields¶
unsigned int timeout_read_start_us {0}
(Default=0) Timeout for read operations: microseconds (us) to wait for the first byte.
0 means infinite timeout.
unsigned int timeout_read_between_us {0}
(Default=0) Timeout between burst reads operations: microseconds (us) to wait between two partial reads inside one large read.
0 means infinite timeout.
Construction¶
CPipeBaseEndPoint(const std::string& serialized)
De-serializes one end-point description, for example, from a parent process.
Methods¶
std::string serialize()
Converts the end-point into a string suitable for reconstruction at a child process.
This invalidates this object, since only one real end-point can exist at once.
bool isOpen() const
Returns false if the pipe was closed due to some error.
void close()
Closes the pipe (normally not needed to be called by users, automatically done at destructor)
virtual size_t Read(void* Buffer, size_t Count)
Introduces a pure virtual method responsible for reading from the stream.
virtual size_t Write(const void* Buffer, size_t Count)
Introduces a pure virtual method responsible for writing to the stream.
Write attempts to write up to Count bytes to Buffer, and returns the number of bytes actually written.
virtual uint64_t Seek(int64_t of, CStream::TSeekOrigin o = sFromBeginning)
Without effect in this class.
virtual uint64_t getTotalBytesCount() const
Without effect in this class.
virtual uint64_t getPosition() const
Without effect in this class.