CGEM BOSS
6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
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>
9
class
SimpleEvent
:
public
ScheduledEvent
{
10
// A template class for simple events. The template parameter is the
11
// class which is the receiver, i.e the class which actually performs
12
// the operations.
13
// usage: Scheduler::instance()->schedule(time, new SimpleEvent<MyClass>(my_instance, &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),m_action(a)
23
//## end SimpleEvent::SimpleEvent%249491085.initialization
24
{
25
26
//## begin SimpleEvent::SimpleEvent%249491085.body preserve=yes
27
//## end SimpleEvent::SimpleEvent%249491085.body
28
}
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
private
:
42
Receiver* m_receiver;
43
Action
m_action;
44
std::string m_name;
45
46
};
47
48
template
<
class
Receiver>
inline
49
void
SimpleEvent<Receiver>::execute
(){
50
//## begin SimpleEvent::execute%478434479.body preserve=yes
51
if
(m_receiver) (m_receiver->*m_action)();
52
//## end SimpleEvent::execute%478434479.body
53
}
54
55
56
#endif
n
const Int_t n
Definition
DataBase/tau_mode.c:65
ScheduledEvent.h
Action
Definition
Adapter.h:80
ScheduledEvent
Definition
ScheduledEvent.h:11
ScheduledEvent::name
virtual std::string name() const
Definition
ScheduledEvent.cxx:13
SimpleEvent
Definition
SimpleEvent.h:9
SimpleEvent::SimpleEvent
SimpleEvent(Receiver *r, Action a, std::string n)
Definition
SimpleEvent.h:32
SimpleEvent::execute
virtual void execute()
Definition
SimpleEvent.h:49
SimpleEvent::SimpleEvent
SimpleEvent(Receiver *r, Action a)
Definition
SimpleEvent.h:20
SimpleEvent::name
virtual std::string name() const
Definition
SimpleEvent.h:38
6.6.5.i
Calibration
facilities
facilities-00-00-04
facilities
SimpleEvent.h
Generated by
1.12.0