Avoid accessing Device.fChannels directly, use getters

This commit is contained in:
Alexey Rybalchenko
2021-11-03 12:33:11 +01:00
parent a3bb5fb4b0
commit dbdf17c661
11 changed files with 19 additions and 19 deletions

View File

@@ -19,7 +19,7 @@ struct Sampler : fair::mq::Device
{
void InitTask() override
{
fNumDataChannels = fChannels.at("data").size();
fNumDataChannels = GetNumSubChannels("data");
fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations");
}

View File

@@ -28,7 +28,7 @@ struct Sender : fair::mq::Device
void Run() override
{
FairMQChannel& dataInChannel = fChannels.at("sync").at(0);
FairMQChannel& dataInChannel = GetChannel("sync", 0);
while (!NewStatePending()) {
Header h;

View File

@@ -26,7 +26,7 @@ struct Receiver : Device
void Run() override
{
Channel& dataInChannel = fChannels.at("sr").at(0);
Channel& dataInChannel = GetChannel("sr", 0);
while (!NewStatePending()) {
auto msg(dataInChannel.NewMessage());

View File

@@ -23,7 +23,7 @@ struct Sampler : fair::mq::Device
fLinger = fConfig->GetProperty<uint32_t>("region-linger");
fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations");
fChannels.at("data").at(0).Transport()->SubscribeToRegionEvents([](FairMQRegionInfo info) {
GetChannel("data", 0).Transport()->SubscribeToRegionEvents([](FairMQRegionInfo info) {
LOG(info) << "Region event: " << info.event << ": "
<< (info.managed ? "managed" : "unmanaged")
<< ", id: " << info.id
@@ -87,7 +87,7 @@ struct Sampler : fair::mq::Device
LOG(info) << "All acknowledgements received.";
}
}
fChannels.at("data").at(0).Transport()->UnsubscribeFromRegionEvents();
GetChannel("data", 0).Transport()->UnsubscribeFromRegionEvents();
}
private:

View File

@@ -22,7 +22,7 @@ struct Sink : Device
{
// Get the fMaxIterations value from the command line options (via fConfig)
fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations");
fChannels.at("data").at(0).Transport()->SubscribeToRegionEvents([](RegionInfo info) {
GetChannel("data", 0).Transport()->SubscribeToRegionEvents([](RegionInfo info) {
LOG(info) << "Region event: " << info.event << ": "
<< (info.managed ? "managed" : "unmanaged") << ", id: " << info.id
<< ", ptr: " << info.ptr << ", size: " << info.size
@@ -32,7 +32,7 @@ struct Sink : Device
void Run() override
{
Channel& dataInChannel = fChannels.at("data").at(0);
Channel& dataInChannel = GetChannel("data", 0);
while (!NewStatePending()) {
auto msg(dataInChannel.Transport()->CreateMessage());
@@ -51,7 +51,7 @@ struct Sink : Device
void ResetTask() override
{
fChannels.at("data").at(0).Transport()->UnsubscribeFromRegionEvents();
GetChannel("data", 0).Transport()->UnsubscribeFromRegionEvents();
}
private: