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

Use cxx::function were it is appropriate #831

Closed
3 tasks done
MatthiasKillat opened this issue Jun 2, 2021 · 4 comments · Fixed by #1411 or #1423
Closed
3 tasks done

Use cxx::function were it is appropriate #831

MatthiasKillat opened this issue Jun 2, 2021 · 4 comments · Fixed by #1411 or #1423
Assignees
Labels
globex refactoring Refactor code without adding features
Milestone

Comments

@MatthiasKillat
Copy link
Contributor

MatthiasKillat commented Jun 2, 2021

Brief feature description

We have some std::function usages left in iceoryx hoofs. They should be replaced with cxx::function.
This affects constructs needing callbacks, like GenericRAII (a better name would be RAIIGuard or similar) and others.
Furthermore constructs that are not used like ActiveObject are also affected.

Note that there are no direct occurrences in posh (but indirectly, via hoofs).

Detailed information

We can replace them with cxx::function but need to choose its capacity carefully, likely on a case by case basis. We may have something global like cxx::function<Signature, 100> as well, in memory of its deceased cousin string<100> .

It could make sense to have some default (not 100 though, we should use powers of 2). Still a specific case can be used on a case by case basis also (we will learn what works best by trying it for some cases). For internal use, i.e. no user defined callbacks, this makes sense sinc ewe can just increase the capacity if needed later (it will not compile in this case).

User defined callbacks are a a different matter, but we need a bound here as well.

This issue may be broken down further to handle specific occurrences of std::function should it prove more complex.

Tasks

  • Replace or remove std::function in iceoryx_hoofs
  • Replace MethodCallback with cxx::function
  • Remove MethodCallback from iceoryx_hoofs
@MatthiasKillat MatthiasKillat added enhancement New feature refactoring Refactor code without adding features and removed enhancement New feature labels Jun 2, 2021
@mossmaurice mossmaurice added this to the Prio 1 milestone Aug 27, 2021
@dkroenke dkroenke added the globex label Jun 8, 2022
@elBoberido
Copy link
Member

@mossmaurice do you think the MethodCallback can also be replaced in the context of this issue?

@mossmaurice
Copy link
Contributor

mossmaurice commented Jun 9, 2022

do you think the MethodCallback can also be replaced in the context of this issue?

@elBoberido That's a good idea. I would defintely do it in separate PRs. However, I think this will be quite some effort. But removing MethodCallback sooner than later would be great.

@elBoberido
Copy link
Member

@mossmaurice shall I extend the issue name ("Use cxx::function were it is appropriate") and add two tasks, one for std::function and one for MethodCallback?

@mossmaurice mossmaurice changed the title Replace or remove std::function in iceoryx hoofs Use cxx::function were it is appropriate Jun 10, 2022
@elfenpiff
Copy link
Contributor

@MatthiasKillat @mossmaurice @elBoberido

I added a subtask to also remove the MethodCallback. This was only a quick solution to capture this in a callback and with cxx::function this abstraction is not needed anymore.

mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 14, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 22, 2022
… value

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 22, 2022
… value

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 22, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 22, 2022
…val and

clang-format

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 22, 2022
…val and

clang-format

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 22, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 22, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit that referenced this issue Jun 22, 2022
iox-#831 Replace `std::function` with `cxx::function`
@mossmaurice mossmaurice reopened this Jun 22, 2022
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
…with cxx::function

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
cxx::function and remove unused Trigger::updateOrigin

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
…oval

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
cxx::function and remove unused Trigger::updateOrigin

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
…oval

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
…mer tests

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
…mer tests

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
…mer tests

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 27, 2022
…mer tests

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 28, 2022
cxx::function and remove unused Trigger::updateOrigin

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 28, 2022
…oval

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 28, 2022
…mer tests

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 28, 2022
…on of 'cxx::function::operator!'

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 28, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 29, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 29, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 29, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit to ApexAI/iceoryx that referenced this issue Jun 29, 2022
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
mossmaurice added a commit that referenced this issue Jun 29, 2022
…with-cxx-function

iox-#831 Replace `MethodCallback` with `cxx::function`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
globex refactoring Refactor code without adding features
Projects
None yet
5 participants