Skip to content

Commit

Permalink
topic, clients, services get unregistered actively from DescGate
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Apr 10, 2024
1 parent 265cf73 commit 6b6cf04
Show file tree
Hide file tree
Showing 14 changed files with 647 additions and 187 deletions.
51 changes: 51 additions & 0 deletions ecal/core/include/ecal/cimpl/ecal_util_cimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,57 @@ extern "C"
* @return Response description buffer length or zero if failed.
**/
ECALC_API int eCAL_Util_GetServiceResponseDescription(const char* service_name_, const char* method_name_, void* resp_desc_, int resp_desc_len_);

/**
* @brief Gets client method request type name.
*
* @param client_name_ Client name.
* @param method_name_ Method name.
* @param [out] req_type_ Pointer to store the request type.
* @param req_type_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if
* eCAL should allocate the buffer for you (see eCAL_FreeMem).
*
* @return Type name buffer length or zero if failed.
**/
ECALC_API int eCAL_Util_GetClientRequestTypeName(const char* client_name_, const char* method_name_, void* req_type_, int req_type_len_);

/**
* @brief Gets client method response type name.
*
* @param client_name_ Client name.
* @param method_name_ Method name.
* @param [out] resp_type_ Pointer to store the response type.
* @param resp_type_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if
*
* @return Type name buffer length or zero if failed.
**/
ECALC_API int eCAL_Util_GetClientResponseTypeName(const char* client_name_, const char* method_name_, void* resp_type_, int resp_type_len_);

/**
* @brief Gets client method request description.
*
* @param client_name_ Client name.
* @param method_name_ Method name.
* @param [out] req_desc_ Pointer to store the request description.
* @param req_desc_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if
* eCAL should allocate the buffer for you (see eCAL_FreeMem).
*
* @return Request description buffer length or zero if failed.
**/
ECALC_API int eCAL_Util_GetClientRequestDescription(const char* client_name_, const char* method_name_, void* req_desc_, int req_desc_len_);

/**
* @brief Gets client method response description.
*
* @param client_name_ Client name.
* @param method_name_ Method name.
* @param [out] resp_desc_ Pointer to store the response description.
* @param resp_desc_len_ Length of allocated buffer or ECAL_ALLOCATE_4ME if
* eCAL should allocate the buffer for you (see eCAL_FreeMem).
*
* @return Response description buffer length or zero if failed.
**/
ECALC_API int eCAL_Util_GetClientResponseDescription(const char* client_name_, const char* method_name_, void* resp_desc_, int resp_desc_len_);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
Expand Down
41 changes: 40 additions & 1 deletion ecal/core/include/ecal/ecal_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ namespace eCAL
*
* @param service_method_names_ Vector to store the service/method tuples (Vector { (ServiceName, MethodName) }).
**/
ECAL_API void GetServiceNames(std::vector<std::tuple<std::string, std::string>>& service_method_names_);
ECAL_API void GetServiceMethodNames(std::vector<std::tuple<std::string, std::string>>& service_method_names_);

/**
* @brief Gets service method request and response type names.
Expand All @@ -187,6 +187,45 @@ namespace eCAL
**/
ECAL_API bool GetServiceDescription(const std::string& service_name_, const std::string& method_name_, std::string& req_desc_, std::string& resp_desc_);

/**
* @brief Get complete client map (including request and response types and descriptions).
*
* @param client_info_map_ Map to store the datatype descriptions.
* Map { (ClientName, MethodName) -> ( (ReqType, ReqDescription), (RespType, RespDescription) ) } mapping of all currently known clients.
**/
ECAL_API void GetClients(std::map<std::tuple<std::string, std::string>, SServiceMethodInformation>& client_info_map_);

/**
* @brief Get all client/method names.
*
* @param client_method_names_ Vector to store the client/method tuples (Vector { (ClientName, MethodName) }).
**/
ECAL_API void GetClientMethodNames(std::vector<std::tuple<std::string, std::string>>& client_method_names_);

/**
* @brief Gets client method request and response type names.
*
* @param client_name_ Client name.
* @param method_name_ Method name.
* @param req_type_ String to store request type.
* @param resp_type_ String to store response type.
*
* @return True if succeeded.
**/
ECAL_API bool GetClientTypeNames(const std::string& client_name_, const std::string& method_name_, std::string& req_type_, std::string& resp_type_);

/**
* @brief Gets client method request and response descriptions.
*
* @param client_name_ Client name.
* @param method_name_ Method name.
* @param req_desc_ String to store request description.
* @param resp_desc_ String to store response description.
*
* @return True if succeeded.
**/
ECAL_API bool GetClientDescription(const std::string& client_name_, const std::string& method_name_, std::string& req_desc_, std::string& resp_desc_);

/**
* @brief Splits the topic type (eCAL < 5.12) into encoding and types (>= eCAL 5.12)
*
Expand Down
56 changes: 56 additions & 0 deletions ecal/core/src/cimpl/ecal_util_cimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,60 @@ extern "C"
}
return 0;
}

ECALC_API int eCAL_Util_GetClientRequestTypeName(const char* client_name_, const char* method_name_, void* req_type_, int req_type_len_)
{
if (client_name_ == nullptr) return(0);
if (method_name_ == nullptr) return(0);
if (req_type_ == nullptr) return(0);
std::string req_type;
std::string resp_type;
if (eCAL::Util::GetClientTypeNames(client_name_, method_name_, req_type, resp_type))
{
return(CopyBuffer(req_type_, req_type_len_, req_type));
}
return 0;
}

ECALC_API int eCAL_Util_GetClientResponseTypeName(const char* client_name_, const char* method_name_, void* resp_type_, int resp_type_len_)
{
if (client_name_ == nullptr) return(0);
if (method_name_ == nullptr) return(0);
if (resp_type_ == nullptr) return(0);
std::string req_type;
std::string resp_type;
if (eCAL::Util::GetClientTypeNames(client_name_, method_name_, req_type, resp_type))
{
return(CopyBuffer(resp_type_, resp_type_len_, resp_type));
}
return 0;
}

ECALC_API int eCAL_Util_GetClientRequestDescription(const char* client_name_, const char* method_name_, void* req_desc_, int req_desc_len_)
{
if (client_name_ == nullptr) return(0);
if (method_name_ == nullptr) return(0);
if (req_desc_ == nullptr) return(0);
std::string req_desc;
std::string resp_desc;
if (eCAL::Util::GetClientDescription(client_name_, method_name_, req_desc, resp_desc))
{
return(CopyBuffer(req_desc_, req_desc_len_, req_desc));
}
return 0;
}

ECALC_API int eCAL_Util_GetClientResponseDescription(const char* client_name_, const char* method_name_, void* resp_desc_, int resp_desc_len_)
{
if (client_name_ == nullptr) return(0);
if (method_name_ == nullptr) return(0);
if (resp_desc_ == nullptr) return(0);
std::string req_desc;
std::string resp_desc;
if (eCAL::Util::GetClientDescription(client_name_, method_name_, req_desc, resp_desc))
{
return(CopyBuffer(resp_desc_, resp_desc_len_, resp_desc));
}
return 0;
}
}
Loading

0 comments on commit 6b6cf04

Please sign in to comment.