Skip to content

Commit

Permalink
using set
Browse files Browse the repository at this point in the history
  • Loading branch information
katiyar-rahul committed Oct 2, 2024
1 parent 18fcaed commit 42e72df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions livox_ros2_driver/livox_ros2_driver/lds_hub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <string.h>
#include <memory>
#include <thread>
#include <unordered_map>
#include <unordered_set>

#include "rapidjson/document.h"
#include "rapidjson/filereadstream.h"
Expand Down Expand Up @@ -159,7 +159,7 @@ void LdsHub::OnHubDataCb(uint8_t hub_handle, LivoxEthPacket *data,

void LdsHub::OnDeviceBroadcast(const BroadcastDeviceInfo *info) {
// Store warning status per broadcast code to avoid showing the same warning
static std::unordered_map<std::string, bool> whitelist_warning_shown_map;
static std::unordered_set<std::string> whitelist_warning_shown_map;

if (info == NULL) {
return;
Expand All @@ -182,7 +182,7 @@ void LdsHub::OnDeviceBroadcast(const BroadcastDeviceInfo *info) {
if (whitelist_warning_shown_map.find(broadcast_code) == whitelist_warning_shown_map.end()) {
printf("Not in the whitelist, please add %s to if want to connect!\n",
info->broadcast_code);
whitelist_warning_shown_map[broadcast_code] = true;
whitelist_warning_shown_map.insert(broadcast_code);
}
return;
}
Expand Down
6 changes: 3 additions & 3 deletions livox_ros2_driver/livox_ros2_driver/lds_lidar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <memory>
#include <mutex>
#include <thread>
#include <unordered_map>
#include <unordered_set>

#include "rapidjson/document.h"
#include "rapidjson/filereadstream.h"
Expand Down Expand Up @@ -174,7 +174,7 @@ void LdsLidar::OnLidarDataCb(uint8_t handle, LivoxEthPacket *data,

void LdsLidar::OnDeviceBroadcast(const BroadcastDeviceInfo *info) {
// Store warning status per broadcast code to avoid showing the same warning
static std::unordered_map<std::string, bool> whitelist_warning_shown_map;
static std::unordered_set<std::string> whitelist_warning_shown_map;

if (info == nullptr) {
return;
Expand All @@ -198,7 +198,7 @@ void LdsLidar::OnDeviceBroadcast(const BroadcastDeviceInfo *info) {
if (whitelist_warning_shown_map.find(broadcast_code) == whitelist_warning_shown_map.end()) {
printf("Not in the whitelist, please add %s to if want to connect!\n",
info->broadcast_code);
whitelist_warning_shown_map[broadcast_code] = true;
whitelist_warning_shown_map.insert(broadcast_code);
}
return;
}
Expand Down

0 comments on commit 42e72df

Please sign in to comment.