dodo
0.0.1
A C++ library to create containerized Linux services
|
Go to the documentation of this file.
23 #ifndef dodo_network_socketreadbuffer_hpp
24 #define dodo_network_socketreadbuffer_hpp
54 virtual char get()
const = 0;
115 virtual char get()
const;
156 explicit FileReadBuffer( std::string filename,
size_t bufsize = 8192 );
160 virtual char get()
const;
virtual common::SystemError underflow()
If the buffer_ is fully read.
SocketReadBuffer is a VirtualReadBuffer that reads from the BaseSocket in chunks internally.
ssize_t idx_
The current index of get(char &c) in buffer_.
virtual common::SystemError underflow()
If the buffer_ underflows, the buffer_ must be reset refilledwith new data from the source.
virtual common::SystemError underflow()
If the buffer_ underflows, the buffer_ must be reset refilledwith new data from the source.
virtual char get() const
Get the current char from VirtualReadBuffer.
Interface to read individual bytes whilst the implementation can read from an actual source (such as ...
char * buffer_
The buffer.
FileReadBuffer(std::string filename, size_t bufsize=8192)
Construct a FileReadBuffer.
virtual common::SystemError next()=0
Move to the next char from the VirtualReadBuffer.
File-based VirtualReadBuffer, conventient for testing purposes as parsers can be tested against file ...
virtual char get() const =0
Get the current char from VirtualReadBuffer.
virtual ~SocketReadBuffer()
Destruct the SocketReadBuffer, de-allocate the internal buffer.
virtual common::SystemError next()
Move to the next char from the VirtualReadBuffer.
StringReadBuffer(const std::string &data)
Construct a FileReadBuffer.
size_t underflows_
The number underflow() invocations.
A C++ platform interface to lean Linux services tailored for containerized deployment.
size_t read_
The number of chars read in buffer_.
virtual char get() const
Get the current char from VirtualReadBuffer.
virtual char get() const
Get the current char from VirtualReadBuffer.
BaseSocket * socket_
The associated network::BaseSocket*.
size_t idx_
The current index into the string buffer.
virtual common::SystemError next()
Move to the next char from the VirtualReadBuffer.
@ ecOK
0 Not an error, success
String based VirtualReadBuffer, conventient for testing purposes as parsers can be tested against str...
ssize_t received_
The number of chars received in the last underflow().
size_t idx_
The index into the buffer.
SocketReadBuffer(BaseSocket *socket, size_t bufsize=8192)
Construct a SocketReadBuffer.
Linux system error primitive to provide a consistent interface to Linux error codes.
ssize_t bufsize_
The size of buffer_.
size_t getUnderflowCount() const
Return the number of times underflow() was invoked.
std::string data_
The string data backing the buffer.
FILE * file_
The file handle.
virtual common::SystemError next()
Move to the next char from the VirtualReadBuffer.
Interface to and common implementation of concrete sockets (Socket, TLSSocket).
virtual common::SystemError underflow()=0
If the buffer_ underflows, the buffer_ must be reset refilledwith new data from the source.