ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
VP1ExternalRequest Class Reference

#include <VP1ExternalRequest.h>

Collaboration diagram for VP1ExternalRequest:

Public Types

enum  Action { SHOWTAB, SHOWCHANNEL, SHOWMESSAGE }
 

Public Member Functions

QString actionToString (const Action &) const
 
 VP1ExternalRequest (const QString &sender, const QString &message, const Action &action, const QString &actioninfo)
 
bool isValid () const
 
Action action () const
 
QString actioninfo () const
 
QString message () const
 
QString sender () const
 
QString serialize () const
 
 VP1ExternalRequest (const QString &serialized)
 
virtual ~VP1ExternalRequest ()
 
bool operator== (const VP1ExternalRequest &other) const
 
bool operator< (const VP1ExternalRequest &other) const
 

Private Attributes

QString m_message
 
QString m_sender
 
Action m_action
 
QString m_actioninfo
 
bool m_valid
 

Detailed Description

Definition at line 20 of file VP1ExternalRequest.h.

Member Enumeration Documentation

◆ Action

Enumerator
SHOWTAB 
SHOWCHANNEL 
SHOWMESSAGE 

Definition at line 23 of file VP1ExternalRequest.h.

Constructor & Destructor Documentation

◆ VP1ExternalRequest() [1/2]

VP1ExternalRequest::VP1ExternalRequest ( const QString &  sender,
const QString &  message,
const Action action,
const QString &  actioninfo 
)

Definition at line 20 of file VP1ExternalRequest.cxx.

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 }

◆ VP1ExternalRequest() [2/2]

VP1ExternalRequest::VP1ExternalRequest ( const QString &  serialized)

Definition at line 75 of file VP1ExternalRequest.cxx.

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 }

◆ ~VP1ExternalRequest()

virtual VP1ExternalRequest::~VP1ExternalRequest ( )
inlinevirtual

Definition at line 39 of file VP1ExternalRequest.h.

39 {}

Member Function Documentation

◆ action()

Action VP1ExternalRequest::action ( ) const
inline

Definition at line 31 of file VP1ExternalRequest.h.

31 { return m_action; }

◆ actioninfo()

QString VP1ExternalRequest::actioninfo ( ) const
inline

Definition at line 32 of file VP1ExternalRequest.h.

32 { return m_actioninfo; }

◆ actionToString()

QString VP1ExternalRequest::actionToString ( const Action a) const

Definition at line 36 of file VP1ExternalRequest.cxx.

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 }

◆ isValid()

bool VP1ExternalRequest::isValid ( ) const
inline

Definition at line 29 of file VP1ExternalRequest.h.

29 { return m_valid; }

◆ message()

QString VP1ExternalRequest::message ( ) const
inline

Definition at line 33 of file VP1ExternalRequest.h.

33 { return m_message; }

◆ operator<()

bool VP1ExternalRequest::operator< ( const VP1ExternalRequest other) const

Definition at line 125 of file VP1ExternalRequest.cxx.

125  {
126 
127  if (m_sender==o.m_sender)
128  return m_message<m_message;
129  else
130  return m_sender<m_sender;
131 }

◆ operator==()

bool VP1ExternalRequest::operator== ( const VP1ExternalRequest other) const

Definition at line 116 of file VP1ExternalRequest.cxx.

116  {
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 }

◆ sender()

QString VP1ExternalRequest::sender ( ) const
inline

Definition at line 34 of file VP1ExternalRequest.h.

34 { return m_sender; }

◆ serialize()

QString VP1ExternalRequest::serialize ( ) const

Definition at line 52 of file VP1ExternalRequest.cxx.

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 }

Member Data Documentation

◆ m_action

Action VP1ExternalRequest::m_action
private

Definition at line 47 of file VP1ExternalRequest.h.

◆ m_actioninfo

QString VP1ExternalRequest::m_actioninfo
private

Definition at line 48 of file VP1ExternalRequest.h.

◆ m_message

QString VP1ExternalRequest::m_message
private

Definition at line 45 of file VP1ExternalRequest.h.

◆ m_sender

QString VP1ExternalRequest::m_sender
private

Definition at line 46 of file VP1ExternalRequest.h.

◆ m_valid

bool VP1ExternalRequest::m_valid
private

Definition at line 49 of file VP1ExternalRequest.h.


The documentation for this class was generated from the following files:
VP1ExternalRequest::m_sender
QString m_sender
Definition: VP1ExternalRequest.h:46
VP1ExternalRequest::message
QString message() const
Definition: VP1ExternalRequest.h:33
VP1ExternalRequest::m_valid
bool m_valid
Definition: VP1ExternalRequest.h:49
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
VP1ExternalRequest::sender
QString sender() const
Definition: VP1ExternalRequest.h:34
VP1ExternalRequest::m_message
QString m_message
Definition: VP1ExternalRequest.h:45
VP1ExternalRequest::action
Action action() const
Definition: VP1ExternalRequest.h:31
VP1ExternalRequest::actionToString
QString actionToString(const Action &) const
Definition: VP1ExternalRequest.cxx:36
VP1ExternalRequest::m_action
Action m_action
Definition: VP1ExternalRequest.h:47
VP1ExternalRequest::SHOWCHANNEL
@ SHOWCHANNEL
Definition: VP1ExternalRequest.h:23
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
VP1ExternalRequest::SHOWTAB
@ SHOWTAB
Definition: VP1ExternalRequest.h:23
VP1ExternalRequest::m_actioninfo
QString m_actioninfo
Definition: VP1ExternalRequest.h:48
a
TList * a
Definition: liststreamerinfos.cxx:10
VP1ExternalRequest::actioninfo
QString actioninfo() const
Definition: VP1ExternalRequest.h:32
VP1ExternalRequest::SHOWMESSAGE
@ SHOWMESSAGE
Definition: VP1ExternalRequest.h:23