Apply modernize-use-default-member-init

This commit is contained in:
Alexey Rybalchenko
2021-05-26 13:53:48 +02:00
parent d427b4786a
commit 43f7933426
33 changed files with 120 additions and 257 deletions

View File

@@ -27,14 +27,7 @@ enum class FairMQRegionEvent : int
struct FairMQRegionInfo
{
FairMQRegionInfo()
: managed(true)
, id(0)
, ptr(nullptr)
, size(0)
, flags(0)
, event(FairMQRegionEvent::created)
{}
FairMQRegionInfo() {}
FairMQRegionInfo(bool _managed, uint64_t _id, void* _ptr, size_t _size, int64_t _flags, FairMQRegionEvent _event)
: managed(_managed)
@@ -45,12 +38,12 @@ struct FairMQRegionInfo
, event(_event)
{}
bool managed; // managed/unmanaged
uint64_t id; // id of the region
void* ptr; // pointer to the start of the region
size_t size; // region size
int64_t flags; // custom flags set by the creator
FairMQRegionEvent event;
bool managed = true; // managed/unmanaged
uint64_t id = 0; // id of the region
void* ptr = nullptr; // pointer to the start of the region
size_t size = 0; // region size
int64_t flags = 0; // custom flags set by the creator
FairMQRegionEvent event = FairMQRegionEvent::created;
};
struct FairMQRegionBlock {
@@ -108,17 +101,16 @@ inline std::ostream& operator<<(std::ostream& os, const FairMQRegionEvent& event
namespace fair::mq
{
struct RegionConfig {
bool lock;
bool zero;
RegionConfig()
: lock(false), zero(false)
{}
struct RegionConfig
{
RegionConfig() {}
RegionConfig(bool l, bool z)
: lock(l), zero(z)
{}
bool lock = false;
bool zero = false;
};
using RegionCallback = FairMQRegionCallback;

View File

@@ -29,17 +29,7 @@ namespace fair::mq
class BenchmarkSampler : public Device
{
public:
BenchmarkSampler()
: fMultipart(false)
, fMemSet(false)
, fNumParts(1)
, fMsgSize(10000)
, fMsgAlignment(0)
, fMsgRate(0)
, fNumIterations(0)
, fMaxIterations(0)
, fOutChannelName()
{}
BenchmarkSampler() {}
void InitTask() override
{
@@ -109,14 +99,14 @@ class BenchmarkSampler : public Device
}
protected:
bool fMultipart;
bool fMemSet;
size_t fNumParts;
size_t fMsgSize;
size_t fMsgAlignment;
float fMsgRate;
uint64_t fNumIterations;
uint64_t fMaxIterations;
bool fMultipart = false;
bool fMemSet = false;
size_t fNumParts = 1;
size_t fMsgSize = 10000;
size_t fMsgAlignment = 0;
float fMsgRate = 0;
uint64_t fNumIterations = 0;
uint64_t fMaxIterations = 0;
std::string fOutChannelName;
};

View File

@@ -23,13 +23,12 @@ class Merger : public Device
{
public:
Merger()
: fMultipart(true)
, fInChannelName("data-in")
: fInChannelName("data-in")
, fOutChannelName("data-out")
{}
protected:
bool fMultipart;
bool fMultipart = true;
std::string fInChannelName;
std::string fOutChannelName;

View File

@@ -20,16 +20,11 @@ namespace fair::mq
class Multiplier : public Device
{
public:
Multiplier()
: fMultipart(true)
, fNumOutputs(0)
, fInChannelName()
, fOutChannelNames()
{}
Multiplier() {}
protected:
bool fMultipart;
int fNumOutputs;
bool fMultipart = true;
int fNumOutputs = 0;
std::string fInChannelName;
std::vector<std::string> fOutChannelNames;

View File

@@ -19,14 +19,10 @@ namespace fair::mq
class Proxy : public Device
{
public:
Proxy()
: fMultipart(true)
, fInChannelName()
, fOutChannelName()
{}
Proxy() {}
protected:
bool fMultipart;
bool fMultipart = true;
std::string fInChannelName;
std::string fOutChannelName;

View File

@@ -25,22 +25,14 @@ namespace fair::mq
class Sink : public Device
{
public:
Sink()
: fMultipart(false)
, fMaxIterations(0)
, fNumIterations(0)
, fMaxFileSize(0)
, fBytesWritten(0)
, fInChannelName()
, fOutFilename()
{}
Sink() {}
protected:
bool fMultipart;
uint64_t fMaxIterations;
uint64_t fNumIterations;
uint64_t fMaxFileSize;
uint64_t fBytesWritten;
bool fMultipart = false;
uint64_t fMaxIterations = 0;
uint64_t fNumIterations = 0;
uint64_t fMaxFileSize = 0;
uint64_t fBytesWritten = 0;
std::string fInChannelName;
std::string fOutFilename;
std::fstream fOutputFile;

View File

@@ -19,18 +19,12 @@ namespace fair::mq
class Splitter : public Device
{
public:
Splitter()
: fMultipart(true)
, fNumOutputs(0)
, fDirection(0)
, fInChannelName()
, fOutChannelName()
{}
Splitter() {}
protected:
bool fMultipart;
int fNumOutputs;
int fDirection;
bool fMultipart = true;
int fNumOutputs = 0;
int fDirection = 0;
std::string fInChannelName;
std::string fOutChannelName;

View File

@@ -187,11 +187,7 @@ using Uint16MsgDebugMapHashMap = boost::unordered_map<uint16_t, SizetMsgDebugMap
struct RegionBlock
{
RegionBlock()
: fHandle()
, fSize(0)
, fHint(0)
{}
RegionBlock() {}
RegionBlock(boost::interprocess::managed_shared_memory::handle_t handle, size_t size, size_t hint)
: fHandle(handle)
@@ -199,9 +195,9 @@ struct RegionBlock
, fHint(hint)
{}
boost::interprocess::managed_shared_memory::handle_t fHandle;
size_t fSize;
size_t fHint;
boost::interprocess::managed_shared_memory::handle_t fHandle{};
size_t fSize = 0;
size_t fHint = 0;
};
// find id for unique shmem name:

View File

@@ -35,7 +35,6 @@ class Message final : public fair::mq::Message
public:
Message(FairMQTransportFactory* factory = nullptr)
: fair::mq::Message(factory)
, fAlignment(0)
, fMsg(std::make_unique<zmq_msg_t>())
{
if (zmq_msg_init(fMsg.get()) != 0) {
@@ -55,7 +54,6 @@ class Message final : public fair::mq::Message
Message(const size_t size, FairMQTransportFactory* factory = nullptr)
: fair::mq::Message(factory)
, fAlignment(0)
, fMsg(std::make_unique<zmq_msg_t>())
{
if (zmq_msg_init_size(fMsg.get(), size) != 0) {
@@ -96,7 +94,6 @@ class Message final : public fair::mq::Message
Message(void* data, const size_t size, fairmq_free_fn* ffn, void* hint = nullptr, FairMQTransportFactory* factory = nullptr)
: fair::mq::Message(factory)
, fAlignment(0)
, fMsg(std::make_unique<zmq_msg_t>())
{
if (zmq_msg_init_data(fMsg.get(), data, size, ffn, hint) != 0) {
@@ -106,7 +103,6 @@ class Message final : public fair::mq::Message
Message(UnmanagedRegionPtr& region, void* data, const size_t size, void* hint = 0, FairMQTransportFactory* factory = nullptr)
: fair::mq::Message(factory)
, fAlignment(0)
, fMsg(std::make_unique<zmq_msg_t>())
{
if (region->GetType() != GetType()) {
@@ -264,7 +260,7 @@ class Message final : public fair::mq::Message
~Message() override { CloseMessage(); }
private:
size_t fAlignment;
size_t fAlignment = 0;
std::unique_ptr<zmq_msg_t> fMsg;
zmq_msg_t* GetMessage() const { return fMsg.get(); }