ATLAS Offline Software
Public Member Functions | Protected Attributes | List of all members
SignalStateConstHelper Class Referencefinal

#include <SignalStateHelper.h>

Collaboration diagram for SignalStateConstHelper:

Public Member Functions

 SignalStateConstHelper ()
 Empty Constructor. More...
 
 SignalStateConstHelper (const ISignalState *theObject)
 Constructor with initialization. More...
 
 SignalStateConstHelper (P4SignalState::State s)
 
 SignalStateConstHelper (const ISignalState *theObject, P4SignalState::State s)
 
 ~SignalStateConstHelper ()
 Destructor. More...
 
bool setSignalState (P4SignalState::State s)
 Change the signal state for future operations. More...
 
bool resetSignalState ()
 Reset the Signal State of the controlled object and use it for future operations. More...
 
bool controlObject (const ISignalState *theObject)
 Change the object controlled, this releases previous object and resets its SigState. More...
 
bool releaseObject ()
 Release controled object (this resets its signal state) More...
 

Protected Attributes

P4SignalState::State m_originalState
 Storage of the states. More...
 
P4SignalState::State m_currentState
 
ISignalStatem_object
 Pointer to the owned object. More...
 

Detailed Description

Simple helper class which allows "safe" signal state switching. As soon as the helper goes out of scope, the wrapped object is returned to its original SignalState.

Author
Pierre-Antoine Delsart <delsart AT in2p3.fr>
Pier-Olivier DeViveiros <viveiros AT physics.utoronto.ca>

Definition at line 74 of file SignalStateHelper.h.

Constructor & Destructor Documentation

◆ SignalStateConstHelper() [1/4]

SignalStateConstHelper::SignalStateConstHelper ( )

Empty Constructor.

Definition at line 114 of file SignalStateHelper.cxx.

◆ SignalStateConstHelper() [2/4]

SignalStateConstHelper::SignalStateConstHelper ( const ISignalState theObject)

Constructor with initialization.

Definition at line 121 of file SignalStateHelper.cxx.

121  :
124  m_object(0)
125 {
126  controlObject(theObject);
127 }

◆ SignalStateConstHelper() [3/4]

SignalStateConstHelper::SignalStateConstHelper ( P4SignalState::State  s)

Definition at line 129 of file SignalStateHelper.cxx.

129  :
131  m_currentState(s),
132  m_object(0)
133 {
134  setSignalState(s);
135 }

◆ SignalStateConstHelper() [4/4]

SignalStateConstHelper::SignalStateConstHelper ( const ISignalState theObject,
P4SignalState::State  s 
)

Definition at line 137 of file SignalStateHelper.cxx.

137  :
139  m_currentState(s),
140  m_object(const_cast<ISignalState*>(theObject))
141 {
142  if( theObject != NULL ){
143  m_originalState = theObject->signalState();
145  }
146 }

◆ ~SignalStateConstHelper()

SignalStateConstHelper::~SignalStateConstHelper ( )

Destructor.

Definition at line 148 of file SignalStateHelper.cxx.

149 {
150  releaseObject();
151 }

Member Function Documentation

◆ controlObject()

bool SignalStateConstHelper::controlObject ( const ISignalState theObject)

Change the object controlled, this releases previous object and resets its SigState.

Change the object controlled.

Definition at line 154 of file SignalStateHelper.cxx.

155 {
156  releaseObject();
157  m_originalState = theObject->signalState();
158  m_object = const_cast<ISignalState*>(theObject);
161  return true;
162 }

◆ releaseObject()

bool SignalStateConstHelper::releaseObject ( )

Release controled object (this resets its signal state)

Definition at line 176 of file SignalStateHelper.cxx.

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 }

◆ resetSignalState()

bool SignalStateConstHelper::resetSignalState ( )

Reset the Signal State of the controlled object and use it for future operations.

Definition at line 188 of file SignalStateHelper.cxx.

189 {
190  if(m_object!=0)
191  {
194  return true;
195  }
196  return false;
197 }

◆ setSignalState()

bool SignalStateConstHelper::setSignalState ( P4SignalState::State  s)

Change the signal state for future operations.

Definition at line 164 of file SignalStateHelper.cxx.

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 }

Member Data Documentation

◆ m_currentState

P4SignalState::State SignalStateConstHelper::m_currentState
protected

Definition at line 105 of file SignalStateHelper.h.

◆ m_object

ISignalState* SignalStateConstHelper::m_object
protected

Pointer to the owned object.

Definition at line 108 of file SignalStateHelper.h.

◆ m_originalState

P4SignalState::State SignalStateConstHelper::m_originalState
protected

Storage of the states.

Definition at line 104 of file SignalStateHelper.h.


The documentation for this class was generated from the following files:
SignalStateConstHelper::controlObject
bool controlObject(const ISignalState *theObject)
Change the object controlled, this releases previous object and resets its SigState.
Definition: SignalStateHelper.cxx:154
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
SignalStateConstHelper::setSignalState
bool setSignalState(P4SignalState::State s)
Change the signal state for future operations.
Definition: SignalStateHelper.cxx:164
ISignalState::setSignalState
virtual bool setSignalState(P4SignalState::State s)=0
set the current signal state
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