Belle II Software  release-08-01-10
ProcessingSignalListener.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include <tracking/trackFindingCDC/utilities/ProcessingSignalListener.h>
9 
10 #include <tracking/trackFindingCDC/utilities/Backtrace.h>
11 
12 #include <framework/logging/Logger.h>
13 
14 #include <typeinfo>
15 
16 using namespace Belle2;
17 using namespace TrackFindingCDC;
18 
20 
22 {
23  if (m_initialized) {
24  B2DEBUG(20, "Processing signal listener " << m_initializedAs << " was not terminated after initialization");
25  }
26 }
27 
29 {
30  if (m_initialized) {
31  B2DEBUG(20, typeid(*this).name() << " has been initialized before");
32  printBacktrace(LogConfig::c_Debug, 10);
33  }
34  m_initializedAs = typeid(*this).name();
35  m_initialized = true;
36 }
37 
39 {
40  if (not m_initialized) {
41  B2DEBUG(20, typeid(*this).name() << " was not initialized");
42  }
43 }
44 
46 {
47  if (not m_initialized) {
48  B2DEBUG(20, typeid(*this).name() << " was not initialized");
49  }
50 }
51 
53 {
54  if (not m_initialized) {
55  B2DEBUG(20, typeid(*this).name() << " was not initialized");
56  }
57 }
58 
60 {
61  if (m_terminated) {
62  B2DEBUG(20, typeid(*this).name() << " has been terminated before");
63  printBacktrace(LogConfig::c_Debug, 10);
64  }
65  m_terminated = true;
66 
67  if (not m_initialized) {
68  B2DEBUG(20, typeid(*this).name() << " was not initialized before termination");
69  printBacktrace(LogConfig::c_Debug, 10);
70  }
71  m_initialized = false;
72 }
@ c_Debug
Debug: for code development.
Definition: LogConfig.h:26
virtual void beginEvent()
Receive signal for the start of a new event.
virtual void initialize()
Receive signal before the start of the event processing.
virtual void beginRun()
Receive signal for the beginning of a new run.
bool m_initialized
Flag to keep track whether initialization happend before.
ProcessingSignalListener()
Allow default construction.
std::string m_initializedAs
Name of the type during initialisation.
virtual void terminate()
Receive Signal for termination of the event processing.
virtual void endRun()
Receive signal for the end of the run.
virtual ~ProcessingSignalListener()
Make destructor of interface virtual.
bool m_terminated
Flag to keep track whether termination happend before.
Abstract base class for different kinds of events.