ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Base
src
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
15
#include "
VP1Base/VP1ExternalRequest.h
"
16
#include <QStringList>
17
#include <cassert>
18
19
//____________________________________________________________________
20
VP1ExternalRequest::VP1ExternalRequest
(
const
QString&
sender
,
const
QString&
message
,
21
const
Action
&
action
,
const
QString&
actioninfo
)
22
:
m_message
(
message
),
m_sender
(
sender
),
m_action
(
action
),
m_actioninfo
(
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
//____________________________________________________________________
36
QString
VP1ExternalRequest::actionToString
(
const
Action
&
a
)
const
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
//____________________________________________________________________
52
QString
VP1ExternalRequest::serialize
()
const
53
{
54
QString s(
"VP1ExternalRequestV1.0|"
);
55
s+=
actionToString
(
m_action
);
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
//____________________________________________________________________
75
VP1ExternalRequest::VP1ExternalRequest
(
const
QString& serialized)
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"
)
86
m_action
=
SHOWTAB
;
87
else
if
(sl.at(1)==
"SHOWCHANNEL"
)
88
m_action
=
SHOWCHANNEL
;
89
else
if
(sl.at(1)==
"SHOWMESSAGE"
)
90
m_action
=
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
//____________________________________________________________________
116
bool
VP1ExternalRequest::operator==
(
const
VP1ExternalRequest
& o )
const
{
117
118
return
m_message
==o.
m_message
119
&&
m_sender
==o.
m_sender
120
&&
m_action
==o.
m_action
121
&&
m_actioninfo
==o.
m_actioninfo
122
&&
m_valid
==o.
m_valid
;
123
}
124
//____________________________________________________________________
125
bool
VP1ExternalRequest::operator<
(
const
VP1ExternalRequest
& o )
const
{
126
127
if
(
m_sender
==o.
m_sender
)
128
return
m_message
<
m_message
;
129
else
130
return
m_sender
<
m_sender
;
131
}
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
if
if(pathvar)
Definition
SealSharedLib.cxx:168
VP1ExternalRequest.h
VP1ExternalRequest::sender
const QString & sender() const
Definition
VP1ExternalRequest.h:34
VP1ExternalRequest::operator==
bool operator==(const VP1ExternalRequest &other) const
Definition
VP1ExternalRequest.cxx:116
VP1ExternalRequest::actionToString
QString actionToString(const Action &) const
Definition
VP1ExternalRequest.cxx:36
VP1ExternalRequest::m_sender
QString m_sender
Definition
VP1ExternalRequest.h:46
VP1ExternalRequest::m_valid
bool m_valid
Definition
VP1ExternalRequest.h:49
VP1ExternalRequest::action
Action action() const
Definition
VP1ExternalRequest.h:31
VP1ExternalRequest::actioninfo
const QString & actioninfo() const
Definition
VP1ExternalRequest.h:32
VP1ExternalRequest::m_action
Action m_action
Definition
VP1ExternalRequest.h:47
VP1ExternalRequest::serialize
QString serialize() const
Definition
VP1ExternalRequest.cxx:52
VP1ExternalRequest::Action
Action
Definition
VP1ExternalRequest.h:23
VP1ExternalRequest::SHOWTAB
@ SHOWTAB
Definition
VP1ExternalRequest.h:23
VP1ExternalRequest::SHOWMESSAGE
@ SHOWMESSAGE
Definition
VP1ExternalRequest.h:23
VP1ExternalRequest::SHOWCHANNEL
@ SHOWCHANNEL
Definition
VP1ExternalRequest.h:23
VP1ExternalRequest::m_message
QString m_message
Definition
VP1ExternalRequest.h:45
VP1ExternalRequest::operator<
bool operator<(const VP1ExternalRequest &other) const
Definition
VP1ExternalRequest.cxx:125
VP1ExternalRequest::VP1ExternalRequest
VP1ExternalRequest(const QString &sender, const QString &message, const Action &action, const QString &actioninfo)
Definition
VP1ExternalRequest.cxx:20
VP1ExternalRequest::message
const QString & message() const
Definition
VP1ExternalRequest.h:33
VP1ExternalRequest::m_actioninfo
QString m_actioninfo
Definition
VP1ExternalRequest.h:48
Generated on
for ATLAS Offline Software by
1.17.0