SmartSoft Component-Developer API
Public Member Functions | List of all members
Smart::ISendClientPattern< DataType > Class Template Referenceabstract

Client part of the one-way, n->1 Send communication pattern. More...

#include <smartISendClientPattern_T.h>

Inheritance diagram for Smart::ISendClientPattern< DataType >:
Smart::IClientPattern Smart::ICommunicationPattern Smart::IShutdownObserver

Public Member Functions

 ISendClientPattern (IComponent *component)
 Constructor (not wired with a service provider). More...
 
 ISendClientPattern (IComponent *component, const std::string &server, const std::string &service)
 Connection Constructor (implicitly wiring with specified service provider). More...
 
virtual ~ISendClientPattern ()=default
 Destructor. More...
 
virtual StatusCode send (const DataType &data)=0
 Perform a one-way communication. More...
 
- Public Member Functions inherited from Smart::IClientPattern
 IClientPattern (IComponent *component)
 Default Constructor (not yet connecting with any service provider). More...
 
 IClientPattern (IComponent *component, const std::string &server, const std::string &service)
 Connection Constructor (implicitly connecting with specified service provider). More...
 
virtual ~IClientPattern ()=default
 Default destructor. More...
 
virtual StatusCode connect (const std::string &server, const std::string &service)=0
 Connect this service requestor to the denoted service provider. More...
 
virtual StatusCode disconnect ()=0
 Disconnect the service requestor from the service provider. More...
 
virtual StatusCode blocking (const bool blocking)=0
 Allow or abort and reject blocking calls. More...
 
- Public Member Functions inherited from Smart::ICommunicationPattern
 ICommunicationPattern (IComponent *component)
 Default Constructor initializing an IShutdownObserver. More...
 
virtual ~ICommunicationPattern ()=default
 Default Destructor. More...
 
- Public Member Functions inherited from Smart::IShutdownObserver
 IShutdownObserver (ShutdownSubject *subject=nullptr)
 The default constructor. More...
 
virtual ~IShutdownObserver ()
 The default destructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Smart::IClientPattern
bool is_shutting_down () const
 
virtual void on_shutdown () override
 implements individual shutdown strategy The default behavior for each client during component shutdown is to call disconnect() which automatically disconnects the current client instance. More...
 
 IClientPattern ()=delete
 
- Protected Member Functions inherited from Smart::ICommunicationPattern
 ICommunicationPattern (const ICommunicationPattern &)=delete
 
ICommunicationPatternoperator= (const ICommunicationPattern &)=delete
 
 ICommunicationPattern ()=delete
 
- Protected Member Functions inherited from Smart::IShutdownObserver
void attach_self_to (ShutdownSubject *subject)
 call this method from within the constructor of derived classes More...
 
void detach_self_from (ShutdownSubject *subject)
 this method is called within the destructor More...
 
- Protected Attributes inherited from Smart::IClientPattern
std::string connectionServerName
 the server-name used for the last connection (can be used in derived classes) More...
 
std::string connectionServiceName
 the service-name used for the last connection (can be used in derived classes) More...
 
std::atomic< bool > is_blocking
 the flag indicating the current blocking state of this client (can be used in derived classes) More...
 
- Protected Attributes inherited from Smart::ICommunicationPattern
IComponenticomponent
 the internal pointer to the component (can be accessed in derived classes) More...
 

Detailed Description

template<class DataType>
class Smart::ISendClientPattern< DataType >

Client part of the one-way, n->1 Send communication pattern.

Clients can send a specified DataType object to a server. If the send() method succeeds, this means that the sent object actually arrived at the server, but the server has the freedom to process this object later or throw it away altogether, depending on the implemented server semantics.

Template parameters

Constructor & Destructor Documentation

◆ ISendClientPattern() [1/2]

template<class DataType >
Smart::ISendClientPattern< DataType >::ISendClientPattern ( IComponent component)
inline

Constructor (not wired with a service provider).

connect() / disconnect() can always be used to change the status of the connection.

Parameters
componentthe management class of the component

◆ ISendClientPattern() [2/2]

template<class DataType >
Smart::ISendClientPattern< DataType >::ISendClientPattern ( IComponent component,
const std::string &  server,
const std::string &  service 
)
inline

Connection Constructor (implicitly wiring 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 status of the instance.

Parameters
componentthe management class of the component
servername of the server (i.e. the component-name to connect to)
servicename of the service (i.e. the port-name of the component to connect to)

◆ ~ISendClientPattern()

template<class DataType >
virtual Smart::ISendClientPattern< DataType >::~ISendClientPattern ( )
virtualdefault

Destructor.

The destructor calls disconnect().

Member Function Documentation

◆ send()

template<class DataType >
virtual StatusCode Smart::ISendClientPattern< DataType >::send ( const DataType &  data)
pure virtual

Perform a one-way communication.

Appropriate status codes make sure that the information has been transferred.

Parameters
datathe object to be sent (Communication Object)
Returns
status code:
  • SMART_OK : everything is ok and communication object sent to server
  • SMART_DISCONNECTED : the client is disconnected and no send can be made
  • SMART_ERROR_COMMUNICATION : communication problems, data not transmitted
  • SMART_ERROR : something went wrong, data not transmitted

The documentation for this class was generated from the following file: