AceSmartSoft API Documentation
Public Member Functions | List of all members
SmartACE::SendClient< C > Class Template Reference

Client part of one-way communication pattern. More...

#include <smartSend.hh>

Inheritance diagram for SmartACE::SendClient< C >:

Public Member Functions

 SendClient (SmartComponent *component, const std::string &port, SmartACE::WiringSlave *slave)
 Constructor (port wireable from outside by other components). More...
 
 SendClient (SmartComponent *component)
 Constructor (not wired with service provider and not exposed as port). More...
 
 SendClient (SmartComponent *component, const std::string &server, const std::string &service)
 Constructor (wired with specified service provider). More...
 
virtual ~SendClient ()
 Destructor. More...
 
Smart::StatusCode add (SmartACE::WiringSlave *slave, const std::string &port)
 Add this instance to the set of ports wireable via the wiring pattern from outside the component. More...
 
Smart::StatusCode remove ()
 Remove this service requestor from the set of ports wireable via the wiring pattern from outside the component. More...
 
Smart::StatusCode connect (const std::string &server, const std::string &service)
 Connect this service requestor to the denoted service provider. More...
 
Smart::StatusCode disconnect ()
 Disconnect the service requestor from the service provider. More...
 
Smart::StatusCode blocking (const bool b)
 Allow or abort and reject blocking calls. More...
 
Smart::StatusCode send (const C &c)
 Perform a one-way communication. More...
 

Detailed Description

template<class C>
class SmartACE::SendClient< C >

Client part of one-way communication pattern.

Template parameters

Demonstrated in sixth example

Constructor & Destructor Documentation

◆ SendClient() [1/3]

template<class C >
SmartACE::SendClient< C >::SendClient ( SmartComponent component,
const std::string &  port,
SmartACE::WiringSlave slave 
)

Constructor (port wireable from outside by other components).

add()/remove() and connect()/disconnect() can always be used to change the status of the client object. Client is not connected to a server.

Throws exception if port name is already in use.

  • SMART_PORTALREADYUSED : port name already in use
  • SMART_ERROR : something went wrong, instance not created
Parameters
componentmanagement class of the component
portname of the wireable port
slavewiring slave of this component

◆ SendClient() [2/3]

template<class C >
SmartACE::SendClient< C >::SendClient ( SmartComponent component)

Constructor (not wired with service provider and not exposed as port).

add()/remove() and connect()/disconnect() can always be used to change the status of the instance. Instance is not connected to a service provider and is not exposed as port wireable from outside the component.

(Currently exception not thrown)

Parameters
componentmanagement class of the component

◆ SendClient() [3/3]

template<class C >
SmartACE::SendClient< C >::SendClient ( SmartComponent component,
const std::string &  server,
const std::string &  service 
)

Constructor (wired with specified service provider).

Connects to the denoted service and blocks until the connection has been established. Blocks infinitely if denoted service becomes not available since constructor performs retries. Blocking is useful to simplify startup of components which have mutual dependencies. add()/remove() and connect()/disconnect() can always be used to change the status of the instance.

Throws exception if denoted service is incompatible (wrong communication pattern or wrong communication objects).

  • SMART_INCOMPATIBLESERVICE : the denoted service is incompatible (wrong communication pattern or wrong communication objects) and can therefore not be connected. Instance is not created.
  • SMART_ERROR : something went wrong, instance not created
Parameters
componentmanagement class of the component
servername of the server
servicename of the service

◆ ~SendClient()

template<class C >
virtual SmartACE::SendClient< C >::~SendClient ( )
virtual

Destructor.

The destructor calls remove() and disconnect() and therefore properly cleans up.

Member Function Documentation

◆ add()

template<class C >
Smart::StatusCode SmartACE::SendClient< C >::add ( SmartACE::WiringSlave slave,
const std::string &  port 
)

Add this instance to the set of ports wireable via the wiring pattern from outside the component.

Already established connections keep valid. If this service requestor is already exposed as port, it is first removed and then added with the new port name. add()/remove() and connect()/disconnect() can always be used to change the status of this instance.

Parameters
slavewiring slave of this component
portname of port used for wiring
Returns
status code
  • SMART_OK : everything is OK and this instance added to the set of ports wireable from outside the component
  • SMART_PORTALREADYUSED : port name already in use and this instance now not available as port
  • SMART_ERROR : something went wrong

◆ blocking()

template<class C >
Smart::StatusCode SmartACE::SendClient< C >::blocking ( const bool  b)

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. Since this pattern currently does not have any blocking member functions, currently without effect.

Parameters
b(blocking) true/false
Returns
status code
  • SMART_OK : new mode set
  • SMART_ERROR : something went wrong

◆ connect()

template<class C >
Smart::StatusCode SmartACE::SendClient< C >::connect ( const std::string &  server,
const std::string &  service 
)

Connect this service requestor to the denoted service provider.

An already established connection is first disconnected.

It is no problem to change the connection to a service provider at any point of time irrespective of any calls to send().

Parameters
servername of the server
servicename of the service
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()

template<class C >
Smart::StatusCode SmartACE::SendClient< C >::disconnect ( )

Disconnect the service requestor from the service provider.

It is no problem to change the connection to a service provider at any point of time irrespective of any calls to send().

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.

◆ remove()

template<class C >
Smart::StatusCode SmartACE::SendClient< C >::remove ( )

Remove this service requestor from the set of ports wireable via the wiring pattern from outside the component.

Already established connections keep valid but can now be changed only from inside and not from outside this component anymore.

Returns
status code
  • SMART_OK : everything is OK and instance not exposed as port anymore (or was not registered as port).
  • SMART_ERROR : something went wrong but this instance is removed from the set of ports in any case.

◆ send()

template<class C >
Smart::StatusCode SmartACE::SendClient< C >::send ( const C &  c)

Perform a one-way communication.

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

Parameters
cthe 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: