Skip to content

Commit

Permalink
Apply readability-redundant-member-init
Browse files Browse the repository at this point in the history
  • Loading branch information
rbx authored and dennisklein committed May 28, 2021
1 parent acf63d3 commit 9444de5
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 75 deletions.
4 changes: 1 addition & 3 deletions examples/readout/builder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ namespace bpo = boost::program_options;
class Builder : public FairMQDevice
{
public:
Builder()
: fOutputChannelName()
{}
Builder() {}

void Init() override
{
Expand Down
2 changes: 0 additions & 2 deletions fairmq/DeviceRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 0 additions & 13 deletions fairmq/FairMQDevice.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions fairmq/FairMQParts.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FairMQParts

public:
/// Default constructor
FairMQParts() : fParts() {};
FairMQParts() {};
/// Copy Constructor
FairMQParts(const FairMQParts&) = delete;
/// Move constructor
Expand All @@ -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() {};

Expand Down
22 changes: 10 additions & 12 deletions fairmq/MemoryResources.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
14 changes: 2 additions & 12 deletions fairmq/PluginManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 1 addition & 5 deletions fairmq/PluginServices.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ class PluginServices
PluginServices(ProgOptions& config, FairMQDevice& device)
: fConfig(config)
, fDevice(device)
, fDeviceController()
, fDeviceControllerMutex()
, fReleaseDeviceControlCondition()
{
}
{}

~PluginServices()
{
Expand Down
6 changes: 1 addition & 5 deletions fairmq/ProgOptions.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 0 additions & 3 deletions fairmq/plugins/control/Control.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions fairmq/sdk/Topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 0 additions & 2 deletions fairmq/shmem/Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions fairmq/shmem/Monitor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 0 additions & 3 deletions fairmq/shmem/Poller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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];
Expand All @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions fairmq/shmem/Region.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ struct Region
, fFile(nullptr)
, fFileMapping()
, fQueue(nullptr)
, fAcksReceiver()
, fAcksSender()
, fCallback(callback)
, fBulkCallback(bulkCallback)
{
Expand Down
3 changes: 0 additions & 3 deletions fairmq/zeromq/Poller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];
Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions test/parts/_iterator_interface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
2 changes: 1 addition & 1 deletion test/plugin_services/_config.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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; };
Expand Down

0 comments on commit 9444de5

Please sign in to comment.