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

add despawn_function argument #1502

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hakuturu583
Copy link
Collaborator

@hakuturu583 hakuturu583 commented Jan 6, 2025

Description

Abstract

Add const std::function<void(const std::string &)> & despawn_function argument to the TrafficSink/TrafficController class.

Background

Fixed #1464 to call EntityManager::despawnEntity function instead of API::despawn function during PR review process.
The API::despawn function included a function to communicate with sensor_simulator, and the function to delete Entity in sensor simulator via inter-process communication was implemented.
The EntityManager::despawnEntity function has been changed to call the EntityManager::despawnEntity function, so Entity in sensor simulator is no longer deleted.

Details

Add const std::function<void(const std::string &)> & despawn_function argument to the TrafficSink/TrafficController class and pass API::despawn function in member initialize list of the API class.

class API
{
public:
  template <typename NodeT, typename AllocatorT = std::allocator<void>, typename... Ts>
  explicit API(NodeT && node, const Configuration & configuration, Ts &&... xs)
  : traffic_controller_ptr_(std::make_shared<traffic::TrafficController>(
      [this](const std::string & name) { despawn(name); }, entity_manager_ptr_,
      configuration.auto_sink_entity_types))

References

#1464
https://star4.slack.com/archives/C04TZBEABDM/p1735261646158039?thread_ts=1735102371.414719&cid=C04TZBEABDM

Destructive Changes

N/A

Known Limitations

The design of this PR is not desirable, but for now it is a PR to solve the problems that have occurred.
In the future, use the Job class to replace the TrafficSink/TrafficSource class for a more reasonable refactor.

Signed-off-by: Masaya Kataoka <[email protected]>
@hakuturu583 hakuturu583 added the bump patch If this pull request merged, bump patch version of the scenario_simulator_v2 label Jan 6, 2025
@hakuturu583 hakuturu583 self-assigned this Jan 6, 2025
Copy link

github-actions bot commented Jan 6, 2025

Checklist for reviewers ☑️

All references to "You" in the following text refer to the code reviewer.

  • Is this pull request written in a way that is easy to read from a third-party perspective?
  • Is there sufficient information (background, purpose, specification, algorithm description, list of disruptive changes, and migration guide) in the description of this pull request?
  • If this pull request contains a destructive change, does this pull request contain the migration guide?
  • Labels of this pull request are valid?
  • All unit tests/integration tests are included in this pull request? If you think adding test cases is unnecessary, please describe why and cross out this line.
  • The documentation for this pull request is enough? If you think adding documents for this pull request is unnecessary, please describe why and cross out this line.

Copy link

sonarqubecloud bot commented Jan 7, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch If this pull request merged, bump patch version of the scenario_simulator_v2 wait for regression test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant