ATLAS Offline Software
SignalStateHelper.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // SignalStateHelper.cxx
9 
10 // EventKernel includes
12 
13 //*****************************************************************
14 //
15 // SignalStateHelper
16 //
17 //*****************************************************************
18 
19 
22  m_originalState(P4SignalState::UNKNOWN),
23  m_currentState(P4SignalState::UNKNOWN),
24  m_object(0)
25 {}
26 
29  m_originalState(P4SignalState::UNKNOWN),
30  m_currentState(P4SignalState::UNKNOWN),
31  m_object(0)
32 {
33  controlObject(theObject);
34 }
35 
37  m_originalState(P4SignalState::UNKNOWN),
38  m_currentState(s),
39  m_object(0)
40 {
42 }
43 
45  m_originalState(P4SignalState::UNKNOWN),
46  m_currentState(s),
47  m_object(theObject)
48 {
49  if( theObject != NULL ){
50  m_originalState = theObject->signalState();
52  }
53 }
54 
56 {
57  releaseObject();
58 }
59 
62 {
63  releaseObject();
64  m_originalState = theObject->signalState();
65  m_object = theObject;
68  return true;
69 }
70 
72 {
73  m_currentState = s;
74  // If we do have an object attached, switch its signal state
76  {
78  return true;
79  }
80  return false;
81 }
82 
84 {
85  // If we have an object attached, revert and remove
86  if(m_object!=0)
87  {
89  m_object=0;
90  return true;
91  }
92  return false;
93 }
94 
96 {
97  if(m_object!=0)
98  {
101  return true;
102  }
103  return false;
104 }
105 
106 //*****************************************************************
107 //
108 // SignalStateConstHelper
109 //
110 //*****************************************************************
111 
112 
115  m_originalState(P4SignalState::UNKNOWN),
116  m_currentState(P4SignalState::UNKNOWN),
117  m_object(0)
118 {}
119 
122  m_originalState(P4SignalState::UNKNOWN),
123  m_currentState(P4SignalState::UNKNOWN),
124  m_object(0)
125 {
126  controlObject(theObject);
127 }
128 
130  m_originalState(P4SignalState::UNKNOWN),
131  m_currentState(s),
132  m_object(0)
133 {
134  setSignalState(s);
135 }
136 
138  m_originalState(P4SignalState::UNKNOWN),
139  m_currentState(s),
140  m_object(const_cast<ISignalState*>(theObject))
141 {
142  if( theObject != NULL ){
143  m_originalState = theObject->signalState();
145  }
146 }
147 
149 {
150  releaseObject();
151 }
152 
155 {
156  releaseObject();
157  m_originalState = theObject->signalState();
158  m_object = const_cast<ISignalState*>(theObject);
161  return true;
162 }
163 
165 {
166  m_currentState = s;
167  // If we do have an object attached, switch its signal state
169  {
171  return true;
172  }
173  return false;
174 }
175 
177 {
178  // If we have an object attached, revert and remove
179  if(m_object!=0)
180  {
182  m_object=0;
183  return true;
184  }
185  return false;
186 }
187 
189 {
190  if(m_object!=0)
191  {
194  return true;
195  }
196  return false;
197 }
198 
SignalStateConstHelper::controlObject
bool controlObject(const ISignalState *theObject)
Change the object controlled, this releases previous object and resets its SigState.
Definition: SignalStateHelper.cxx:154
python.StoreID.UNKNOWN
int UNKNOWN
Definition: StoreID.py:16
SignalStateConstHelper::~SignalStateConstHelper
~SignalStateConstHelper()
Destructor.
Definition: SignalStateHelper.cxx:148
SignalStateConstHelper::m_currentState
P4SignalState::State m_currentState
Definition: SignalStateHelper.h:105
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
ISignalState
Definition: ISignalState.h:42
P4SignalState::UNKNOWN
@ UNKNOWN
Definition: ISignalState.h:29
ISignalState::signalState
virtual P4SignalState::State signalState() const =0
obtain the current signal state
SignalStateConstHelper::releaseObject
bool releaseObject()
Release controled object (this resets its signal state)
Definition: SignalStateHelper.cxx:176
SignalStateHelper::resetSignalState
bool resetSignalState()
Reset the Signal State of the controlled object and use it for future operations.
Definition: SignalStateHelper.cxx:95
P4SignalState
Definition: ISignalState.h:26
SignalStateHelper::~SignalStateHelper
~SignalStateHelper()
Destructor.
Definition: SignalStateHelper.cxx:55
SignalStateHelper.h
SignalStateConstHelper::resetSignalState
bool resetSignalState()
Reset the Signal State of the controlled object and use it for future operations.
Definition: SignalStateHelper.cxx:188
SignalStateHelper::setSignalState
bool setSignalState(P4SignalState::State s)
Change the signal state for future operations.
Definition: SignalStateHelper.cxx:71
SignalStateHelper::m_currentState
P4SignalState::State m_currentState
Definition: SignalStateHelper.h:55
SignalStateConstHelper::setSignalState
bool setSignalState(P4SignalState::State s)
Change the signal state for future operations.
Definition: SignalStateHelper.cxx:164
SignalStateHelper::releaseObject
bool releaseObject()
Release controled object (this resets its signal state)
Definition: SignalStateHelper.cxx:83
SignalStateHelper::controlObject
bool controlObject(ISignalState *theObject)
Change the object controlled, this releases previous object and resets its SigState.
Definition: SignalStateHelper.cxx:61
P4SignalState::State
State
Definition: ISignalState.h:28
SignalStateConstHelper::SignalStateConstHelper
SignalStateConstHelper()
Empty Constructor.
Definition: SignalStateHelper.cxx:114
ISignalState::setSignalState
virtual bool setSignalState(P4SignalState::State s)=0
set the current signal state
SignalStateHelper::m_originalState
P4SignalState::State m_originalState
Storage of the states.
Definition: SignalStateHelper.h:54
SignalStateConstHelper::m_originalState
P4SignalState::State m_originalState
Storage of the states.
Definition: SignalStateHelper.h:104
SignalStateConstHelper::m_object
ISignalState * m_object
Pointer to the owned object.
Definition: SignalStateHelper.h:108
SignalStateHelper::m_object
ISignalState * m_object
Pointer to the owned object.
Definition: SignalStateHelper.h:58
SignalStateHelper::SignalStateHelper
SignalStateHelper()
Empty Constructor.
Definition: SignalStateHelper.cxx:21