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

#include <SignalStateHelper.h>

Collaboration diagram for SignalStateHelper:

Public Member Functions

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

Constructor & Destructor Documentation

◆ SignalStateHelper() [1/4]

SignalStateHelper::SignalStateHelper ( )

Empty Constructor.

Definition at line 21 of file SignalStateHelper.cxx.

◆ 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 }

◆ SignalStateHelper() [3/4]

SignalStateHelper::SignalStateHelper ( P4SignalState::State  s)

Definition at line 36 of file SignalStateHelper.cxx.

36  :
39  m_object(0)
40 {
42 }

◆ 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();
52  }
53 }

◆ ~SignalStateHelper()

SignalStateHelper::~SignalStateHelper ( )

Destructor.

Definition at line 55 of file SignalStateHelper.cxx.

56 {
57  releaseObject();
58 }

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 {
63  releaseObject();
64  m_originalState = theObject->signalState();
65  m_object = theObject;
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  {
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  {
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 {
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 }

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:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
P4SignalState::UNKNOWN
@ UNKNOWN
Definition: ISignalState.h:29
ISignalState::signalState
virtual P4SignalState::State signalState() const =0
obtain the current signal state
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
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
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
SignalStateHelper::m_object
ISignalState * m_object
Pointer to the owned object.
Definition: SignalStateHelper.h:58