BOSS
8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Calibration/facilities/include/facilities/SimpleEvent.h
Go to the documentation of this file.
1
//
2
#ifndef SIMPLEEVENT_H
3
#define SIMPLEEVENT_H
4
// ## begin module.includes preserve=yes
5
#include "
ScheduledEvent.h
"
6
7
// ## end module.includes preserve=yes
8
template
<
class
Receiver>
class
SimpleEvent
:
public
ScheduledEvent
{
9
// A template class for simple events. The template parameter is the
10
// class which is the receiver, i.e the class which actually performs
11
// the operations.
12
// usage: Scheduler::instance()->schedule(time, new SimpleEvent<MyClass>(my_instance,
13
// &MyClass::method));
14
public
:
15
// ## begin SimpleEvent.initialDeclarations preserve=yes
16
public
:
17
typedef
void ( Receiver::*
Action
)();
18
19
// ## end SimpleEvent.initialDeclarations
20
SimpleEvent
( Receiver* r,
Action
a )
21
// ## begin SimpleEvent::SimpleEvent%249491085.initialization preserve=yes
22
: m_receiver( r )
23
, m_action( a )
24
// ## end SimpleEvent::SimpleEvent%249491085.initialization
25
{
26
27
// ## begin SimpleEvent::SimpleEvent%249491085.body preserve=yes
28
// ## end SimpleEvent::SimpleEvent%249491085.body
29
};
30
// Constructor needs the receiver class and the method to invoke in that class
31
32
SimpleEvent
( Receiver* r,
Action
a, std::string
n
)
33
: m_receiver( r ), m_action( a ), m_name(
n
){};
34
35
virtual
void
execute
();
36
// All a command can do - tells the receiver to perform the action.
37
38
virtual
std::string
name
()
const
{
39
return
!m_name.empty() ? m_name :
ScheduledEvent::name
();
40
}
41
42
private
:
43
Receiver* m_receiver;
44
Action
m_action;
45
std::string m_name;
46
};
47
48
template
<
class
Receiver>
inline
void
SimpleEvent<Receiver>::execute
() {
49
// ## begin SimpleEvent::execute%478434479.body preserve=yes
50
if
( m_receiver ) ( m_receiver->*m_action )();
51
// ## end SimpleEvent::execute%478434479.body
52
}
53
54
#endif
ScheduledEvent.h
n
const Int_t n
Definition
DataBase/tau_mode.c:57
Action
Definition
Calibration/facilities/include/facilities/Adapter.h:72
ScheduledEvent::name
virtual std::string name() const
Definition
ScheduledEvent.cxx:11
ScheduledEvent::ScheduledEvent
ScheduledEvent()
Definition
Calibration/facilities/include/facilities/ScheduledEvent.h:22
SimpleEvent::SimpleEvent
SimpleEvent(Receiver *r, Action a, std::string n)
Definition
Calibration/facilities/include/facilities/SimpleEvent.h:32
SimpleEvent::execute
virtual void execute()
Definition
Calibration/facilities/include/facilities/SimpleEvent.h:48
SimpleEvent::Action
void(Receiver::* Action)()
Definition
Calibration/facilities/include/facilities/SimpleEvent.h:17
SimpleEvent::SimpleEvent
SimpleEvent(Receiver *r, Action a)
Definition
Calibration/facilities/include/facilities/SimpleEvent.h:20
SimpleEvent::name
virtual std::string name() const
Definition
Calibration/facilities/include/facilities/SimpleEvent.h:38
8.0.0
BOSS_Source
Calibration
facilities
include
facilities
SimpleEvent.h
Generated by
1.16.1