Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] python api fixed to work again based on new c++/c core api #1439

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions ecal/core/include/ecal/ecal_clang.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,15 @@ ECAL_API void log_message(const char* message_);
/**
* @brief Create a publisher.
*
* @param topic_name_ Unique topic name.
* @param topic_type_ Topic type name.
* @param topic_name_ Unique topic name.
* @param topic_type_ Topic type name.
* @param topic_enc_ Topic type encoding.
* @param topic_desc_ Topic type description.
* @param topic_desc_length_ Topic type description length.
*
* @return Handle of the created publisher or NULL if failed.
**/
ECAL_API ECAL_HANDLE pub_create(const char* topic_name_, const char* topic_type_);
ECAL_API ECAL_HANDLE pub_create(const char* topic_name_, const char* topic_type_, const char* topic_enc_, const char* topic_desc_, const int topic_desc_length_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter 'topic_desc_length_' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]

Suggested change
ECAL_API ECAL_HANDLE pub_create(const char* topic_name_, const char* topic_type_, const char* topic_enc_, const char* topic_desc_, const int topic_desc_length_);
ECAL_API ECAL_HANDLE pub_create(const char* topic_name_, const char* topic_type_, const char* topic_enc_, const char* topic_desc_, int topic_desc_length_);


/**
* @brief Destroy a publisher.
Expand Down Expand Up @@ -287,12 +290,15 @@ ECAL_API bool pub_rem_event_callback(ECAL_HANDLE handle_, enum eCAL_Publisher_Ev
/**
* @brief Create a subscriber.
*
* @param topic_name_ Unique topic name.
* @param topic_type_ Topic type name.
* @param topic_name_ Unique topic name.
* @param topic_type_ Topic type name.
* @param topic_enc_ Topic type encoding.
* @param topic_desc_ Topic type description.
* @param topic_desc_length_ Topic type description length.
*
* @return Handle of the created subscriber or NULL if failed.
**/
ECAL_API ECAL_HANDLE sub_create(const char* topic_name_, const char* topic_type_);
ECAL_API ECAL_HANDLE sub_create(const char* topic_name_, const char* topic_type_, const char* topic_enc_, const char* topic_desc_, const int topic_desc_length_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter 'topic_desc_length_' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]

Suggested change
ECAL_API ECAL_HANDLE sub_create(const char* topic_name_, const char* topic_type_, const char* topic_enc_, const char* topic_desc_, const int topic_desc_length_);
ECAL_API ECAL_HANDLE sub_create(const char* topic_name_, const char* topic_type_, const char* topic_enc_, const char* topic_desc_, int topic_desc_length_);


/**
* @brief Destroy a subscriber.
Expand Down
14 changes: 10 additions & 4 deletions ecal/core/src/ecal_clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,13 @@ ECAL_API void log_message(const char* message_)
/****************************************/
/* pub_create */
/****************************************/
ECAL_API ECAL_HANDLE pub_create(const char* topic_name_, const char* topic_type_)
ECAL_API ECAL_HANDLE pub_create(const char* topic_name_, const char* topic_type_, const char* topic_enc_, const char* topic_desc_, const int topic_desc_length_)
{
eCAL::SDataTypeInformation topic_info;
topic_info.name = topic_type_;
topic_info.name = topic_type_;
topic_info.encoding = topic_enc_;
topic_info.descriptor = std::string(topic_desc_, static_cast<size_t>(topic_desc_length_));

auto* pub = new eCAL::CPublisher;
if (!pub->Create(topic_name_, topic_info))
{
Expand Down Expand Up @@ -365,10 +368,13 @@ ECAL_API bool pub_rem_event_callback(ECAL_HANDLE handle_, enum eCAL_Publisher_Ev
/****************************************/
/* sub_create */
/****************************************/
ECAL_API ECAL_HANDLE sub_create(const char* topic_name_, const char* topic_type_)
ECAL_API ECAL_HANDLE sub_create(const char* topic_name_, const char* topic_type_, const char* topic_enc_, const char* topic_desc_, const int topic_desc_length_)
{
eCAL::SDataTypeInformation topic_info;
topic_info.name = topic_type_;
topic_info.name = topic_type_;
topic_info.encoding = topic_enc_;
topic_info.descriptor = std::string(topic_desc_, static_cast<size_t>(topic_desc_length_));

auto* sub = new eCAL::CSubscriber;
if (!sub->Create(topic_name_, topic_info))
{
Expand Down
Loading
Loading