Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
InformationDockCommunicationStrategy.cpp
1/*
2 * Marvelous OTF2 Traces Interactive Visualizer (MOTIV)
3 * Copyright (C) 2023 Florian Gallrein, Björn Gehrke
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18#include "InformationDockCommunicationStrategy.hpp"
19#include "src/utils.hpp"
20
22 communicatorField = new QLabel;
23 startKindField = new QLabel;
24 endKindField = new QLabel;
25 rankFromField = new QLabel;
26 rankToField = new QLabel;
27
28 layout->addRow(tr("From:"), rankFromField);
29 layout->addRow(tr("To:"), rankToField);
30 layout->addRow(tr("Communicator:"), communicatorField);
31 layout->addRow(tr("Start event:"), startKindField);
32 layout->addRow(tr("End event:"), endKindField);
33
35}
36
38 auto communicator = std::get<otf2::definition::comm>(*element->getStartEvent()->getCommunicator());
39 auto startEvent = element->getStartEvent();
40 auto endEvent = element->getEndEvent();
41
42 auto rankFrom = QString::fromStdString(startEvent->getLocation()->location_group().name().str());
43 auto rankTo = QString::fromStdString(endEvent->getLocation()->location_group().name().str());
44 auto startKindName = QString::fromStdString(communicationKindName(startEvent->getKind()));
45 auto endKindName = QString::fromStdString(communicationKindName(endEvent->getKind()));
46 auto communicatorName = QString::fromStdString(communicator.name().str());
47
48 rankFromField->setText(rankFrom);
49 rankToField->setText(rankTo);
50 startKindField->setText(startKindName);
51 endKindField->setText(endKindName);
52 communicatorField->setText(communicatorName);
53
55}
56
58 return tr("P2P communication").toStdString();
59}
virtual types::communicator * getCommunicator() const =0
Class representing any (successful or unsuccessful) communication.
const CommunicationEvent * getStartEvent() const
const CommunicationEvent * getEndEvent() const
std::string title() override
Returns the title the information dock should show.
void updateView(QFormLayout *layout, Communication *element) override
Updates the view.
void setup(QFormLayout *layout) override
Sets up the QFormLayout.
virtual void updateView(QFormLayout *layout, T *element)
Updates the view.
static QString tr(const char *s, const char *c=nullptr, int n=-1)
void setup(QFormLayout *layout) override
Sets up the QFormLayout.