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

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

#include <SignalStateHelper.h>

Collaboration diagram for SignalStateHelper:

Public Member Functions

 SignalStateHelper ()
 Empty Constructor.
 SignalStateHelper (ISignalState *theObject)
 Constructor with initialization.
 SignalStateHelper (P4SignalState::State s)
 SignalStateHelper (ISignalState *theObject, P4SignalState::State s)
 ~SignalStateHelper ()
 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 (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 24 of file SignalStateHelper.h.

Constructor & Destructor Documentation

◆ SignalStateHelper() [1/4]

SignalStateHelper::SignalStateHelper ( )

Empty Constructor.

Definition at line 21 of file SignalStateHelper.cxx.

21 :
24 m_object(0)
25{}
ISignalState * m_object
Pointer to the owned object.
P4SignalState::State m_originalState
Storage of the states.
P4SignalState::State m_currentState

◆ SignalStateHelper() [2/4]

SignalStateHelper::SignalStateHelper ( ISignalState * theObject)

Constructor with initialization.

Definition at line 28 of file SignalStateHelper.cxx.

28 :
31 m_object(0)
32{
33 controlObject(theObject);
34}
bool controlObject(ISignalState *theObject)
Change the object controlled, this releases previous object and resets its SigState.

◆ SignalStateHelper() [3/4]

SignalStateHelper::SignalStateHelper ( P4SignalState::State s)

Definition at line 36 of file SignalStateHelper.cxx.

36 :
39 m_object(0)
40{
42}
bool setSignalState(P4SignalState::State s)
Change the signal state for future operations.

◆ SignalStateHelper() [4/4]

SignalStateHelper::SignalStateHelper ( ISignalState * theObject,
P4SignalState::State s )

Definition at line 44 of file SignalStateHelper.cxx.

44 :
47 m_object(theObject)
48{
49 if( theObject != NULL ){
50 m_originalState = theObject->signalState();
51 m_object->setSignalState(m_currentState);
52 }
53}
virtual P4SignalState::State signalState() const =0
obtain the current signal state

◆ ~SignalStateHelper()

SignalStateHelper::~SignalStateHelper ( )

Destructor.

Definition at line 55 of file SignalStateHelper.cxx.

56{
58}
bool releaseObject()
Release controled object (this resets its signal state)

Member Function Documentation

◆ controlObject()

bool SignalStateHelper::controlObject ( ISignalState * theObject)

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

Change the object controlled.

Definition at line 61 of file SignalStateHelper.cxx.

62{
64 m_originalState = theObject->signalState();
65 m_object = theObject;
67 m_object->setSignalState(m_currentState);
68 return true;
69}

◆ releaseObject()

bool SignalStateHelper::releaseObject ( )

Release controled object (this resets its signal state)

Definition at line 83 of file SignalStateHelper.cxx.

84{
85 // If we have an object attached, revert and remove
86 if(m_object!=0)
87 {
88 m_object->setSignalState(m_originalState);
89 m_object=0;
90 return true;
91 }
92 return false;
93}

◆ resetSignalState()

bool SignalStateHelper::resetSignalState ( )

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

Definition at line 95 of file SignalStateHelper.cxx.

96{
97 if(m_object!=0)
98 {
100 m_object->setSignalState(m_originalState);
101 return true;
102 }
103 return false;
104}

◆ setSignalState()

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

Change the signal state for future operations.

Definition at line 71 of file SignalStateHelper.cxx.

72{
74 // If we do have an object attached, switch its signal state
76 {
77 m_object->setSignalState(m_currentState);
78 return true;
79 }
80 return false;
81}

Member Data Documentation

◆ m_currentState

P4SignalState::State SignalStateHelper::m_currentState
protected

Definition at line 55 of file SignalStateHelper.h.

◆ m_object

ISignalState* SignalStateHelper::m_object
protected

Pointer to the owned object.

Definition at line 58 of file SignalStateHelper.h.

◆ m_originalState

P4SignalState::State SignalStateHelper::m_originalState
protected

Storage of the states.

Definition at line 54 of file SignalStateHelper.h.


The documentation for this class was generated from the following files: