#include <vtql_base.h>
Inheritance diagram for VTQL::Connect:
Callback Interface | |
A CModul adds itself to this list and hopes to get a callback by the Process(bool) method. | |
typedef thread::CallBack< std::pair< int, std::string > > | CallB |
we use a pair of int and std::string for a callback. | |
CallB | cb |
the callback structure is public. | |
Public Methods | |
virtual | ~Connect () |
Connect (const Connect &) | |
Connect (const std::string &file_name) | |
Open a connection to a server. More... | |
Connect (const sock::Socket_basic &file_descriptor) | |
Open a connection to a server (advanced). More... | |
virtual Connect & | operator<< (const std::string &line) |
Send a line to server. More... | |
virtual bool | Process (bool block)=0 |
Read form server and handle the lines read. More... | |
Protected Methods | |
size_t | InpLineC () |
\brief Get the number of input lines in buffer. | |
std::string | FetchLine () |
get a line (without newline) from read buffer. More... | |
void | Poll (bool block) |
Flushes i/o buffers. More... |
Usually you will not use this abstract class, but higher level ones. You can simpliy connect to the server and send lines to. There are tools to read lines and the idea is to call callback classes on on read lines. The method Process(bool,bool) that is intended to read and call back is pure.
|
|
|
Open a connection to a server.
|
|
Open a connection to a server (advanced). If you have an file descriptor and it is connected to a server, you can use this constructor.
|
|
Send a line to server. The input string+newline is added to the output queue. Send this queue with the Poll(bool) method to the server.
|
|
Read form server and handle the lines read. This method gets called by CModul::Wait(bool) and should read all data, that is in the input queue, i.e. until InpLineC() is 0. The CModul expects this method to call the callback classes with the data just read. It must not contain a loop to read until the command output had finished, but its return value should indicate a CModul, that it can return with true from the CModul::Wait(bool) method. It is expectet, that this function calls the Poll(bool) method.
Implemented in VTQL::Event_generic. |
|
get a line (without newline) from read buffer. You can get the number of input lines with InpLineC. Fill the buffer with Poll(bool). |
|
Flushes i/o buffers. Tries to write and read a bit from/to buffers (it does not contain a loop).
|