ATLAS Offline Software
Loading...
Searching...
No Matches
SignalStateConstHelper Class Referencefinal

Simple helper class which allows "safe" signal state switching. More...

#include <SignalStateHelper.h>

Collaboration diagram for SignalStateConstHelper:

Public Member Functions

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

Protected Attributes

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

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.

114 :
117 m_object(0)
118{}
ISignalState * m_object
Pointer to the owned object.
P4SignalState::State m_originalState
Storage of the states.
P4SignalState::State m_currentState

◆ 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}
bool controlObject(const ISignalState *theObject)
Change the object controlled, this releases previous object and resets its SigState.

◆ SignalStateConstHelper() [3/4]

SignalStateConstHelper::SignalStateConstHelper ( P4SignalState::State s)

Definition at line 129 of file SignalStateHelper.cxx.

129 :
132 m_object(0)
133{
135}
bool setSignalState(P4SignalState::State s)
Change the signal state for future operations.

◆ SignalStateConstHelper() [4/4]

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

Definition at line 137 of file SignalStateHelper.cxx.

137 :
140 m_object(const_cast<ISignalState*>(theObject))
141{
142 if( theObject != NULL ){
143 m_originalState = theObject->signalState();
144 m_object->setSignalState(m_currentState);
145 }
146}
virtual P4SignalState::State signalState() const =0
obtain the current signal state

◆ ~SignalStateConstHelper()

SignalStateConstHelper::~SignalStateConstHelper ( )

Destructor.

Definition at line 148 of file SignalStateHelper.cxx.

149{
151}
bool releaseObject()
Release controled object (this resets its signal state)

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{
157 m_originalState = theObject->signalState();
158 m_object = const_cast<ISignalState*>(theObject);
160 m_object->setSignalState(m_currentState);
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 {
181 m_object->setSignalState(m_originalState);
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 {
193 m_object->setSignalState(m_originalState);
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{
167 // If we do have an object attached, switch its signal state
169 {
170 m_object->setSignalState(m_currentState);
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: