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

Conversation

rex-schilasky
Copy link
Contributor

Description

The new c++ core api is missing a few functions (set/get_qos, set_layer, set_type_name, set_description ..) and has some new functionalies like separated encoding and type naming.

This PR is fixing the python wrapper that way, that all samples are working again almost without any changes (two samples latency_rec/rec_cb needed small adaptions because of different (now correct) behavior of ecal_ok()).

Cherry-pick to

  • none

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

*
* @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_);

*
* @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_);

char* topic_type = nullptr;
char* topic_enc = nullptr;
char* topic_desc = nullptr;
Py_ssize_t topic_desc_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'topic_desc_len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
Py_ssize_t topic_desc_len = 0;
Py_ssize_t topic_desc_len = 0 = 0;

char* topic_type = nullptr;
char* topic_enc = nullptr;
char* topic_desc = nullptr;
Py_ssize_t topic_desc_len = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'topic_desc_len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
Py_ssize_t topic_desc_len = 0;
Py_ssize_t topic_desc_len = 0 = 0;

return nullptr;

ECAL_HANDLE sub{ nullptr };
Py_BEGIN_ALLOW_THREADS
sub = sub_create(topic_name, topic_type);
sub = sub_create(topic_name, topic_type, topic_enc, topic_desc, (int)topic_desc_len);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'sub' is not initialized [cppcoreguidelines-init-variables]

Suggested change
sub = sub_create(topic_name, topic_type, topic_enc, topic_desc, (int)topic_desc_len);
sub = 0 = sub_create(topic_name, topic_type, topic_enc, topic_desc, (int)topic_desc_len);

Copy link
Contributor

@KerstinKeller KerstinKeller left a comment

Choose a reason for hiding this comment

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

👍

@rex-schilasky rex-schilasky merged commit 3092e1b into master Mar 11, 2024
14 checks passed
@rex-schilasky rex-schilasky deleted the bugfix/python-api-fixed-for-new-core branch March 11, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants