This is the base class for all client-patterns implementing a connection-oriented communication.
More...
#include <smartIClientPattern.h>
This is the base class for all client-patterns implementing a connection-oriented communication.
Each ClientPattern needs to implement the connection-oriented user API (i.e. the methods connect() / disconnect() ). In addition all clients need to implement the method blocking() that allows to globally manage all blocking user API calls. This provides a thread-save implementation of blocking-call management.
◆ IClientPattern() [1/3]
Smart::IClientPattern::IClientPattern |
( |
| ) |
|
|
protecteddelete |
◆ IClientPattern() [2/3]
Smart::IClientPattern::IClientPattern |
( |
IComponent * |
component | ) |
|
|
inline |
Default Constructor (not yet connecting with any service provider).
connect() / disconnect() can always be used to change the connection status of the instance.
- Parameters
-
component | the management class of the component |
◆ IClientPattern() [3/3]
Smart::IClientPattern::IClientPattern |
( |
IComponent * |
component, |
|
|
const std::string & |
server, |
|
|
const std::string & |
service |
|
) |
| |
|
inline |
Connection Constructor (implicitly connecting with specified service provider).
Connects to the denoted service and blocks until the connection has been established. Blocks infinitely if denoted service becomes unavailable since constructor performs retries. Blocking is useful to simplify startup of components which have mutual dependencies. connect() / disconnect() can always be used to change the connection-status of the instance.
- Parameters
-
component | the management class of the component |
server | name of the server (i.e. the component-name to connect to) |
service | name of the service (i.e. the port-name of the component to connect to) |
◆ ~IClientPattern()
virtual Smart::IClientPattern::~IClientPattern |
( |
| ) |
|
|
virtualdefault |
◆ blocking()
virtual StatusCode Smart::IClientPattern::blocking |
( |
const bool |
blocking | ) |
|
|
pure virtual |
Allow or abort and reject blocking calls.
If blocking is set to false all blocking calls return with SMART_CANCELLED. This can be used to abort blocking calls.
- Parameters
-
- Returns
- status code
- SMART_OK : new mode set
- SMART_ERROR : something went wrong
◆ connect()
virtual StatusCode Smart::IClientPattern::connect |
( |
const std::string & |
server, |
|
|
const std::string & |
service |
|
) |
| |
|
pure virtual |
Connect this service requestor to the denoted service provider.
An already established connection is first disconnected. See disconnect()
It is no problem to change the connection to a service provider at any point in time irrespective of any other calls.
- Parameters
-
server | name of the server (i.e. the component-name to connect to) |
service | name of the service (i.e. the port-name of the component to connect to) |
- Returns
- status code
- SMART_OK : everything is OK and connected to the specified service.
- SMART_SERVICEUNAVAILABLE : the specified service is currently not available and the requested connection can not be established. Service requestor is now not connected to any service provider.
- SMART_INCOMPATIBLESERVICE : the specified service provider is not compatible (wrong communication pattern or wrong communication objects) to this service requestor and can therefore not be connected. Service requestor is now not connected to any service provider.
- SMART_ERROR_COMMUNICATION : communication problems, service requestor is now not connected to any service provider.
- SMART_ERROR : something went wrong, service requestor is now not connected to any service provider.
◆ disconnect()
virtual StatusCode Smart::IClientPattern::disconnect |
( |
| ) |
|
|
pure virtual |
Disconnect the service requestor from the service provider.
It is no problem to change the connection to a service provider at any point in time irrespective of any other calls.
- Returns
- status code
- SMART_OK : everything is OK and service requestor is disconnected from the service provider.
- SMART_ERROR_COMMUNICATION : something went wrong at the level of the intercomponent communication. At least the service requestor is in the disconnected state irrespective of the service provider side clean up procedures.
- SMART_ERROR : something went wrong. Again at least the service requestor is in the disconnected state.
◆ is_shutting_down()
bool Smart::IClientPattern::is_shutting_down |
( |
| ) |
const |
|
inlineprotected |
◆ on_shutdown()
virtual void Smart::IClientPattern::on_shutdown |
( |
| ) |
|
|
inlineoverrideprotectedvirtual |
implements individual shutdown strategy The default behavior for each client during component shutdown is to call disconnect() which automatically disconnects the current client instance.
Implements Smart::IShutdownObserver.
◆ connectionServerName
std::string Smart::IClientPattern::connectionServerName |
|
protected |
the server-name used for the last connection (can be used in derived classes)
◆ connectionServiceName
std::string Smart::IClientPattern::connectionServiceName |
|
protected |
the service-name used for the last connection (can be used in derived classes)
◆ is_blocking
std::atomic<bool> Smart::IClientPattern::is_blocking |
|
protected |
the flag indicating the current blocking state of this client (can be used in derived classes)
The documentation for this class was generated from the following file: