Remove useless code

This commit is contained in:
Alexey Rybalchenko 2021-05-28 12:44:27 +02:00 committed by Dennis Klein
parent 882edbbdb8
commit 3c4158addb
38 changed files with 51 additions and 158 deletions

View File

@ -13,16 +13,8 @@
namespace bpo = boost::program_options; 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 void InitTask() override
{ {
// Get the fText and fMaxIterations values from the command line options (via fConfig) // Get the fText and fMaxIterations values from the command line options (via fConfig)
@ -57,6 +49,11 @@ class Sampler : public FairMQDevice
return true; return true;
} }
private:
std::string fText;
uint64_t fMaxIterations = 0;
uint64_t fNumIterations = 0;
}; };
void addCustomOptions(bpo::options_description& options) void addCustomOptions(bpo::options_description& options)

View File

@ -13,16 +13,14 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sink : public FairMQDevice struct Sink : fair::mq::Device
{ {
public:
Sink() Sink()
{ {
// register a handler for data arriving on "data" channel // register a handler for data arriving on "data" channel
OnData("data", &Sink::HandleData); OnData("data", &Sink::HandleData);
} }
protected:
void InitTask() override void InitTask() override
{ {
// Get the fMaxIterations value from the command line options (via fConfig) // Get the fMaxIterations value from the command line options (via fConfig)

View File

@ -13,15 +13,13 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Processor : public FairMQDevice struct Processor : fair::mq::Device
{ {
public:
Processor() Processor()
{ {
OnData("data1", &Processor::HandleData); OnData("data1", &Processor::HandleData);
} }
protected:
bool HandleData(FairMQMessagePtr& msg, int) bool HandleData(FairMQMessagePtr& msg, int)
{ {
LOG(info) << "Received data, processing..."; LOG(info) << "Received data, processing...";

View File

@ -15,16 +15,8 @@
namespace bpo = boost::program_options; 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 void InitTask() override
{ {
// Get the fText and fMaxIterations values from the command line options (via fConfig) // Get the fText and fMaxIterations values from the command line options (via fConfig)
@ -53,6 +45,11 @@ class Sampler : public FairMQDevice
return true; return true;
} }
private:
std::string fText;
uint64_t fMaxIterations = 0;
uint64_t fNumIterations = 0;
}; };
void addCustomOptions(bpo::options_description& options) void addCustomOptions(bpo::options_description& options)

View File

@ -13,17 +13,15 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sink : public FairMQDevice struct Sink : fair::mq::Device
{ {
public:
Sink() Sink()
{ {
// register a handler for data arriving on "data2" channel // register a handler for data arriving on "data2" channel
OnData("data2", &Sink::HandleData); OnData("data2", &Sink::HandleData);
} }
protected: void InitTask() override
virtual void InitTask() override
{ {
// Get the fMaxIterations value from the command line options (via fConfig) // Get the fMaxIterations value from the command line options (via fConfig)
fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations"); fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations");

View File

@ -15,12 +15,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sampler : public FairMQDevice struct Sampler : fair::mq::Device
{ {
public:
Sampler() = default;
protected:
void InitTask() override void InitTask() override
{ {
fNumDataChannels = fChannels.at("data").size(); fNumDataChannels = fChannels.at("data").size();
@ -50,7 +46,7 @@ class Sampler : public FairMQDevice
return true; return true;
} }
private:
int fNumDataChannels = 0; int fNumDataChannels = 0;
uint64_t fCounter = 0; uint64_t fCounter = 0;
uint64_t fMaxIterations = 0; uint64_t fMaxIterations = 0;

View File

@ -13,9 +13,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sink : public FairMQDevice struct Sink : fair::mq::Device
{ {
public:
Sink() Sink()
{ {
OnData("data", &Sink::HandleData); OnData("data", &Sink::HandleData);

View File

@ -13,15 +13,13 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Processor : public FairMQDevice struct Processor : fair::mq::Device
{ {
public:
Processor() Processor()
{ {
OnData("data1", &Processor::HandleData); OnData("data1", &Processor::HandleData);
} }
protected:
bool HandleData(FairMQMessagePtr& msg, int) bool HandleData(FairMQMessagePtr& msg, int)
{ {
LOG(info) << "Received data, processing..."; LOG(info) << "Received data, processing...";

View File

@ -13,17 +13,13 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sampler : public FairMQDevice struct Sampler : fair::mq::Device
{ {
public:
Sampler() = default;
void InitTask() override void InitTask() override
{ {
fIterations = fConfig->GetValue<uint64_t>("iterations"); fIterations = fConfig->GetValue<uint64_t>("iterations");
} }
protected:
bool ConditionalRun() override bool ConditionalRun() override
{ {
// NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place).

View File

@ -13,9 +13,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sink : public FairMQDevice struct Sink : fair::mq::Device
{ {
public:
Sink() Sink()
{ {
OnData("data2", &Sink::HandleData); OnData("data2", &Sink::HandleData);
@ -26,7 +25,6 @@ class Sink : public FairMQDevice
fIterations = fConfig->GetValue<uint64_t>("iterations"); fIterations = fConfig->GetValue<uint64_t>("iterations");
} }
protected:
bool HandleData(FairMQMessagePtr& msg, int) bool HandleData(FairMQMessagePtr& msg, int)
{ {
LOG(info) << "Received: \"" << std::string(static_cast<char*>(msg->GetData()), msg->GetSize()) << "\""; LOG(info) << "Received: \"" << std::string(static_cast<char*>(msg->GetData()), msg->GetSize()) << "\"";

View File

@ -17,12 +17,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sampler : public FairMQDevice struct Sampler : fair::mq::Device
{ {
public:
Sampler() = default;
protected:
void InitTask() override void InitTask() override
{ {
fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations"); fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations");

View File

@ -13,15 +13,13 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sink : public FairMQDevice struct Sink : fair::mq::Device
{ {
public:
Sink() Sink()
{ {
OnData("data", &Sink::HandleData); OnData("data", &Sink::HandleData);
} }
protected:
bool HandleData(FairMQParts& parts, int) bool HandleData(FairMQParts& parts, int)
{ {
LOG(info) << "Received message with " << parts.Size() << " parts"; LOG(info) << "Received message with " << parts.Size() << " parts";

View File

@ -14,12 +14,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Broadcaster : public FairMQDevice struct Broadcaster : fair::mq::Device
{ {
public:
Broadcaster() = default;
protected:
bool ConditionalRun() override bool ConditionalRun() override
{ {
std::this_thread::sleep_for(std::chrono::seconds(1)); std::this_thread::sleep_for(std::chrono::seconds(1));

View File

@ -16,11 +16,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sampler : public FairMQDevice struct Sampler : fair::mq::Device
{ {
public:
Sampler() = default;
void InitTask() override void InitTask() override
{ {
fText = fConfig->GetProperty<std::string>("text"); fText = fConfig->GetProperty<std::string>("text");
@ -59,7 +56,7 @@ class Sampler : public FairMQDevice
} }
} }
protected: private:
std::string fText; std::string fText;
uint64_t fMaxIterations = 0; uint64_t fMaxIterations = 0;
uint64_t fNumIterations = 0; uint64_t fNumIterations = 0;

View File

@ -14,9 +14,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sink : public FairMQDevice struct Sink : fair::mq::Device
{ {
public:
Sink() Sink()
{ {
OnData("broadcast", &Sink::HandleBroadcast); OnData("broadcast", &Sink::HandleBroadcast);

View File

@ -13,12 +13,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sampler1 : public FairMQDevice struct Sampler1 : fair::mq::Device
{ {
public:
Sampler1() = default;
protected:
void InitTask() override void InitTask() override
{ {
fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations"); fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations");
@ -68,6 +64,7 @@ class Sampler1 : public FairMQDevice
LOG(info) << "Acknowledged " << numAcks << " messages"; LOG(info) << "Acknowledged " << numAcks << " messages";
} }
private:
std::thread fAckListener; std::thread fAckListener;
uint64_t fMaxIterations = 0; uint64_t fMaxIterations = 0;
uint64_t fNumIterations = 0; uint64_t fNumIterations = 0;

View File

@ -13,12 +13,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sampler2 : public FairMQDevice struct Sampler2 : fair::mq::Device
{ {
public:
Sampler2() = default;
protected:
void InitTask() override void InitTask() override
{ {
fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations"); fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations");
@ -42,7 +38,6 @@ class Sampler2 : public FairMQDevice
return true; return true;
} }
private: private:
uint64_t fMaxIterations = 0; uint64_t fMaxIterations = 0;
uint64_t fNumIterations = 0; uint64_t fNumIterations = 0;

View File

@ -11,9 +11,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sink : public FairMQDevice struct Sink : fair::mq::Device
{ {
public:
Sink() Sink()
{ {
// register a handler for data arriving on "data" channel // register a handler for data arriving on "data" channel
@ -21,7 +20,6 @@ class Sink : public FairMQDevice
OnData("data2", &Sink::HandleData2); OnData("data2", &Sink::HandleData2);
} }
protected:
void InitTask() override void InitTask() override
{ {
fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations"); fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations");

View File

@ -29,16 +29,13 @@ struct TFBuffer
chrono::steady_clock::time_point end; chrono::steady_clock::time_point end;
}; };
class Receiver : public FairMQDevice struct Receiver : fair::mq::Device
{ {
public:
Receiver() Receiver()
{ {
OnData("data", &Receiver::HandleData); OnData("data", &Receiver::HandleData);
} }
~Receiver() = default;
void InitTask() override void InitTask() override
{ {
fNumSenders = GetConfig()->GetValue<int>("num-senders"); fNumSenders = GetConfig()->GetValue<int>("num-senders");
@ -46,7 +43,6 @@ class Receiver : public FairMQDevice
fMaxTimeframes = GetConfig()->GetValue<int>("max-timeframes"); fMaxTimeframes = GetConfig()->GetValue<int>("max-timeframes");
} }
protected:
bool HandleData(FairMQParts& parts, int /* index */) bool HandleData(FairMQParts& parts, int /* index */)
{ {
Header& h = *(static_cast<Header*>(parts.At(0)->GetData())); Header& h = *(static_cast<Header*>(parts.At(0)->GetData()));
@ -93,6 +89,7 @@ class Receiver : public FairMQDevice
} }
} }
private:
unordered_map<uint16_t, TFBuffer> fBuffer; unordered_map<uint16_t, TFBuffer> fBuffer;
unordered_set<uint16_t> fDiscardedSet; unordered_set<uint16_t> fDiscardedSet;

View File

@ -17,11 +17,8 @@ using namespace std;
using namespace example_n_m; using namespace example_n_m;
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sender : public FairMQDevice struct Sender : fair::mq::Device
{ {
public:
Sender() = default;
void InitTask() override void InitTask() override
{ {
fIndex = GetConfig()->GetProperty<int>("sender-index"); fIndex = GetConfig()->GetProperty<int>("sender-index");

View File

@ -15,11 +15,8 @@
using namespace std; using namespace std;
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Synchronizer : public FairMQDevice struct Synchronizer : fair::mq::Device
{ {
public:
Synchronizer() = default;
bool ConditionalRun() override bool ConditionalRun() override
{ {
FairMQMessagePtr msg(NewSimpleMessage(fTimeframeId)); FairMQMessagePtr msg(NewSimpleMessage(fTimeframeId));
@ -35,6 +32,7 @@ class Synchronizer : public FairMQDevice
return true; return true;
} }
private:
uint16_t fTimeframeId = 0; uint16_t fTimeframeId = 0;
}; };

View File

@ -9,9 +9,8 @@
#include <fairmq/Device.h> #include <fairmq/Device.h>
#include <fairmq/runDevice.h> #include <fairmq/runDevice.h>
class QCDispatcher : public FairMQDevice struct QCDispatcher : fair::mq::Device
{ {
public:
QCDispatcher() QCDispatcher()
: fDoQC(false) : fDoQC(false)
{ {
@ -31,7 +30,6 @@ class QCDispatcher : public FairMQDevice
}); });
} }
protected:
bool HandleData(FairMQMessagePtr& msg, int) bool HandleData(FairMQMessagePtr& msg, int)
{ {
if (fDoQC.load() == true) { if (fDoQC.load() == true) {

View File

@ -12,13 +12,9 @@
#include <thread> // this_thread::sleep_for #include <thread> // this_thread::sleep_for
#include <chrono> #include <chrono>
class Sampler : public FairMQDevice struct Sampler : fair::mq::Device
{ {
public: bool ConditionalRun() override
Sampler() = default;
protected:
virtual bool ConditionalRun()
{ {
FairMQMessagePtr msg(NewMessage(1000)); FairMQMessagePtr msg(NewMessage(1000));

View File

@ -11,12 +11,9 @@
#include <string> #include <string>
class Sink : public FairMQDevice struct Sink : fair::mq::Device
{ {
public:
Sink() { OnData("data2", &Sink::HandleData); } Sink() { OnData("data2", &Sink::HandleData); }
protected:
bool HandleData(FairMQMessagePtr& /*msg*/, int /*index*/) { return true; } bool HandleData(FairMQMessagePtr& /*msg*/, int /*index*/) { return true; }
}; };

View File

@ -11,15 +11,13 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Processor : public FairMQDevice struct Processor : fair::mq::Device
{ {
public:
Processor() Processor()
{ {
OnData("bp", &Processor::HandleData); OnData("bp", &Processor::HandleData);
} }
protected:
bool HandleData(FairMQMessagePtr& msg, int /*index*/) bool HandleData(FairMQMessagePtr& msg, int /*index*/)
{ {
FairMQMessagePtr msg2(NewMessageFor("ps", 0, msg->GetSize())); FairMQMessagePtr msg2(NewMessageFor("ps", 0, msg->GetSize()));

View File

@ -15,11 +15,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Readout : public FairMQDevice struct Readout : fair::mq::Device
{ {
public:
Readout() = default;
void InitTask() override void InitTask() override
{ {
fMsgSize = fConfig->GetProperty<int>("msg-size"); fMsgSize = fConfig->GetProperty<int>("msg-size");

View File

@ -11,11 +11,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Receiver : public FairMQDevice struct Receiver : fair::mq::Device
{ {
public:
Receiver() = default;
void InitTask() override void InitTask() override
{ {
// Get the fMaxIterations value from the command line options (via fConfig) // Get the fMaxIterations value from the command line options (via fConfig)

View File

@ -13,11 +13,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sender : public FairMQDevice struct Sender : fair::mq::Device
{ {
public:
Sender() = default;
void Init() override void Init() override
{ {
fInputChannelName = fConfig->GetProperty<std::string>("input-name"); fInputChannelName = fConfig->GetProperty<std::string>("input-name");

View File

@ -15,11 +15,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sampler : public FairMQDevice struct Sampler : fair::mq::Device
{ {
public:
Sampler() = default;
void InitTask() override void InitTask() override
{ {
fMsgSize = fConfig->GetProperty<int>("msg-size"); fMsgSize = fConfig->GetProperty<int>("msg-size");

View File

@ -11,11 +11,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Sink : public FairMQDevice struct Sink : fair::mq::Device
{ {
public:
Sink() = default;
void InitTask() override void InitTask() override
{ {
// Get the fMaxIterations value from the command line options (via fConfig) // Get the fMaxIterations value from the command line options (via fConfig)

View File

@ -15,11 +15,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Client : public FairMQDevice struct Client : fair::mq::Device
{ {
public:
Client() = default;
void InitTask() override void InitTask() override
{ {
fText = fConfig->GetProperty<std::string>("text"); fText = fConfig->GetProperty<std::string>("text");

View File

@ -13,9 +13,8 @@
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
class Server : public FairMQDevice struct Server : fair::mq::Device
{ {
public:
Server() Server()
{ {
OnData("data", &Server::HandleData); OnData("data", &Server::HandleData);

View File

@ -29,8 +29,6 @@ namespace fair::mq
class BenchmarkSampler : public Device class BenchmarkSampler : public Device
{ {
public: public:
BenchmarkSampler() = default;
void InitTask() override void InitTask() override
{ {
fMultipart = fConfig->GetProperty<bool>("multipart"); fMultipart = fConfig->GetProperty<bool>("multipart");

View File

@ -21,16 +21,10 @@ namespace fair::mq
class Merger : public Device class Merger : public Device
{ {
public:
Merger()
: fInChannelName("data-in")
, fOutChannelName("data-out")
{}
protected: protected:
bool fMultipart = true; bool fMultipart = true;
std::string fInChannelName; std::string fInChannelName{"data-in"};
std::string fOutChannelName; std::string fOutChannelName{"data-out"};
void InitTask() override void InitTask() override
{ {

View File

@ -19,9 +19,6 @@ namespace fair::mq
class Multiplier : public Device class Multiplier : public Device
{ {
public:
Multiplier() = default;
protected: protected:
bool fMultipart = true; bool fMultipart = true;
int fNumOutputs = 0; int fNumOutputs = 0;

View File

@ -18,9 +18,6 @@ namespace fair::mq
class Proxy : public Device class Proxy : public Device
{ {
public:
Proxy() = default;
protected: protected:
bool fMultipart = true; bool fMultipart = true;
std::string fInChannelName; std::string fInChannelName;

View File

@ -24,9 +24,6 @@ namespace fair::mq
class Sink : public Device class Sink : public Device
{ {
public:
Sink() = default;
protected: protected:
bool fMultipart = false; bool fMultipart = false;
uint64_t fMaxIterations = 0; uint64_t fMaxIterations = 0;

View File

@ -18,9 +18,6 @@ namespace fair::mq
class Splitter : public Device class Splitter : public Device
{ {
public:
Splitter() = default;
protected: protected:
bool fMultipart = true; bool fMultipart = true;
int fNumOutputs = 0; int fNumOutputs = 0;