Apply readability-redundant-member-init

This commit is contained in:
Alexey Rybalchenko 2021-05-26 22:39:19 +02:00
parent 43f7933426
commit c764d4643d
17 changed files with 19 additions and 75 deletions

View File

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

View File

@ -21,11 +21,9 @@ using namespace fair::mq;
DeviceRunner::DeviceRunner(int argc, char*const* argv, bool printLogo)
: fRawCmdLineArgs(tools::ToStrVector(argc, argv, false))
, fConfig()
, fDevice(nullptr)
, fPluginManager(fRawCmdLineArgs)
, fPrintLogo(printLogo)
, fEvents()
{}
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)
: fTransportFactory(nullptr)
, fTransports()
, fChannels()
, fInternalConfig(config ? nullptr : make_unique<ProgOptions>())
, fConfig(config ? config : fInternalConfig.get())
, fId(DefaultId)
, fDefaultTransportType(DefaultTransportType)
, fStateMachine()
, fUninitializedBindingChannels()
, fUninitializedConnectingChannels()
, fDataCallbacks(false)
, fMsgInputs()
, fMultipartInputs()
, fMultitransportInputs()
, fChannelRegistry()
, fInputChannelKeys()
, fMultitransportMutex()
, fMultitransportProceed(false)
, fVersion(version)
, fRate(DefaultRate)
, fMaxRunRuntimeInS(DefaultMaxRunTime)
, fInitializationTimeoutInS(DefaultInitTimeout)
, fRawCmdLineArgs()
, fTransitionMtx()
, fTransitioning(false)
{
SubscribeToNewTransition("device", [&](Transition transition) {

View File

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

View File

@ -57,46 +57,44 @@ class FairMQMemoryResource : public pmr::memory_resource
class ChannelResource : public FairMQMemoryResource
{
protected:
FairMQTransportFactory *factory{nullptr};
FairMQTransportFactory* factory{nullptr};
// TODO: for now a map to keep track of allocations, something else would
// probably be
// 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:
ChannelResource() = delete;
ChannelResource(FairMQTransportFactory *_factory)
: FairMQMemoryResource()
, factory(_factory)
, messageMap()
ChannelResource(FairMQTransportFactory* _factory)
: factory(_factory)
{
if (!_factory) {
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]);
messageMap.erase(p);
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);
return addr;
}
FairMQTransportFactory *getTransportFactory() noexcept override { return factory; }
FairMQTransportFactory* getTransportFactory() noexcept override { return factory; }
size_t getNumberOfMessages() const noexcept override { return messageMap.size(); }
protected:
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_allocate(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);
};

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>();
fair::mq::PluginManager::PluginManager()
: fSearchPaths{}
, fPluginFactories()
, fPluginServices()
, fPlugins()
, fPluginOrder()
, fPluginProgOptions()
: fPluginServices()
{
}
fair::mq::PluginManager::PluginManager(const vector<string> args)
: fSearchPaths{}
, fPluginFactories()
, fPluginServices()
, fPlugins()
, fPluginOrder()
, fPluginProgOptions()
: fPluginServices()
{
// Parse command line options
auto options = ProgramOptions();

View File

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

View File

@ -68,11 +68,7 @@ string ConvertVarValToString(const po::variable_value& v)
}
ProgOptions::ProgOptions()
: fVarMap()
, fAllOptions("FairMQ Command Line Options")
, fUnregisteredOptions()
, fEvents()
, fMtx()
: fAllOptions("FairMQ Command Line Options")
{
fAllOptions.add_options()
("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)
: Plugin(name, version, maintainer, homepage, pluginServices)
, fControllerThread()
, fSignalHandlerThread()
, fControllerMutex()
, fDeviceShutdownRequested(false)
, fDeviceHasShutdown(false)
, fPluginShutdownRequested(false)

View File

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

View File

@ -63,7 +63,6 @@ class Manager
, fShmId(makeShmIdStr(sessionName))
, fSegmentId(config ? config->GetProperty<uint16_t>("shm-segment-id", 0) : 0)
, fDeviceId(std::move(deviceId))
, fSegments()
, fManagementSegment(boost::interprocess::open_or_create, std::string("fmq_" + fShmId + "_mng").c_str(), 6553600)
, fShmVoidAlloc(fManagementSegment.get_segment_manager())
, fShmMtx(boost::interprocess::open_or_create, std::string("fmq_" + fShmId + "_mtx").c_str())
@ -81,7 +80,6 @@ class Manager
, fMsgCounterNew(0)
, fMsgCounterDelete(0)
#endif
, fHeartbeatThread()
, fSendHeartbeats(true)
, fThrowOnBadAlloc(config ? config->GetProperty<bool>("shm-throw-bad-alloc", true) : true)
, 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)
, fHeartbeatTriggered(false)
, fLastHeartbeat(chrono::high_resolution_clock::now())
, fSignalThread()
, fDeviceHeartbeats()
{
if (!fViewOnly) {
try {

View File

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

View File

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

View File

@ -29,7 +29,6 @@ class Poller final : public fair::mq::Poller
Poller(const std::vector<FairMQChannel>& channels)
: fItems()
, fNumItems(0)
, fOffsetMap()
{
fNumItems = channels.size();
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)
: fItems()
, fNumItems(0)
, fOffsetMap()
{
fNumItems = channels.size();
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)
: fItems()
, fNumItems(0)
, fOffsetMap()
{
try {
int offset = 0;

View File

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

View File

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