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)
|
||||
, fSize(size)
|
||||
, fRCSegmentSize(rcSegmentSize)
|
||||
, fDestroyed(false)
|
||||
{}
|
||||
|
||||
Str fPath;
|
||||
@@ -188,7 +187,7 @@ struct RegionInfo
|
||||
uint64_t fUserFlags;
|
||||
uint64_t fSize;
|
||||
uint64_t fRCSegmentSize;
|
||||
bool fDestroyed;
|
||||
bool fDestroyed{false};
|
||||
};
|
||||
|
||||
using Uint16RegionInfoPairAlloc = boost::interprocess::allocator<std::pair<const uint16_t, RegionInfo>, SegmentManager>;
|
||||
|
||||
@@ -59,12 +59,18 @@ void signalHandler(int 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)
|
||||
, fInteractive(interactive)
|
||||
, fViewOnly(viewOnly)
|
||||
, fMonitor(monitor)
|
||||
, fSeenOnce(false)
|
||||
, fCleanOnExit(cleanOnExit)
|
||||
, fTimeoutInMS(timeoutInMS)
|
||||
, fIntervalInMS(intervalInMS)
|
||||
|
||||
@@ -170,7 +170,7 @@ class Monitor
|
||||
bool fInteractive; // running in interactive mode
|
||||
bool fViewOnly; // view only mode
|
||||
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;
|
||||
unsigned int fTimeoutInMS;
|
||||
unsigned int fIntervalInMS;
|
||||
|
||||
@@ -39,18 +39,19 @@ namespace fair::mq::shmem
|
||||
class Socket final : public fair::mq::Socket
|
||||
{
|
||||
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)
|
||||
, fManager(manager)
|
||||
, fId(id + "." + name + "." + type)
|
||||
, fSocket(nullptr)
|
||||
, fMonitorSocket(nullptr)
|
||||
, fBytesTx(0)
|
||||
, fBytesRx(0)
|
||||
, fMessagesTx(0)
|
||||
, fMessagesRx(0)
|
||||
, fTimeout(100)
|
||||
, fConnectedPeersCount(0)
|
||||
, fMetadataMsgSize(manager.GetMetadataMsgSize())
|
||||
{
|
||||
assert(context);
|
||||
@@ -456,15 +457,15 @@ class Socket final : public fair::mq::Socket
|
||||
private:
|
||||
Manager& fManager;
|
||||
std::string fId;
|
||||
void* fSocket;
|
||||
void* fMonitorSocket;
|
||||
void* fSocket{nullptr};
|
||||
void* fMonitorSocket{nullptr};
|
||||
std::atomic<unsigned long> fBytesTx;
|
||||
std::atomic<unsigned long> fBytesRx;
|
||||
std::atomic<unsigned long> fMessagesTx;
|
||||
std::atomic<unsigned long> fMessagesRx;
|
||||
|
||||
int fTimeout;
|
||||
mutable unsigned long fConnectedPeersCount;
|
||||
int fTimeout{100};
|
||||
mutable unsigned long fConnectedPeersCount{0};
|
||||
std::size_t fMetadataMsgSize;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@ class UnmanagedRegionImpl final : public fair::mq::UnmanagedRegion
|
||||
fair::mq::TransportFactory* factory)
|
||||
: fair::mq::UnmanagedRegion(factory)
|
||||
, fManager(manager)
|
||||
, fRegion(nullptr)
|
||||
, fRegionId(0)
|
||||
{
|
||||
auto [regionPtr, regionId] = fManager.CreateRegion(size, callback, bulkCallback, std::move(cfg));
|
||||
fRegion = regionPtr;
|
||||
@@ -62,8 +60,8 @@ class UnmanagedRegionImpl final : public fair::mq::UnmanagedRegion
|
||||
|
||||
private:
|
||||
Manager& fManager;
|
||||
shmem::UnmanagedRegion* fRegion;
|
||||
uint16_t fRegionId;
|
||||
shmem::UnmanagedRegion* fRegion{nullptr};
|
||||
uint16_t fRegionId{0};
|
||||
};
|
||||
|
||||
} // namespace fair::mq::shmem
|
||||
|
||||
@@ -37,7 +37,6 @@ class Context
|
||||
Context(int numIoThreads)
|
||||
: fZmqCtx(zmq_ctx_new())
|
||||
, fInterrupted(false)
|
||||
, fRegionCounter(1)
|
||||
{
|
||||
if (!fZmqCtx) {
|
||||
throw ContextError(tools::ToString("failed creating context, reason: ", zmq_strerror(errno)));
|
||||
@@ -180,7 +179,7 @@ class Context
|
||||
mutable std::mutex fMtx;
|
||||
std::atomic<bool> fInterrupted;
|
||||
|
||||
uint16_t fRegionCounter;
|
||||
uint16_t fRegionCounter{1};
|
||||
std::condition_variable fRegionEventsCV;
|
||||
std::vector<RegionInfo> fRegionInfos;
|
||||
std::queue<RegionInfo> fRegionEvents;
|
||||
|
||||
@@ -41,8 +41,7 @@ class Socket final : public fair::mq::Socket
|
||||
, fBytesRx(0)
|
||||
, fMessagesTx(0)
|
||||
, fMessagesRx(0)
|
||||
, fTimeout(100)
|
||||
, fConnectedPeersCount(0)
|
||||
|
||||
{
|
||||
if (fSocket == nullptr) {
|
||||
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> fMessagesRx;
|
||||
|
||||
int fTimeout;
|
||||
mutable unsigned long fConnectedPeersCount;
|
||||
int fTimeout{100};
|
||||
mutable unsigned long fConnectedPeersCount{0};
|
||||
};
|
||||
|
||||
} // namespace fair::mq::zmq
|
||||
|
||||
Reference in New Issue
Block a user