7.4.5
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
Regression test.
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.