Skip to content

Commit

Permalink
[core] Remove all instances of EnableLoopback as it can be set via …
Browse files Browse the repository at this point in the history
…configuration (and is enabled per default). (#1833)
  • Loading branch information
KerstinKeller authored Dec 4, 2024
1 parent 03f9fa8 commit ec3eb9b
Show file tree
Hide file tree
Showing 34 changed files with 8 additions and 226 deletions.
9 changes: 0 additions & 9 deletions ecal/core/include/ecal/cimpl/ecal_util_cimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ extern "C"
* @brief Send shutdown event to all local core components.
**/
ECALC_API void eCAL_Util_ShutdownCore();

/**
* @brief Enable eCAL message loop back,
* that means subscriber will receive messages from
* publishers of the same process (default == false).
*
* @param state_ Switch on message loop back..
**/
ECALC_API void eCAL_Util_EnableLoopback(int state_);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
Expand Down
9 changes: 0 additions & 9 deletions ecal/core/include/ecal/ecal_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ namespace eCAL
**/
ECAL_API void ShutdownCore();

/**
* @brief Enable eCAL message loop back,
* that means subscriber will receive messages from
* publishers of the same process (default == false).
*
* @param state_ Switch on message loop back.
**/
ECAL_API void EnableLoopback(bool state_);

/**
* @brief Enable process wide eCAL publisher topic type sharing
* that is needed for reflection on subscriber side.
Expand Down
5 changes: 0 additions & 5 deletions ecal/core/src/cimpl/ecal_util_cimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,4 @@ extern "C"
eCAL::Util::ShutdownCore();
}
#endif // ECAL_CORE_MONITORING

ECALC_API void eCAL_Util_EnableLoopback(int state_)
{
eCAL::Util::EnableLoopback(state_ != 0);
}
}
7 changes: 0 additions & 7 deletions ecal/core/src/ecal_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ namespace eCAL
{
namespace Util
{
void EnableLoopback(bool state_)
{
#if ECAL_CORE_REGISTRATION
if (g_registration_receiver() != nullptr) g_registration_receiver()->EnableLoopback(state_);
#endif
}

void PubShareType(bool state_)
{
#if ECAL_CORE_PUBLISHER
Expand Down
3 changes: 0 additions & 3 deletions ecal/core/src/monitoring/ecal_monitoring_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ namespace eCAL
{
if (m_init) return;

// enable loopback to monitor process internal entities as well
eCAL::Util::EnableLoopback(true);

// utilize registration receiver to enrich monitor information
g_registration_receiver()->SetCustomApplySampleCallback("monitoring", [this](const auto& sample_){this->ApplySample(sample_, tl_none);});

Expand Down
5 changes: 0 additions & 5 deletions ecal/core/src/registration/ecal_registration_receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,6 @@ namespace eCAL
m_created = false;
}

void CRegistrationReceiver::EnableLoopback(bool state_)
{
m_sample_applier.EnableLoopback(state_);
}

bool CRegistrationReceiver::AddRegistrationCallback(enum eCAL_Registration_Event event_, const RegistrationCallbackT& callback_)
{
return m_user_applier.AddRegistrationCallback(event_, callback_);
Expand Down
2 changes: 0 additions & 2 deletions ecal/core/src/registration/ecal_registration_receiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ namespace eCAL
void Start();
void Stop();

void EnableLoopback(bool state_);

bool AddRegistrationCallback(enum eCAL_Registration_Event event_, const RegistrationCallbackT& callback_);
bool RemRegistrationCallback(enum eCAL_Registration_Event event_);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ namespace eCAL
{
}

void CSampleApplier::EnableLoopback(bool state_)
{
m_attributes.loopback = state_;
}

bool CSampleApplier::ApplySample(const Registration::Sample& sample_)
{
if (!AcceptRegistrationSample(sample_))
Expand Down
2 changes: 0 additions & 2 deletions ecal/core/src/registration/ecal_registration_sample_applier.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ namespace eCAL
public:
CSampleApplier(const SampleApplier::SAttributes& attr_);

// to be removed for eCAL 6, but keep until eCAL 5.14
void EnableLoopback(bool state_);
bool ApplySample(const Registration::Sample& sample_);

using ApplySampleCallbackT = std::function<void(const Registration::Sample&)>;
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/perftool/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ int main(int argc, char** argv)

// Initialize eCAL
eCAL::Initialize(argc, argv, "ecal-perftool");
eCAL::Util::EnableLoopback(true);

const Publisher publisher(topic_name, frequency_hz, payload_size_bytes, quiet_arg, verbose_print_times);

Expand Down Expand Up @@ -225,7 +224,6 @@ int main(int argc, char** argv)

// Initialize eCAL
eCAL::Initialize(argc, argv, "ecal-perftool");
eCAL::Util::EnableLoopback(true);

const Subscriber subscriber(topic_name, callback_delay, busy_wait_arg, hickup_arg, hickup_time, hickup_delay, quiet_arg, verbose_print_times);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -111,9 +111,6 @@ int main(int argc, char **argv)
// initialize eCAL API
eCAL::Initialize(argc, argv, "pubsub_throughput");

// publish / subscribe match in the same process
eCAL::Util::EnableLoopback(true);

std::cout << "---------------------------" << '\n';
std::cout << "LAYER: SHM" << '\n';
std::cout << "---------------------------" << '\n';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,9 +33,6 @@ int main(int argc, char **argv)
// set process state
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "I feel good !");

// enable to receive our own messages
eCAL::Util::EnableLoopback(true);

// create a publisher (topic name "person")
eCAL::protobuf::CPublisher<pb::People::Person> pub("person");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ TEST(core_cpp_clientserver_proto, ProtoCallback)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver proto callback test");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create MathService server
std::shared_ptr<MathServiceImpl> math_service_impl = std::make_shared<MathServiceImpl>();
eCAL::protobuf::CServiceServer<MathService> math_server(math_service_impl);
Expand Down Expand Up @@ -165,9 +162,6 @@ TEST(core_cpp_clientserver_proto, ProtoBlocking)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver proto blocking test");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create PingService server
std::shared_ptr<PingServiceImpl> ping_service_impl = std::make_shared<PingServiceImpl>();
eCAL::protobuf::CServiceServer<PingService> ping_server(ping_service_impl);
Expand Down
24 changes: 0 additions & 24 deletions ecal/tests/cpp/clientserver_test/src/clientserver_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ TEST(core_cpp_clientserver, ClientConnectEvent)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base connect event callback");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create client
eCAL::CServiceClient client("service");

Expand Down Expand Up @@ -166,9 +163,6 @@ TEST(core_cpp_clientserver, ServerConnectEvent)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base connect event callback");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create server
eCAL::CServiceServer server("service");

Expand Down Expand Up @@ -242,9 +236,6 @@ TEST(core_cpp_clientserver, BaseCallback)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base callback test");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create service servers
ServiceVecT service_vec;
for (auto s = 0; s < num_services; ++s)
Expand Down Expand Up @@ -359,9 +350,6 @@ TEST(core_cpp_clientserver, BaseCallbackTimeout)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base callback test with timeout");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create service servers
ServiceVecT service_vec;
for (auto s = 0; s < num_services; ++s)
Expand Down Expand Up @@ -530,9 +518,6 @@ TEST(core_cpp_clientserver, BaseAsyncCallback)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base async callback test");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create service server
eCAL::CServiceServer server("service");

Expand Down Expand Up @@ -606,9 +591,6 @@ TEST(core_cpp_clientserver, BaseAsync)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base async callback test with timeout");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create service server
eCAL::CServiceServer server("service");

Expand Down Expand Up @@ -719,9 +701,6 @@ TEST(core_cpp_clientserver, BaseBlocking)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base blocking test");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create service servers
ServiceVecT service_vec;
for (auto s = 0; s < num_services; ++s)
Expand Down Expand Up @@ -823,9 +802,6 @@ TEST(core_cpp_clientserver, NestedRPCCall)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "nested rpc call test");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create service server
eCAL::CServiceServer server("service");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class ProtoDynSubscriberTest : public ::testing::Test {
{
// Initialize eCAL
eCAL::Initialize();
// publish / subscribe match in the same process
eCAL::Util::EnableLoopback(true);
}

~ProtoDynSubscriberTest() override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class ProtoSubscriberTest : public ::testing::Test {
{
// Initialize eCAL
eCAL::Initialize();
// publish / subscribe match in the same process
eCAL::Util::EnableLoopback(true);
}

~ProtoSubscriberTest() override {
Expand Down
3 changes: 0 additions & 3 deletions ecal/tests/cpp/pubsub_test/src/pubsub_acknowledge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ TEST(core_cpp_pubsub, TimeoutAcknowledgment)
// initialize eCAL API
EXPECT_EQ(0, eCAL::Initialize(0, nullptr, "TimeoutAcknowledgment", eCAL::Init::All));

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);

// create publisher config
eCAL::Publisher::Configuration pub_config;
pub_config.layer.shm.acknowledge_timeout_ms = 500;
Expand Down
9 changes: 0 additions & 9 deletions ecal/tests/cpp/pubsub_test/src/pubsub_connection_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ TEST(core_cpp_pubsub, TestSubscriberIsPublishedTiming)
// initialize eCAL API
EXPECT_EQ(0, eCAL::Initialize(0, nullptr, "subscriber_is_published"));

// enable data loopback
eCAL::Util::EnableLoopback(true);

std::atomic<bool> do_start_publication(false);
std::atomic<bool> publication_finished(false);

Expand Down Expand Up @@ -137,9 +134,6 @@ TEST(core_cpp_pubsub, TestPublisherIsSubscribedTiming)
// initialize eCAL API
EXPECT_EQ(0, eCAL::Initialize(0, nullptr, "publisher_is_subscribed"));

// enable data loopback
eCAL::Util::EnableLoopback(true);

std::atomic<bool> do_start_publication(false);
std::atomic<bool> publication_finished(false);

Expand Down Expand Up @@ -236,9 +230,6 @@ TEST(core_cpp_pubsub, TestChainedPublisherSubscriberCallback)
// initialize eCAL API
EXPECT_EQ(0, eCAL::Initialize(0, nullptr, "chained_publisher_subscriber"));

// enable data loopback
eCAL::Util::EnableLoopback(true);

// Set up counters for sent and received messages
const int message_count = 10;
std::atomic<int> publisher1_sent_count(0);
Expand Down
5 changes: 1 addition & 4 deletions ecal/tests/cpp/pubsub_test/src/pubsub_multibuffer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -129,9 +129,6 @@ TEST(core_cpp_pubsub, MultibufferPubSub)
// initialize eCAL API
eCAL::Initialize(0, nullptr, "pubsub_test");

// publish / subscribe match in the same process
eCAL::Util::EnableLoopback(true);

// number of iterations
const int publications(11);
const int bytes_to_read(10);
Expand Down
6 changes: 0 additions & 6 deletions ecal/tests/cpp/pubsub_test/src/pubsub_receive_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ TEST(core_cpp_pubsub, TimingSubscriberReceive)
// initialize eCAL API
EXPECT_EQ(0, eCAL::Initialize(0, nullptr, "subscriber_receive_timing"));

// publish / subscribe match in the same process
eCAL::Util::EnableLoopback(true);

// create simple string publisher
eCAL::string::CPublisher<std::string> pub("CLOCK");
eCAL::string::CSubscriber<std::string> sub("CLOCK");
Expand Down Expand Up @@ -168,9 +165,6 @@ TEST(core_cpp_pubsub, SporadicEmptyReceives)
// initialize eCAL API
EXPECT_EQ(0, eCAL::Initialize(0, nullptr, "sporadic_empty_receives"));

// publish / subscribe match in the same process
eCAL::Util::EnableLoopback(true);

// create simple string publisher
eCAL::string::CPublisher<std::string> pub("CLOCK");
eCAL::string::CSubscriber<std::string> sub("CLOCK");
Expand Down
Loading

0 comments on commit ec3eb9b

Please sign in to comment.