An abstract class that acts as an interface to underlying network transport layer. More...
#include <connection_adapter_client.hpp>
Classes | |
class | Observer |
Observer class that allows to receive notifications from the connection adapter. More... | |
Public Types | |
typedef map< string, string > | Parameters |
Container type for parameters. More... | |
Public Member Functions | |
virtual void | aboutToStop () |
Invoked when the adapter should stop. Called before the object will be destroyed. More... | |
void | addObserver (Observer *observer) |
Adds observer to receive notification from this adapter. More... | |
ClientConnectionAdapter () | |
Constructor. More... | |
virtual bool | configure (const Parameters ¶meters) |
Allows to configure the adapter with adapter-specific settings (key-value pairs). More... | |
virtual bool | connect ()=0 |
Connects adapter to server. More... | |
virtual void | disconnect ()=0 |
Disconnects adapter from server. More... | |
virtual shared_ptr< MessageTranslator > | getNetworkTranslator (MessagePackage::SerializationFormat format=MessagePackage::SerializationFormatBinary) |
virtual string | getParameter (const string ¶meter) |
Adapter can expose it's parameters using key-value pairs. More... | |
virtual string | getState (const string ¶meter)=0 |
Adapter can expose it's internal state by using key-value pairs. More... | |
virtual string | getType () const =0 |
Returns type of the adapter, this needs to be unique for every adapter. More... | |
virtual void | interrupt ()=0 |
Signals to stop waiting for events. More... | |
void | removeObserver (Observer *observer) |
Removes observer from this adapter. More... | |
virtual void | send (const vector< char > &data)=0 |
Sends data to network. More... | |
virtual void | setClient (Client *client) |
Allows to set a pointer to the Client instance for this adapter. More... | |
virtual int | wait ()=0 |
Starts waiting event(s) from network, can block to preserve CPU. More... | |
virtual void | work (int status)=0 |
Once wait is completed, this method is called for the adapter to process the received network events. More... | |
virtual | ~ClientConnectionAdapter () |
Destructor. More... | |
Protected Member Functions | |
void | notifyConnected () |
Allows derived class to invoke connection notification to all observers. More... | |
void | notifyDisconnected () |
Allows derived class to invoke disconnect notification to all observers. More... | |
void | notifyReceive (const vector< char > &data) |
Allows derived class to invoke data received notification to all observers. More... | |
Static Protected Member Functions | |
static string | getConfigurationParameterString (const Parameters ¶meters, const string ¶meter) |
Get single single string type configuration parameter. Returns empty string for missing parameter. More... | |
An abstract class that acts as an interface to underlying network transport layer.
This class interface provides functionality to connect to server and transmit & receive data.
typedef map<string, string> kanzi::connect::ClientConnectionAdapter::Parameters |
Container type for parameters.
|
inline |
Constructor.
|
inlinevirtual |
Destructor.
|
inlinevirtual |
Invoked when the adapter should stop. Called before the object will be destroyed.
void kanzi::connect::ClientConnectionAdapter::addObserver | ( | Observer * | observer | ) |
Adds observer to receive notification from this adapter.
observer | Observer to add. |
|
inlinevirtual |
Allows to configure the adapter with adapter-specific settings (key-value pairs).
parameters | Configuration parameters, as string-based key value pairs. |
Reimplemented in kanzi::connect::ClientSocketConnectionAdapter.
|
pure virtual |
Connects adapter to server.
Implemented in kanzi::connect::ClientSocketConnectionAdapter.
|
pure virtual |
Disconnects adapter from server.
Implemented in kanzi::connect::ClientSocketConnectionAdapter.
|
staticprotected |
Get single single string type configuration parameter. Returns empty string for missing parameter.
|
virtual |
|
inlinevirtual |
Adapter can expose it's parameters using key-value pairs.
This function allows to retrieve a parameter value that was used to configure the adapter.
parameter | Key argument for parameter query. |
|
pure virtual |
Adapter can expose it's internal state by using key-value pairs.
This function allows to retrieve a state value from adapter for a given key.
parameter | Key argument for state query. |
Implemented in kanzi::connect::ClientSocketConnectionAdapter.
|
pure virtual |
Returns type of the adapter, this needs to be unique for every adapter.
|
pure virtual |
Signals to stop waiting for events.
Implemented in kanzi::connect::ClientSocketConnectionAdapter.
|
protected |
Allows derived class to invoke connection notification to all observers.
|
protected |
Allows derived class to invoke disconnect notification to all observers.
|
protected |
Allows derived class to invoke data received notification to all observers.
void kanzi::connect::ClientConnectionAdapter::removeObserver | ( | Observer * | observer | ) |
Removes observer from this adapter.
observer | Observer to remove. |
|
pure virtual |
Sends data to network.
data | Data to send. |
|
inlinevirtual |
|
pure virtual |
Starts waiting event(s) from network, can block to preserve CPU.
Implemented in kanzi::connect::ClientSocketConnectionAdapter.
|
pure virtual |
Once wait is completed, this method is called for the adapter to process the received network events.
status | the status (>=0) value returned by the wait() routine called earlier. |
Implemented in kanzi::connect::ClientSocketConnectionAdapter.