From 3c4158addb8517828fbd6986e10eb9624e5dc04a Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Fri, 28 May 2021 12:44:27 +0200 Subject: [PATCH] Remove useless code --- examples/1-1/sampler.cxx | 15 ++++++--------- examples/1-1/sink.cxx | 4 +--- examples/1-n-1/processor.cxx | 4 +--- examples/1-n-1/sampler.cxx | 15 ++++++--------- examples/1-n-1/sink.cxx | 6 ++---- examples/copypush/sampler.cxx | 8 ++------ examples/copypush/sink.cxx | 3 +-- examples/dds/processor.cxx | 4 +--- examples/dds/sampler.cxx | 6 +----- examples/dds/sink.cxx | 4 +--- examples/multipart/sampler.cxx | 6 +----- examples/multipart/sink.cxx | 4 +--- examples/multiple-channels/broadcaster.cxx | 6 +----- examples/multiple-channels/sampler.cxx | 7 ++----- examples/multiple-channels/sink.cxx | 3 +-- examples/multiple-transports/sampler1.cxx | 7 ++----- examples/multiple-transports/sampler2.cxx | 7 +------ examples/multiple-transports/sink.cxx | 4 +--- examples/n-m/receiver.cxx | 7 ++----- examples/n-m/sender.cxx | 5 +---- examples/n-m/synchronizer.cxx | 6 ++---- examples/qc/qCDispatcher.cxx | 4 +--- examples/qc/sampler.cxx | 8 ++------ examples/qc/sink.cxx | 5 +---- examples/readout/processor.cxx | 4 +--- examples/readout/readout.cxx | 5 +---- examples/readout/receiver.cxx | 5 +---- examples/readout/sender.cxx | 5 +---- examples/region/sampler.cxx | 5 +---- examples/region/sink.cxx | 5 +---- examples/req-rep/client.cxx | 5 +---- examples/req-rep/server.cxx | 3 +-- fairmq/devices/BenchmarkSampler.h | 2 -- fairmq/devices/Merger.h | 10 ++-------- fairmq/devices/Multiplier.h | 3 --- fairmq/devices/Proxy.h | 3 --- fairmq/devices/Sink.h | 3 --- fairmq/devices/Splitter.h | 3 --- 38 files changed, 51 insertions(+), 158 deletions(-) diff --git a/examples/1-1/sampler.cxx b/examples/1-1/sampler.cxx index 0eb02ab4..797d7850 100644 --- a/examples/1-1/sampler.cxx +++ b/examples/1-1/sampler.cxx @@ -13,16 +13,8 @@ namespace bpo = boost::program_options; -class Sampler : public FairMQDevice +struct Sampler : fair::mq::Device { - public: - Sampler() = default; - - protected: - std::string fText; - uint64_t fMaxIterations = 0; - uint64_t fNumIterations = 0; - void InitTask() override { // Get the fText and fMaxIterations values from the command line options (via fConfig) @@ -57,6 +49,11 @@ class Sampler : public FairMQDevice return true; } + + private: + std::string fText; + uint64_t fMaxIterations = 0; + uint64_t fNumIterations = 0; }; void addCustomOptions(bpo::options_description& options) diff --git a/examples/1-1/sink.cxx b/examples/1-1/sink.cxx index b28cb996..c044a8a4 100644 --- a/examples/1-1/sink.cxx +++ b/examples/1-1/sink.cxx @@ -13,16 +13,14 @@ namespace bpo = boost::program_options; -class Sink : public FairMQDevice +struct Sink : fair::mq::Device { - public: Sink() { // register a handler for data arriving on "data" channel OnData("data", &Sink::HandleData); } - protected: void InitTask() override { // Get the fMaxIterations value from the command line options (via fConfig) diff --git a/examples/1-n-1/processor.cxx b/examples/1-n-1/processor.cxx index 39aedbdb..0703fd7d 100644 --- a/examples/1-n-1/processor.cxx +++ b/examples/1-n-1/processor.cxx @@ -13,15 +13,13 @@ namespace bpo = boost::program_options; -class Processor : public FairMQDevice +struct Processor : fair::mq::Device { - public: Processor() { OnData("data1", &Processor::HandleData); } - protected: bool HandleData(FairMQMessagePtr& msg, int) { LOG(info) << "Received data, processing..."; diff --git a/examples/1-n-1/sampler.cxx b/examples/1-n-1/sampler.cxx index 302ce0b3..4235047d 100644 --- a/examples/1-n-1/sampler.cxx +++ b/examples/1-n-1/sampler.cxx @@ -15,16 +15,8 @@ namespace bpo = boost::program_options; -class Sampler : public FairMQDevice +struct Sampler : fair::mq::Device { - public: - Sampler() = default; - - protected: - std::string fText; - uint64_t fMaxIterations = 0; - uint64_t fNumIterations = 0; - void InitTask() override { // Get the fText and fMaxIterations values from the command line options (via fConfig) @@ -53,6 +45,11 @@ class Sampler : public FairMQDevice return true; } + + private: + std::string fText; + uint64_t fMaxIterations = 0; + uint64_t fNumIterations = 0; }; void addCustomOptions(bpo::options_description& options) diff --git a/examples/1-n-1/sink.cxx b/examples/1-n-1/sink.cxx index f2102e95..2d2cb4cd 100644 --- a/examples/1-n-1/sink.cxx +++ b/examples/1-n-1/sink.cxx @@ -13,17 +13,15 @@ namespace bpo = boost::program_options; -class Sink : public FairMQDevice +struct Sink : fair::mq::Device { - public: Sink() { // register a handler for data arriving on "data2" channel OnData("data2", &Sink::HandleData); } - protected: - virtual void InitTask() override + void InitTask() override { // Get the fMaxIterations value from the command line options (via fConfig) fMaxIterations = fConfig->GetProperty("max-iterations"); diff --git a/examples/copypush/sampler.cxx b/examples/copypush/sampler.cxx index b4694402..345b98ae 100644 --- a/examples/copypush/sampler.cxx +++ b/examples/copypush/sampler.cxx @@ -15,12 +15,8 @@ namespace bpo = boost::program_options; -class Sampler : public FairMQDevice +struct Sampler : fair::mq::Device { - public: - Sampler() = default; - - protected: void InitTask() override { fNumDataChannels = fChannels.at("data").size(); @@ -50,7 +46,7 @@ class Sampler : public FairMQDevice return true; } - + private: int fNumDataChannels = 0; uint64_t fCounter = 0; uint64_t fMaxIterations = 0; diff --git a/examples/copypush/sink.cxx b/examples/copypush/sink.cxx index 652cb027..548c6375 100644 --- a/examples/copypush/sink.cxx +++ b/examples/copypush/sink.cxx @@ -13,9 +13,8 @@ namespace bpo = boost::program_options; -class Sink : public FairMQDevice +struct Sink : fair::mq::Device { - public: Sink() { OnData("data", &Sink::HandleData); diff --git a/examples/dds/processor.cxx b/examples/dds/processor.cxx index 39aedbdb..0703fd7d 100644 --- a/examples/dds/processor.cxx +++ b/examples/dds/processor.cxx @@ -13,15 +13,13 @@ namespace bpo = boost::program_options; -class Processor : public FairMQDevice +struct Processor : fair::mq::Device { - public: Processor() { OnData("data1", &Processor::HandleData); } - protected: bool HandleData(FairMQMessagePtr& msg, int) { LOG(info) << "Received data, processing..."; diff --git a/examples/dds/sampler.cxx b/examples/dds/sampler.cxx index ed5673c7..f468ff6a 100644 --- a/examples/dds/sampler.cxx +++ b/examples/dds/sampler.cxx @@ -13,17 +13,13 @@ namespace bpo = boost::program_options; -class Sampler : public FairMQDevice +struct Sampler : fair::mq::Device { - public: - Sampler() = default; - void InitTask() override { fIterations = fConfig->GetValue("iterations"); } - protected: bool ConditionalRun() override { // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). diff --git a/examples/dds/sink.cxx b/examples/dds/sink.cxx index 8583aa84..29f938fa 100644 --- a/examples/dds/sink.cxx +++ b/examples/dds/sink.cxx @@ -13,9 +13,8 @@ namespace bpo = boost::program_options; -class Sink : public FairMQDevice +struct Sink : fair::mq::Device { - public: Sink() { OnData("data2", &Sink::HandleData); @@ -26,7 +25,6 @@ class Sink : public FairMQDevice fIterations = fConfig->GetValue("iterations"); } - protected: bool HandleData(FairMQMessagePtr& msg, int) { LOG(info) << "Received: \"" << std::string(static_cast(msg->GetData()), msg->GetSize()) << "\""; diff --git a/examples/multipart/sampler.cxx b/examples/multipart/sampler.cxx index a8bf9bb5..307b48ea 100644 --- a/examples/multipart/sampler.cxx +++ b/examples/multipart/sampler.cxx @@ -17,12 +17,8 @@ namespace bpo = boost::program_options; -class Sampler : public FairMQDevice +struct Sampler : fair::mq::Device { - public: - Sampler() = default; - - protected: void InitTask() override { fMaxIterations = fConfig->GetProperty("max-iterations"); diff --git a/examples/multipart/sink.cxx b/examples/multipart/sink.cxx index f93620f1..0fd2a1bd 100644 --- a/examples/multipart/sink.cxx +++ b/examples/multipart/sink.cxx @@ -13,15 +13,13 @@ namespace bpo = boost::program_options; -class Sink : public FairMQDevice +struct Sink : fair::mq::Device { - public: Sink() { OnData("data", &Sink::HandleData); } - protected: bool HandleData(FairMQParts& parts, int) { LOG(info) << "Received message with " << parts.Size() << " parts"; diff --git a/examples/multiple-channels/broadcaster.cxx b/examples/multiple-channels/broadcaster.cxx index 6ee90753..70ebae33 100644 --- a/examples/multiple-channels/broadcaster.cxx +++ b/examples/multiple-channels/broadcaster.cxx @@ -14,12 +14,8 @@ namespace bpo = boost::program_options; -class Broadcaster : public FairMQDevice +struct Broadcaster : fair::mq::Device { - public: - Broadcaster() = default; - - protected: bool ConditionalRun() override { std::this_thread::sleep_for(std::chrono::seconds(1)); diff --git a/examples/multiple-channels/sampler.cxx b/examples/multiple-channels/sampler.cxx index 5279e9c9..07120e03 100644 --- a/examples/multiple-channels/sampler.cxx +++ b/examples/multiple-channels/sampler.cxx @@ -16,11 +16,8 @@ namespace bpo = boost::program_options; -class Sampler : public FairMQDevice +struct Sampler : fair::mq::Device { - public: - Sampler() = default; - void InitTask() override { fText = fConfig->GetProperty("text"); @@ -59,7 +56,7 @@ class Sampler : public FairMQDevice } } - protected: + private: std::string fText; uint64_t fMaxIterations = 0; uint64_t fNumIterations = 0; diff --git a/examples/multiple-channels/sink.cxx b/examples/multiple-channels/sink.cxx index c8914259..60724e49 100644 --- a/examples/multiple-channels/sink.cxx +++ b/examples/multiple-channels/sink.cxx @@ -14,9 +14,8 @@ namespace bpo = boost::program_options; -class Sink : public FairMQDevice +struct Sink : fair::mq::Device { - public: Sink() { OnData("broadcast", &Sink::HandleBroadcast); diff --git a/examples/multiple-transports/sampler1.cxx b/examples/multiple-transports/sampler1.cxx index 329dfbd8..dc61eddd 100644 --- a/examples/multiple-transports/sampler1.cxx +++ b/examples/multiple-transports/sampler1.cxx @@ -13,12 +13,8 @@ namespace bpo = boost::program_options; -class Sampler1 : public FairMQDevice +struct Sampler1 : fair::mq::Device { - public: - Sampler1() = default; - - protected: void InitTask() override { fMaxIterations = fConfig->GetProperty("max-iterations"); @@ -68,6 +64,7 @@ class Sampler1 : public FairMQDevice LOG(info) << "Acknowledged " << numAcks << " messages"; } + private: std::thread fAckListener; uint64_t fMaxIterations = 0; uint64_t fNumIterations = 0; diff --git a/examples/multiple-transports/sampler2.cxx b/examples/multiple-transports/sampler2.cxx index eda9e03b..d8c3c638 100644 --- a/examples/multiple-transports/sampler2.cxx +++ b/examples/multiple-transports/sampler2.cxx @@ -13,12 +13,8 @@ namespace bpo = boost::program_options; -class Sampler2 : public FairMQDevice +struct Sampler2 : fair::mq::Device { - public: - Sampler2() = default; - - protected: void InitTask() override { fMaxIterations = fConfig->GetProperty("max-iterations"); @@ -42,7 +38,6 @@ class Sampler2 : public FairMQDevice return true; } - private: uint64_t fMaxIterations = 0; uint64_t fNumIterations = 0; diff --git a/examples/multiple-transports/sink.cxx b/examples/multiple-transports/sink.cxx index 4773d758..de6f7519 100644 --- a/examples/multiple-transports/sink.cxx +++ b/examples/multiple-transports/sink.cxx @@ -11,9 +11,8 @@ namespace bpo = boost::program_options; -class Sink : public FairMQDevice +struct Sink : fair::mq::Device { - public: Sink() { // register a handler for data arriving on "data" channel @@ -21,7 +20,6 @@ class Sink : public FairMQDevice OnData("data2", &Sink::HandleData2); } - protected: void InitTask() override { fMaxIterations = fConfig->GetProperty("max-iterations"); diff --git a/examples/n-m/receiver.cxx b/examples/n-m/receiver.cxx index 4700a429..a52956bd 100644 --- a/examples/n-m/receiver.cxx +++ b/examples/n-m/receiver.cxx @@ -29,16 +29,13 @@ struct TFBuffer chrono::steady_clock::time_point end; }; -class Receiver : public FairMQDevice +struct Receiver : fair::mq::Device { - public: Receiver() { OnData("data", &Receiver::HandleData); } - ~Receiver() = default; - void InitTask() override { fNumSenders = GetConfig()->GetValue("num-senders"); @@ -46,7 +43,6 @@ class Receiver : public FairMQDevice fMaxTimeframes = GetConfig()->GetValue("max-timeframes"); } - protected: bool HandleData(FairMQParts& parts, int /* index */) { Header& h = *(static_cast(parts.At(0)->GetData())); @@ -93,6 +89,7 @@ class Receiver : public FairMQDevice } } + private: unordered_map fBuffer; unordered_set fDiscardedSet; diff --git a/examples/n-m/sender.cxx b/examples/n-m/sender.cxx index e8442fc8..9320a848 100644 --- a/examples/n-m/sender.cxx +++ b/examples/n-m/sender.cxx @@ -17,11 +17,8 @@ using namespace std; using namespace example_n_m; namespace bpo = boost::program_options; -class Sender : public FairMQDevice +struct Sender : fair::mq::Device { - public: - Sender() = default; - void InitTask() override { fIndex = GetConfig()->GetProperty("sender-index"); diff --git a/examples/n-m/synchronizer.cxx b/examples/n-m/synchronizer.cxx index 57cc05e0..c9ea52ba 100644 --- a/examples/n-m/synchronizer.cxx +++ b/examples/n-m/synchronizer.cxx @@ -15,11 +15,8 @@ using namespace std; namespace bpo = boost::program_options; -class Synchronizer : public FairMQDevice +struct Synchronizer : fair::mq::Device { - public: - Synchronizer() = default; - bool ConditionalRun() override { FairMQMessagePtr msg(NewSimpleMessage(fTimeframeId)); @@ -35,6 +32,7 @@ class Synchronizer : public FairMQDevice return true; } + private: uint16_t fTimeframeId = 0; }; diff --git a/examples/qc/qCDispatcher.cxx b/examples/qc/qCDispatcher.cxx index 56b9956c..d2de4bed 100644 --- a/examples/qc/qCDispatcher.cxx +++ b/examples/qc/qCDispatcher.cxx @@ -9,9 +9,8 @@ #include #include -class QCDispatcher : public FairMQDevice +struct QCDispatcher : fair::mq::Device { - public: QCDispatcher() : fDoQC(false) { @@ -31,7 +30,6 @@ class QCDispatcher : public FairMQDevice }); } - protected: bool HandleData(FairMQMessagePtr& msg, int) { if (fDoQC.load() == true) { diff --git a/examples/qc/sampler.cxx b/examples/qc/sampler.cxx index 306c0a26..bbf72588 100644 --- a/examples/qc/sampler.cxx +++ b/examples/qc/sampler.cxx @@ -12,13 +12,9 @@ #include // this_thread::sleep_for #include -class Sampler : public FairMQDevice +struct Sampler : fair::mq::Device { - public: - Sampler() = default; - - protected: - virtual bool ConditionalRun() + bool ConditionalRun() override { FairMQMessagePtr msg(NewMessage(1000)); diff --git a/examples/qc/sink.cxx b/examples/qc/sink.cxx index ece5a35f..4b342dc5 100644 --- a/examples/qc/sink.cxx +++ b/examples/qc/sink.cxx @@ -11,12 +11,9 @@ #include -class Sink : public FairMQDevice +struct Sink : fair::mq::Device { - public: Sink() { OnData("data2", &Sink::HandleData); } - - protected: bool HandleData(FairMQMessagePtr& /*msg*/, int /*index*/) { return true; } }; diff --git a/examples/readout/processor.cxx b/examples/readout/processor.cxx index 95889ec6..345418f3 100644 --- a/examples/readout/processor.cxx +++ b/examples/readout/processor.cxx @@ -11,15 +11,13 @@ namespace bpo = boost::program_options; -class Processor : public FairMQDevice +struct Processor : fair::mq::Device { - public: Processor() { OnData("bp", &Processor::HandleData); } - protected: bool HandleData(FairMQMessagePtr& msg, int /*index*/) { FairMQMessagePtr msg2(NewMessageFor("ps", 0, msg->GetSize())); diff --git a/examples/readout/readout.cxx b/examples/readout/readout.cxx index 24a400e0..fb2bfc86 100644 --- a/examples/readout/readout.cxx +++ b/examples/readout/readout.cxx @@ -15,11 +15,8 @@ namespace bpo = boost::program_options; -class Readout : public FairMQDevice +struct Readout : fair::mq::Device { - public: - Readout() = default; - void InitTask() override { fMsgSize = fConfig->GetProperty("msg-size"); diff --git a/examples/readout/receiver.cxx b/examples/readout/receiver.cxx index 872e1fa8..8a82f3f2 100644 --- a/examples/readout/receiver.cxx +++ b/examples/readout/receiver.cxx @@ -11,11 +11,8 @@ namespace bpo = boost::program_options; -class Receiver : public FairMQDevice +struct Receiver : fair::mq::Device { - public: - Receiver() = default; - void InitTask() override { // Get the fMaxIterations value from the command line options (via fConfig) diff --git a/examples/readout/sender.cxx b/examples/readout/sender.cxx index 0d9d0bcd..3faa7823 100644 --- a/examples/readout/sender.cxx +++ b/examples/readout/sender.cxx @@ -13,11 +13,8 @@ namespace bpo = boost::program_options; -class Sender : public FairMQDevice +struct Sender : fair::mq::Device { - public: - Sender() = default; - void Init() override { fInputChannelName = fConfig->GetProperty("input-name"); diff --git a/examples/region/sampler.cxx b/examples/region/sampler.cxx index 458193bb..98e9fbab 100644 --- a/examples/region/sampler.cxx +++ b/examples/region/sampler.cxx @@ -15,11 +15,8 @@ namespace bpo = boost::program_options; -class Sampler : public FairMQDevice +struct Sampler : fair::mq::Device { - public: - Sampler() = default; - void InitTask() override { fMsgSize = fConfig->GetProperty("msg-size"); diff --git a/examples/region/sink.cxx b/examples/region/sink.cxx index f60fefb5..ee942930 100644 --- a/examples/region/sink.cxx +++ b/examples/region/sink.cxx @@ -11,11 +11,8 @@ namespace bpo = boost::program_options; -class Sink : public FairMQDevice +struct Sink : fair::mq::Device { - public: - Sink() = default; - void InitTask() override { // Get the fMaxIterations value from the command line options (via fConfig) diff --git a/examples/req-rep/client.cxx b/examples/req-rep/client.cxx index 59418596..4eee300f 100644 --- a/examples/req-rep/client.cxx +++ b/examples/req-rep/client.cxx @@ -15,11 +15,8 @@ namespace bpo = boost::program_options; -class Client : public FairMQDevice +struct Client : fair::mq::Device { - public: - Client() = default; - void InitTask() override { fText = fConfig->GetProperty("text"); diff --git a/examples/req-rep/server.cxx b/examples/req-rep/server.cxx index 44c37f80..f05d98b6 100644 --- a/examples/req-rep/server.cxx +++ b/examples/req-rep/server.cxx @@ -13,9 +13,8 @@ namespace bpo = boost::program_options; -class Server : public FairMQDevice +struct Server : fair::mq::Device { - public: Server() { OnData("data", &Server::HandleData); diff --git a/fairmq/devices/BenchmarkSampler.h b/fairmq/devices/BenchmarkSampler.h index aa911ffd..a25209ec 100644 --- a/fairmq/devices/BenchmarkSampler.h +++ b/fairmq/devices/BenchmarkSampler.h @@ -29,8 +29,6 @@ namespace fair::mq class BenchmarkSampler : public Device { public: - BenchmarkSampler() = default; - void InitTask() override { fMultipart = fConfig->GetProperty("multipart"); diff --git a/fairmq/devices/Merger.h b/fairmq/devices/Merger.h index 0c450c6d..53ab4313 100644 --- a/fairmq/devices/Merger.h +++ b/fairmq/devices/Merger.h @@ -21,16 +21,10 @@ namespace fair::mq class Merger : public Device { - public: - Merger() - : fInChannelName("data-in") - , fOutChannelName("data-out") - {} - protected: bool fMultipart = true; - std::string fInChannelName; - std::string fOutChannelName; + std::string fInChannelName{"data-in"}; + std::string fOutChannelName{"data-out"}; void InitTask() override { diff --git a/fairmq/devices/Multiplier.h b/fairmq/devices/Multiplier.h index fbd7c146..e4013287 100644 --- a/fairmq/devices/Multiplier.h +++ b/fairmq/devices/Multiplier.h @@ -19,9 +19,6 @@ namespace fair::mq class Multiplier : public Device { - public: - Multiplier() = default; - protected: bool fMultipart = true; int fNumOutputs = 0; diff --git a/fairmq/devices/Proxy.h b/fairmq/devices/Proxy.h index e414d18a..0c89189b 100644 --- a/fairmq/devices/Proxy.h +++ b/fairmq/devices/Proxy.h @@ -18,9 +18,6 @@ namespace fair::mq class Proxy : public Device { - public: - Proxy() = default; - protected: bool fMultipart = true; std::string fInChannelName; diff --git a/fairmq/devices/Sink.h b/fairmq/devices/Sink.h index 8d60d6cf..0b6a6b36 100644 --- a/fairmq/devices/Sink.h +++ b/fairmq/devices/Sink.h @@ -24,9 +24,6 @@ namespace fair::mq class Sink : public Device { - public: - Sink() = default; - protected: bool fMultipart = false; uint64_t fMaxIterations = 0; diff --git a/fairmq/devices/Splitter.h b/fairmq/devices/Splitter.h index 005e378f..2bc4f7c8 100644 --- a/fairmq/devices/Splitter.h +++ b/fairmq/devices/Splitter.h @@ -18,9 +18,6 @@ namespace fair::mq class Splitter : public Device { - public: - Splitter() = default; - protected: bool fMultipart = true; int fNumOutputs = 0;