mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2026-06-15 08:17:05 +00:00
refactor: use default member initializers
- move constant constructor initializers into in-class default member initializers - clang-tidy modernize-use-default-member-init https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-default-member-init.html
This commit is contained in:
committed by
Dennis Klein
parent
4dfe24d411
commit
35d713ebaa
@@ -180,7 +180,6 @@ struct RegionInfo
|
|||||||
, fUserFlags(userFlags)
|
, fUserFlags(userFlags)
|
||||||
, fSize(size)
|
, fSize(size)
|
||||||
, fRCSegmentSize(rcSegmentSize)
|
, fRCSegmentSize(rcSegmentSize)
|
||||||
, fDestroyed(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Str fPath;
|
Str fPath;
|
||||||
@@ -188,7 +187,7 @@ struct RegionInfo
|
|||||||
uint64_t fUserFlags;
|
uint64_t fUserFlags;
|
||||||
uint64_t fSize;
|
uint64_t fSize;
|
||||||
uint64_t fRCSegmentSize;
|
uint64_t fRCSegmentSize;
|
||||||
bool fDestroyed;
|
bool fDestroyed{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
using Uint16RegionInfoPairAlloc = boost::interprocess::allocator<std::pair<const uint16_t, RegionInfo>, SegmentManager>;
|
using Uint16RegionInfoPairAlloc = boost::interprocess::allocator<std::pair<const uint16_t, RegionInfo>, SegmentManager>;
|
||||||
|
|||||||
@@ -59,12 +59,18 @@ void signalHandler(int signal)
|
|||||||
gSignalStatus = signal;
|
gSignalStatus = signal;
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor::Monitor(string shmId, bool selfDestruct, bool interactive, bool viewOnly, unsigned int timeoutInMS, unsigned int intervalInMS, bool monitor, bool cleanOnExit)
|
Monitor::Monitor(string shmId,
|
||||||
|
bool selfDestruct,
|
||||||
|
bool interactive,
|
||||||
|
bool viewOnly,
|
||||||
|
unsigned int timeoutInMS,
|
||||||
|
unsigned int intervalInMS,
|
||||||
|
bool monitor,
|
||||||
|
bool cleanOnExit)
|
||||||
: fSelfDestruct(selfDestruct)
|
: fSelfDestruct(selfDestruct)
|
||||||
, fInteractive(interactive)
|
, fInteractive(interactive)
|
||||||
, fViewOnly(viewOnly)
|
, fViewOnly(viewOnly)
|
||||||
, fMonitor(monitor)
|
, fMonitor(monitor)
|
||||||
, fSeenOnce(false)
|
|
||||||
, fCleanOnExit(cleanOnExit)
|
, fCleanOnExit(cleanOnExit)
|
||||||
, fTimeoutInMS(timeoutInMS)
|
, fTimeoutInMS(timeoutInMS)
|
||||||
, fIntervalInMS(intervalInMS)
|
, fIntervalInMS(intervalInMS)
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ class Monitor
|
|||||||
bool fInteractive; // running in interactive mode
|
bool fInteractive; // running in interactive mode
|
||||||
bool fViewOnly; // view only mode
|
bool fViewOnly; // view only mode
|
||||||
bool fMonitor;
|
bool fMonitor;
|
||||||
bool fSeenOnce; // true is segment has been opened successfully at least once
|
bool fSeenOnce{false}; // true is segment has been opened successfully at least once
|
||||||
bool fCleanOnExit;
|
bool fCleanOnExit;
|
||||||
unsigned int fTimeoutInMS;
|
unsigned int fTimeoutInMS;
|
||||||
unsigned int fIntervalInMS;
|
unsigned int fIntervalInMS;
|
||||||
|
|||||||
@@ -39,18 +39,19 @@ namespace fair::mq::shmem
|
|||||||
class Socket final : public fair::mq::Socket
|
class Socket final : public fair::mq::Socket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Socket(Manager& manager, const std::string& type, const std::string& name, const std::string& id, void* context, fair::mq::TransportFactory* fac = nullptr)
|
Socket(Manager& manager,
|
||||||
|
const std::string& type,
|
||||||
|
const std::string& name,
|
||||||
|
const std::string& id,
|
||||||
|
void* context,
|
||||||
|
fair::mq::TransportFactory* fac = nullptr)
|
||||||
: fair::mq::Socket(fac)
|
: fair::mq::Socket(fac)
|
||||||
, fManager(manager)
|
, fManager(manager)
|
||||||
, fId(id + "." + name + "." + type)
|
, fId(id + "." + name + "." + type)
|
||||||
, fSocket(nullptr)
|
|
||||||
, fMonitorSocket(nullptr)
|
|
||||||
, fBytesTx(0)
|
, fBytesTx(0)
|
||||||
, fBytesRx(0)
|
, fBytesRx(0)
|
||||||
, fMessagesTx(0)
|
, fMessagesTx(0)
|
||||||
, fMessagesRx(0)
|
, fMessagesRx(0)
|
||||||
, fTimeout(100)
|
|
||||||
, fConnectedPeersCount(0)
|
|
||||||
, fMetadataMsgSize(manager.GetMetadataMsgSize())
|
, fMetadataMsgSize(manager.GetMetadataMsgSize())
|
||||||
{
|
{
|
||||||
assert(context);
|
assert(context);
|
||||||
@@ -456,15 +457,15 @@ class Socket final : public fair::mq::Socket
|
|||||||
private:
|
private:
|
||||||
Manager& fManager;
|
Manager& fManager;
|
||||||
std::string fId;
|
std::string fId;
|
||||||
void* fSocket;
|
void* fSocket{nullptr};
|
||||||
void* fMonitorSocket;
|
void* fMonitorSocket{nullptr};
|
||||||
std::atomic<unsigned long> fBytesTx;
|
std::atomic<unsigned long> fBytesTx;
|
||||||
std::atomic<unsigned long> fBytesRx;
|
std::atomic<unsigned long> fBytesRx;
|
||||||
std::atomic<unsigned long> fMessagesTx;
|
std::atomic<unsigned long> fMessagesTx;
|
||||||
std::atomic<unsigned long> fMessagesRx;
|
std::atomic<unsigned long> fMessagesRx;
|
||||||
|
|
||||||
int fTimeout;
|
int fTimeout{100};
|
||||||
mutable unsigned long fConnectedPeersCount;
|
mutable unsigned long fConnectedPeersCount{0};
|
||||||
std::size_t fMetadataMsgSize;
|
std::size_t fMetadataMsgSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ class UnmanagedRegionImpl final : public fair::mq::UnmanagedRegion
|
|||||||
fair::mq::TransportFactory* factory)
|
fair::mq::TransportFactory* factory)
|
||||||
: fair::mq::UnmanagedRegion(factory)
|
: fair::mq::UnmanagedRegion(factory)
|
||||||
, fManager(manager)
|
, fManager(manager)
|
||||||
, fRegion(nullptr)
|
|
||||||
, fRegionId(0)
|
|
||||||
{
|
{
|
||||||
auto [regionPtr, regionId] = fManager.CreateRegion(size, callback, bulkCallback, std::move(cfg));
|
auto [regionPtr, regionId] = fManager.CreateRegion(size, callback, bulkCallback, std::move(cfg));
|
||||||
fRegion = regionPtr;
|
fRegion = regionPtr;
|
||||||
@@ -62,8 +60,8 @@ class UnmanagedRegionImpl final : public fair::mq::UnmanagedRegion
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Manager& fManager;
|
Manager& fManager;
|
||||||
shmem::UnmanagedRegion* fRegion;
|
shmem::UnmanagedRegion* fRegion{nullptr};
|
||||||
uint16_t fRegionId;
|
uint16_t fRegionId{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace fair::mq::shmem
|
} // namespace fair::mq::shmem
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class Context
|
|||||||
Context(int numIoThreads)
|
Context(int numIoThreads)
|
||||||
: fZmqCtx(zmq_ctx_new())
|
: fZmqCtx(zmq_ctx_new())
|
||||||
, fInterrupted(false)
|
, fInterrupted(false)
|
||||||
, fRegionCounter(1)
|
|
||||||
{
|
{
|
||||||
if (!fZmqCtx) {
|
if (!fZmqCtx) {
|
||||||
throw ContextError(tools::ToString("failed creating context, reason: ", zmq_strerror(errno)));
|
throw ContextError(tools::ToString("failed creating context, reason: ", zmq_strerror(errno)));
|
||||||
@@ -180,7 +179,7 @@ class Context
|
|||||||
mutable std::mutex fMtx;
|
mutable std::mutex fMtx;
|
||||||
std::atomic<bool> fInterrupted;
|
std::atomic<bool> fInterrupted;
|
||||||
|
|
||||||
uint16_t fRegionCounter;
|
uint16_t fRegionCounter{1};
|
||||||
std::condition_variable fRegionEventsCV;
|
std::condition_variable fRegionEventsCV;
|
||||||
std::vector<RegionInfo> fRegionInfos;
|
std::vector<RegionInfo> fRegionInfos;
|
||||||
std::queue<RegionInfo> fRegionEvents;
|
std::queue<RegionInfo> fRegionEvents;
|
||||||
|
|||||||
@@ -41,8 +41,7 @@ class Socket final : public fair::mq::Socket
|
|||||||
, fBytesRx(0)
|
, fBytesRx(0)
|
||||||
, fMessagesTx(0)
|
, fMessagesTx(0)
|
||||||
, fMessagesRx(0)
|
, fMessagesRx(0)
|
||||||
, fTimeout(100)
|
|
||||||
, fConnectedPeersCount(0)
|
|
||||||
{
|
{
|
||||||
if (fSocket == nullptr) {
|
if (fSocket == nullptr) {
|
||||||
LOG(error) << "Failed creating socket " << fId << ", reason: " << zmq_strerror(errno);
|
LOG(error) << "Failed creating socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||||
@@ -405,8 +404,8 @@ class Socket final : public fair::mq::Socket
|
|||||||
std::atomic<unsigned long> fMessagesTx;
|
std::atomic<unsigned long> fMessagesTx;
|
||||||
std::atomic<unsigned long> fMessagesRx;
|
std::atomic<unsigned long> fMessagesRx;
|
||||||
|
|
||||||
int fTimeout;
|
int fTimeout{100};
|
||||||
mutable unsigned long fConnectedPeersCount;
|
mutable unsigned long fConnectedPeersCount{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace fair::mq::zmq
|
} // namespace fair::mq::zmq
|
||||||
|
|||||||
Reference in New Issue
Block a user