fix #514, call_data_callbacks after shared the data#548
Conversation
benoitmartin88
left a comment
There was a problem hiding this comment.
Great feature to add. Thanks !
Not much is needed to merge this PR.
I think this feature would require a unit test. Could you add this?
656e28b to
3e1d45f
Compare
benoitmartin88
left a comment
There was a problem hiding this comment.
Almost ready to merge.
I do have a few questions that need answering concerning error handling, potentially superfluous functions and writing tests in C++.
f542e39 to
6806742
Compare
benoitmartin88
left a comment
There was a problem hiding this comment.
I think this is almost ready to merge.
Could you make sure the indent and spacing of the modified files is correct ?
Thanks !
Is it normal that the action indent doesn't catch that? |
|
@jbigot Could you review this PR please? |
jbigot
left a comment
There was a problem hiding this comment.
This is a great submission! My main comment is about moving Var_to_reclaim of the provider side instead of expecting each user to implement it. Overall this is really nice though!
|
What's the status for this one? |
c7b95b9 to
b433600
Compare
Yushan-Wang
left a comment
There was a problem hiding this comment.
Looks good to me!
However, I have difficulties understanding the test.
Could you please add a test with hdf5, where the name of the file is a variable?
Before, we had to expose first the filename_size, then the filename. With your change, the order of the expose is then irrelevant.
Or exposing a vector who's size is also a variable?
|
For |
Also simplified error code Fix #657
41fed24 to
b9ebda1
Compare
add Delayed_data_callbacks class remove cout Adding some test how work delayed_data_callbacks class fix comment fix indent and word
0307623 to
6751514
Compare
| std::vector<std::string> m_datanames; | ||
|
|
||
| /// The context where the list of data is a part of | ||
| Global_context& m_context; |
There was a problem hiding this comment.
Maybe shouldn't use a Global_context directly, and should remove the direct include to global_context.h, to go through Context instead with virtuals
There was a problem hiding this comment.
Good catch. We must not use Global_context directly. This variables is not defined in the "pdi/include"
We have three options:
-
- Use instead the class Context as you propose (implemented and tested but not commited yet).
-
- Do a virtual class Delayed_data_callbacks and put the implementation in the src as Data_descriptor
and useGlobal_contextin implementation
- Do a virtual class Delayed_data_callbacks and put the implementation in the src as Data_descriptor
-
- Do a virtual class Delayed_data_callbacks and put the implementation in the src as Data_descriptor
and useContextin the implementation
- Do a virtual class Delayed_data_callbacks and put the implementation in the src as Data_descriptor
| void Delayed_data_callbacks::add_dataname(const std::string& name) | ||
| { | ||
| // Comment: In case of a multi_expose, if the data is defined twice then the callback "on_data" are called twice also in PDI v1.10 | ||
| // Therefore, we need to add the name to have the same behaviour. |
There was a problem hiding this comment.
What is the "same behaviour" here ? We need this emplace_back to reproduce the behaviour where we overwrite the data definition that is already available ?
There was a problem hiding this comment.
If you call this function,
PDI_multi_expose("my_test", "pdi_var1", &var1, PDI_OUT, "pdi_var1", &var1, PDI_OUT, NULL);The callback on data "pdi_var1" is called two times in pdi v1.10.
For example, if the callback corresponds to the user_code function my_func, we call two times the function my_func.
| const int var1 = 3; | ||
| const int var2 = 11; | ||
|
|
||
| PDI_multi_expose("my_test", "pdi_var1", &var1, PDI_OUT, "pdi_var1", &var2, PDI_OUT, NULL); |
There was a problem hiding this comment.
Is writing over const variables intended here (technically ok because not constexpr) ?
There was a problem hiding this comment.
Yes, indeed I need to remove the const here.
!!!INSERT YOUR DESCRIPTION HERE!!!
List of things to check before making a PR
Before merging your code, please check the following:
.clang-format;Fix #issuekeyword to autoclose the issue when merged.