-
Notifications
You must be signed in to change notification settings - Fork 59
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
z_open should accept z_open_options_t to allow for future extensions #352
Comments
There was also a request from @kydos to provide On the zenoh-c side we can put pointer to config inside options structure, allow it to be nullptr and ,provide The code will look like: z_owned_session_t session;
int err = z_open(&session, z_open_options_default()); Here I assume that we passing options by value, which is not the case at this moment. Issue #401 was created for this |
z_owned_config_t config;
z_config_new(&config);
z_owned_session_t session;
z_open_options_t opts;
z_open_options_default(&opts);
opts.config = z_move(config);
int err = z_open(&session, &opts); vs z_owned_config_t config;
z_config_new(&config);
z_owned_session_t session;
z_open_options_t opts = z_open_options_default();
opts.config = z_move(config);
int err = z_open(&session, opts); |
To allow providing options inline and specifying only non-default values we can probably try to use macros as proposed here https://stackoverflow.com/questions/13716913/default-value-for-struct-member-in-c. |
All session open parameters now comes through config, seems it's controversial idea to complexify z_open with additional parameter. If we need this in future, we can make addition open function with "options" |
accordingly to @Mallets comment in discord: same thing for |
Describe the release item
z_open signature should be changed to
z_error_t z_open(struct z_owned_session_t *this_, struct z_owned_config_t *config, const z_open_options_t *options);
This will allow providing more options in the future without breaking the api.
The text was updated successfully, but these errors were encountered: