ATLAS Offline Software
Loading...
Searching...
No Matches
VP1ExternalRequest.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6// //
7// Implementation of class VP1ExternalRequest //
8// //
9// Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
10// //
11// Initial version: April 2007 //
12// //
14
16#include <QStringList>
17#include <cassert>
18
19//____________________________________________________________________
21 const Action& action, const QString& actioninfo)
23{
24 m_valid = true;
25 if (m_sender.isEmpty())
26 m_valid=false;
27 else if (m_message.isEmpty())
28 m_valid=false;
29 else if (m_actioninfo.isEmpty()&&m_action!=SHOWMESSAGE)
30 m_valid=false;
31 else if (!m_actioninfo.isEmpty()&&m_action==SHOWMESSAGE)
32 m_valid=false;
33}
34
35//____________________________________________________________________
37{
38 switch(a) {
39 case SHOWTAB:
40 return "SHOWTAB";
41 case SHOWCHANNEL:
42 return "SHOWCHANNEL";
43 case SHOWMESSAGE:
44 return "SHOWMESSAGE";
45 default:
46 assert(0&&"should never happen");
47 return "Unknown action! (This should never happen)";
48 }
49}
50
51//____________________________________________________________________
53{
54 QString s("VP1ExternalRequestV1.0|");
56 s+="|";
57 QString tmp = m_actioninfo;
58 tmp.replace("@","@1");
59 tmp.replace("|","@2");
60 s+=tmp;
61 s+="|";
62 tmp = m_message;
63 tmp.replace("@","@1");
64 tmp.replace("|","@2");
65 s+=tmp;
66 s+="|";
67 tmp = m_sender;
68 tmp.replace("@","@1");
69 tmp.replace("|","@2");
70 s+=tmp;
71 return s;
72}
73
74//____________________________________________________________________
76{
77 m_action=SHOWTAB;//To be sure we always assign to something
78
79 m_valid=true;
80 QStringList sl = serialized.split ("|");
81 if (sl.count()!=5||sl.at(0)!="VP1ExternalRequestV1.0") {
82 m_valid=false;
83 m_action=SHOWMESSAGE;//To avoid coverity warning of uninit data member
84 } else {
85 if (sl.at(1)=="SHOWTAB")
87 else if (sl.at(1)=="SHOWCHANNEL")
89 else if (sl.at(1)=="SHOWMESSAGE")
91 else m_valid = false;
92 if (m_valid) {
93 m_actioninfo=sl.at(2);
94 m_message=sl.at(3);
95 m_sender=sl.at(4);
96 m_actioninfo.replace("@2","|");
97 m_actioninfo.replace("@1","@");
98 m_message.replace("@2","|");
99 m_message.replace("@1","@");
100 m_sender.replace("@2","|");
101 m_sender.replace("@1","@");
102 if (m_sender.isEmpty())
103 m_valid=false;
104 else if (m_message.isEmpty())
105 m_valid=false;
106 else if (m_actioninfo.isEmpty()&&m_action!=SHOWMESSAGE)
107 m_valid=false;
108 else if (!m_actioninfo.isEmpty()&&m_action==SHOWMESSAGE)
109 m_valid=false;
110 }
111 }
112}
113
114
115//____________________________________________________________________
117
118 return m_message==o.m_message
119 && m_sender==o.m_sender
120 && m_action==o.m_action
122 && m_valid==o.m_valid;
123}
124//____________________________________________________________________
126
127 if (m_sender==o.m_sender)
128 return m_message<m_message;
129 else
130 return m_sender<m_sender;
131}
static Double_t a
if(febId1==febId2)
const QString & sender() const
bool operator==(const VP1ExternalRequest &other) const
QString actionToString(const Action &) const
const QString & actioninfo() const
QString serialize() const
bool operator<(const VP1ExternalRequest &other) const
VP1ExternalRequest(const QString &sender, const QString &message, const Action &action, const QString &actioninfo)
const QString & message() const