Apply readability-redundant-member-init

This commit is contained in:
Alexey Rybalchenko 2021-05-26 22:39:19 +02:00 committed by Dennis Klein
parent acf63d3c1b
commit 9444de5868
17 changed files with 19 additions and 75 deletions

View File

@ -16,9 +16,7 @@ namespace bpo = boost::program_options;
class Builder : public FairMQDevice class Builder : public FairMQDevice
{ {
public: public:
Builder() Builder() {}
: fOutputChannelName()
{}
void Init() override void Init() override
{ {

View File

@ -21,11 +21,9 @@ using namespace fair::mq;
DeviceRunner::DeviceRunner(int argc, char*const* argv, bool printLogo) DeviceRunner::DeviceRunner(int argc, char*const* argv, bool printLogo)
: fRawCmdLineArgs(tools::ToStrVector(argc, argv, false)) : fRawCmdLineArgs(tools::ToStrVector(argc, argv, false))
, fConfig()
, fDevice(nullptr) , fDevice(nullptr)
, fPluginManager(fRawCmdLineArgs) , fPluginManager(fRawCmdLineArgs)
, fPrintLogo(printLogo) , fPrintLogo(printLogo)
, fEvents()
{} {}
bool DeviceRunner::HandleGeneralOptions(const fair::mq::ProgOptions& config, bool printLogo) bool DeviceRunner::HandleGeneralOptions(const fair::mq::ProgOptions& config, bool printLogo)

View File

@ -73,29 +73,16 @@ FairMQDevice::FairMQDevice(ProgOptions& config, const tools::Version version)
FairMQDevice::FairMQDevice(ProgOptions* config, const tools::Version version) FairMQDevice::FairMQDevice(ProgOptions* config, const tools::Version version)
: fTransportFactory(nullptr) : fTransportFactory(nullptr)
, fTransports()
, fChannels()
, fInternalConfig(config ? nullptr : make_unique<ProgOptions>()) , fInternalConfig(config ? nullptr : make_unique<ProgOptions>())
, fConfig(config ? config : fInternalConfig.get()) , fConfig(config ? config : fInternalConfig.get())
, fId(DefaultId) , fId(DefaultId)
, fDefaultTransportType(DefaultTransportType) , fDefaultTransportType(DefaultTransportType)
, fStateMachine()
, fUninitializedBindingChannels()
, fUninitializedConnectingChannels()
, fDataCallbacks(false) , fDataCallbacks(false)
, fMsgInputs()
, fMultipartInputs()
, fMultitransportInputs()
, fChannelRegistry()
, fInputChannelKeys()
, fMultitransportMutex()
, fMultitransportProceed(false) , fMultitransportProceed(false)
, fVersion(version) , fVersion(version)
, fRate(DefaultRate) , fRate(DefaultRate)
, fMaxRunRuntimeInS(DefaultMaxRunTime) , fMaxRunRuntimeInS(DefaultMaxRunTime)
, fInitializationTimeoutInS(DefaultInitTimeout) , fInitializationTimeoutInS(DefaultInitTimeout)
, fRawCmdLineArgs()
, fTransitionMtx()
, fTransitioning(false) , fTransitioning(false)
{ {
SubscribeToNewTransition("device", [&](Transition transition) { SubscribeToNewTransition("device", [&](Transition transition) {

View File

@ -24,7 +24,7 @@ class FairMQParts
public: public:
/// Default constructor /// Default constructor
FairMQParts() : fParts() {}; FairMQParts() {};
/// Copy Constructor /// Copy Constructor
FairMQParts(const FairMQParts&) = delete; FairMQParts(const FairMQParts&) = delete;
/// Move constructor /// Move constructor
@ -33,7 +33,7 @@ class FairMQParts
FairMQParts& operator=(const FairMQParts&) = delete; FairMQParts& operator=(const FairMQParts&) = delete;
/// Constructor from argument pack of std::unique_ptr<FairMQMessage> rvalues /// Constructor from argument pack of std::unique_ptr<FairMQMessage> rvalues
template <typename... Ts> template <typename... Ts>
FairMQParts(Ts&&... messages) : fParts() { AddPart(std::forward<Ts>(messages)...); } FairMQParts(Ts&&... messages) { AddPart(std::forward<Ts>(messages)...); }
/// Default destructor /// Default destructor
~FairMQParts() {}; ~FairMQParts() {};

View File

@ -57,46 +57,44 @@ class FairMQMemoryResource : public pmr::memory_resource
class ChannelResource : public FairMQMemoryResource class ChannelResource : public FairMQMemoryResource
{ {
protected: protected:
FairMQTransportFactory *factory{nullptr}; FairMQTransportFactory* factory{nullptr};
// TODO: for now a map to keep track of allocations, something else would // TODO: for now a map to keep track of allocations, something else would
// probably be // probably be
// faster, but for now this does not need to be fast. // faster, but for now this does not need to be fast.
boost::container::flat_map<void *, FairMQMessagePtr> messageMap; boost::container::flat_map<void*, FairMQMessagePtr> messageMap;
public: public:
ChannelResource() = delete; ChannelResource() = delete;
ChannelResource(FairMQTransportFactory *_factory) ChannelResource(FairMQTransportFactory* _factory)
: FairMQMemoryResource() : factory(_factory)
, factory(_factory)
, messageMap()
{ {
if (!_factory) { if (!_factory) {
throw std::runtime_error("Tried to construct from a nullptr FairMQTransportFactory"); throw std::runtime_error("Tried to construct from a nullptr FairMQTransportFactory");
} }
}; };
FairMQMessagePtr getMessage(void *p) override FairMQMessagePtr getMessage(void* p) override
{ {
auto mes = std::move(messageMap[p]); auto mes = std::move(messageMap[p]);
messageMap.erase(p); messageMap.erase(p);
return mes; return mes;
} }
void *setMessage(FairMQMessagePtr message) override void* setMessage(FairMQMessagePtr message) override
{ {
void *addr = message->GetData(); void* addr = message->GetData();
messageMap[addr] = std::move(message); messageMap[addr] = std::move(message);
return addr; return addr;
} }
FairMQTransportFactory *getTransportFactory() noexcept override { return factory; } FairMQTransportFactory* getTransportFactory() noexcept override { return factory; }
size_t getNumberOfMessages() const noexcept override { return messageMap.size(); } size_t getNumberOfMessages() const noexcept override { return messageMap.size(); }
protected: protected:
void *do_allocate(std::size_t bytes, std::size_t alignment) override; void* do_allocate(std::size_t bytes, std::size_t alignment) override;
void do_deallocate(void *p, std::size_t /*bytes*/, std::size_t /*alignment*/) override void do_deallocate(void* p, std::size_t /*bytes*/, std::size_t /*alignment*/) override
{ {
messageMap.erase(p); messageMap.erase(p);
}; };

View File

@ -31,22 +31,12 @@ const std::string fair::mq::PluginManager::fgkLibPrefix = "FairMQPlugin_";
std::vector<boost::dll::shared_library> fair::mq::PluginManager::fgDLLKeepAlive = std::vector<boost::dll::shared_library>(); std::vector<boost::dll::shared_library> fair::mq::PluginManager::fgDLLKeepAlive = std::vector<boost::dll::shared_library>();
fair::mq::PluginManager::PluginManager() fair::mq::PluginManager::PluginManager()
: fSearchPaths{} : fPluginServices()
, fPluginFactories()
, fPluginServices()
, fPlugins()
, fPluginOrder()
, fPluginProgOptions()
{ {
} }
fair::mq::PluginManager::PluginManager(const vector<string> args) fair::mq::PluginManager::PluginManager(const vector<string> args)
: fSearchPaths{} : fPluginServices()
, fPluginFactories()
, fPluginServices()
, fPlugins()
, fPluginOrder()
, fPluginProgOptions()
{ {
// Parse command line options // Parse command line options
auto options = ProgramOptions(); auto options = ProgramOptions();

View File

@ -43,11 +43,7 @@ class PluginServices
PluginServices(ProgOptions& config, FairMQDevice& device) PluginServices(ProgOptions& config, FairMQDevice& device)
: fConfig(config) : fConfig(config)
, fDevice(device) , fDevice(device)
, fDeviceController() {}
, fDeviceControllerMutex()
, fReleaseDeviceControlCondition()
{
}
~PluginServices() ~PluginServices()
{ {

View File

@ -68,11 +68,7 @@ string ConvertVarValToString(const po::variable_value& v)
} }
ProgOptions::ProgOptions() ProgOptions::ProgOptions()
: fVarMap() : fAllOptions("FairMQ Command Line Options")
, fAllOptions("FairMQ Command Line Options")
, fUnregisteredOptions()
, fEvents()
, fMtx()
{ {
fAllOptions.add_options() fAllOptions.add_options()
("help,h", "Print help") ("help,h", "Print help")

View File

@ -48,9 +48,6 @@ namespace fair::mq::plugins
Control::Control(const string& name, const Plugin::Version version, const string& maintainer, const string& homepage, PluginServices* pluginServices) Control::Control(const string& name, const Plugin::Version version, const string& maintainer, const string& homepage, PluginServices* pluginServices)
: Plugin(name, version, maintainer, homepage, pluginServices) : Plugin(name, version, maintainer, homepage, pluginServices)
, fControllerThread()
, fSignalHandlerThread()
, fControllerMutex()
, fDeviceShutdownRequested(false) , fDeviceShutdownRequested(false)
, fDeviceHasShutdown(false) , fDeviceHasShutdown(false)
, fPluginShutdownRequested(false) , fPluginShutdownRequested(false)

View File

@ -234,8 +234,6 @@ class BasicTopology : public AsioBase<Executor, Allocator>
: AsioBase<Executor, Allocator>(ex, std::move(alloc)) : AsioBase<Executor, Allocator>(ex, std::move(alloc))
, fDDSSession(std::move(session)) , fDDSSession(std::move(session))
, fDDSTopo(std::move(topo)) , fDDSTopo(std::move(topo))
, fStateData()
, fStateIndex()
, fMtx(std::make_unique<std::mutex>()) , fMtx(std::make_unique<std::mutex>())
, fStateChangeSubscriptionsCV(std::make_unique<std::condition_variable>()) , fStateChangeSubscriptionsCV(std::make_unique<std::condition_variable>())
, fNumStateChangePublishers(0) , fNumStateChangePublishers(0)
@ -1174,7 +1172,6 @@ class BasicTopology : public AsioBase<Executor, Allocator>
, fTimer(ex) , fTimer(ex)
, fCount(0) , fCount(0)
, fExpectedCount(expectedCount) , fExpectedCount(expectedCount)
, fFailedDevices()
, fMtx(mutex) , fMtx(mutex)
{ {
if (timeout > std::chrono::milliseconds(0)) { if (timeout > std::chrono::milliseconds(0)) {

View File

@ -63,7 +63,6 @@ class Manager
, fShmId(makeShmIdStr(sessionName)) , fShmId(makeShmIdStr(sessionName))
, fSegmentId(config ? config->GetProperty<uint16_t>("shm-segment-id", 0) : 0) , fSegmentId(config ? config->GetProperty<uint16_t>("shm-segment-id", 0) : 0)
, fDeviceId(std::move(deviceId)) , fDeviceId(std::move(deviceId))
, fSegments()
, fManagementSegment(boost::interprocess::open_or_create, std::string("fmq_" + fShmId + "_mng").c_str(), 6553600) , fManagementSegment(boost::interprocess::open_or_create, std::string("fmq_" + fShmId + "_mng").c_str(), 6553600)
, fShmVoidAlloc(fManagementSegment.get_segment_manager()) , fShmVoidAlloc(fManagementSegment.get_segment_manager())
, fShmMtx(boost::interprocess::open_or_create, std::string("fmq_" + fShmId + "_mtx").c_str()) , fShmMtx(boost::interprocess::open_or_create, std::string("fmq_" + fShmId + "_mtx").c_str())
@ -81,7 +80,6 @@ class Manager
, fMsgCounterNew(0) , fMsgCounterNew(0)
, fMsgCounterDelete(0) , fMsgCounterDelete(0)
#endif #endif
, fHeartbeatThread()
, fSendHeartbeats(true) , fSendHeartbeats(true)
, fThrowOnBadAlloc(config ? config->GetProperty<bool>("shm-throw-bad-alloc", true) : true) , fThrowOnBadAlloc(config ? config->GetProperty<bool>("shm-throw-bad-alloc", true) : true)
, fNoCleanup(config ? config->GetProperty<bool>("shm-no-cleanup", false) : false) , fNoCleanup(config ? config->GetProperty<bool>("shm-no-cleanup", false) : false)

View File

@ -91,8 +91,6 @@ Monitor::Monitor(const string& shmId, bool selfDestruct, bool interactive, bool
, fTerminating(false) , fTerminating(false)
, fHeartbeatTriggered(false) , fHeartbeatTriggered(false)
, fLastHeartbeat(chrono::high_resolution_clock::now()) , fLastHeartbeat(chrono::high_resolution_clock::now())
, fSignalThread()
, fDeviceHeartbeats()
{ {
if (!fViewOnly) { if (!fViewOnly) {
try { try {

View File

@ -30,7 +30,6 @@ class Poller final : public fair::mq::Poller
Poller(const std::vector<FairMQChannel>& channels) Poller(const std::vector<FairMQChannel>& channels)
: fItems() : fItems()
, fNumItems(0) , fNumItems(0)
, fOffsetMap()
{ {
fNumItems = channels.size(); fNumItems = channels.size();
fItems = new zmq_pollitem_t[fNumItems]; fItems = new zmq_pollitem_t[fNumItems];
@ -51,7 +50,6 @@ class Poller final : public fair::mq::Poller
Poller(const std::vector<FairMQChannel*>& channels) Poller(const std::vector<FairMQChannel*>& channels)
: fItems() : fItems()
, fNumItems(0) , fNumItems(0)
, fOffsetMap()
{ {
fNumItems = channels.size(); fNumItems = channels.size();
fItems = new zmq_pollitem_t[fNumItems]; fItems = new zmq_pollitem_t[fNumItems];
@ -72,7 +70,6 @@ class Poller final : public fair::mq::Poller
Poller(const std::unordered_map<std::string, std::vector<FairMQChannel>>& channelsMap, const std::vector<std::string>& channelList) Poller(const std::unordered_map<std::string, std::vector<FairMQChannel>>& channelsMap, const std::vector<std::string>& channelList)
: fItems() : fItems()
, fNumItems(0) , fNumItems(0)
, fOffsetMap()
{ {
try { try {
int offset = 0; int offset = 0;

View File

@ -54,8 +54,6 @@ struct Region
, fFile(nullptr) , fFile(nullptr)
, fFileMapping() , fFileMapping()
, fQueue(nullptr) , fQueue(nullptr)
, fAcksReceiver()
, fAcksSender()
, fCallback(callback) , fCallback(callback)
, fBulkCallback(bulkCallback) , fBulkCallback(bulkCallback)
{ {

View File

@ -29,7 +29,6 @@ class Poller final : public fair::mq::Poller
Poller(const std::vector<FairMQChannel>& channels) Poller(const std::vector<FairMQChannel>& channels)
: fItems() : fItems()
, fNumItems(0) , fNumItems(0)
, fOffsetMap()
{ {
fNumItems = channels.size(); fNumItems = channels.size();
fItems = new zmq_pollitem_t[fNumItems]; // TODO: fix me fItems = new zmq_pollitem_t[fNumItems]; // TODO: fix me
@ -50,7 +49,6 @@ class Poller final : public fair::mq::Poller
Poller(const std::vector<FairMQChannel*>& channels) Poller(const std::vector<FairMQChannel*>& channels)
: fItems() : fItems()
, fNumItems(0) , fNumItems(0)
, fOffsetMap()
{ {
fNumItems = channels.size(); fNumItems = channels.size();
fItems = new zmq_pollitem_t[fNumItems]; fItems = new zmq_pollitem_t[fNumItems];
@ -71,7 +69,6 @@ class Poller final : public fair::mq::Poller
Poller(const std::unordered_map<std::string, std::vector<FairMQChannel>>& channelsMap, const std::vector<std::string>& channelList) Poller(const std::unordered_map<std::string, std::vector<FairMQChannel>>& channelsMap, const std::vector<std::string>& channelList)
: fItems() : fItems()
, fNumItems(0) , fNumItems(0)
, fOffsetMap()
{ {
try { try {
int offset = 0; int offset = 0;

View File

@ -25,8 +25,7 @@ class RandomAccessIterator : public ::testing::Test {
shared_ptr<FairMQTransportFactory> mFactory; shared_ptr<FairMQTransportFactory> mFactory;
RandomAccessIterator() RandomAccessIterator()
: mParts(FairMQParts{}), : mFactory(FairMQTransportFactory::CreateTransportFactory("zeromq"))
mFactory(FairMQTransportFactory::CreateTransportFactory("zeromq"))
{ {
mParts.AddPart(mFactory->NewSimpleMessage("1")); mParts.AddPart(mFactory->NewSimpleMessage("1"));
mParts.AddPart(mFactory->NewSimpleMessage("2")); mParts.AddPart(mFactory->NewSimpleMessage("2"));

View File

@ -13,7 +13,7 @@
struct MyClass struct MyClass
{ {
MyClass() : msg() {} MyClass() {}
MyClass(const std::string& a) : msg(a) {} MyClass(const std::string& a) : msg(a) {}
MyClass(const MyClass&) = default; MyClass(const MyClass&) = default;
MyClass& operator=(const MyClass& b) { msg = b.msg; return *this; }; MyClass& operator=(const MyClass& b) { msg = b.msg; return *this; };