Class CServiceServer

Class Documentation

class CServiceServer

Service Server wrapper class.

Public Functions

CServiceServer()

Constructor.

CServiceServer(const std::string &service_name_)

Constructor.

Parameters

service_name_ – Unique service name.

virtual ~CServiceServer()

Destructor.

CServiceServer(const CServiceServer&) = delete

CServiceServers are non-copyable.

CServiceServer &operator=(const CServiceServer&) = delete

CServiceServers are non-copyable.

bool Create(const std::string &service_name_)

Creates this object.

Parameters

service_name_ – Unique service name.

Returns

True if successful.

bool Destroy()

Destroys this object.

Returns

True if successful.

bool AddDescription(const std::string &method_, const std::string &req_type_, const std::string &req_desc_, const std::string &resp_type_, const std::string &resp_desc_)

Add method type descriptions.

Parameters
  • method_ – Service method name.

  • req_type_ – Service method request type.

  • req_desc_ – Service method request description.

  • resp_type_ – Service method response type.

  • resp_desc_ – Service method response description.

Returns

True if successful.

bool AddMethodCallback(const std::string &method_, const std::string &req_type_, const std::string &resp_type_, const MethodCallbackT &callback_)

Add method callback.

Parameters
  • method_ – Service method name.

  • req_type_ – Service method request type.

  • resp_type_ – Service method response type.

  • callback_ – Callback function for client request.

Returns

True if successful.

bool RemMethodCallback(const std::string &method_)

Remove method callback.

Parameters

method_ – Service method name.

Returns

True if successful.

bool AddEventCallback(eCAL_Server_Event type_, ServerEventCallbackT callback_)

Add server event callback function.

Parameters
  • type_ – The event type to react on.

  • callback_ – The callback function to add.

Returns

True if succeeded, false if not.

bool RemEventCallback(eCAL_Server_Event type_)

Remove server event callback function.

Parameters

type_ – The event type to remove.

Returns

True if succeeded, false if not.

std::string GetServiceName()

Retrieve service name.

Returns

The service name.

bool IsConnected()

Check connection state.

Returns

True if connected, false if not.