IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
src
api
core
AbstractWorker.cpp
AbstractWorker.h
BundleCore.cpp
BundleCore.h
BundleEvent.cpp
BundleEvent.h
BundleExpiredEvent.cpp
BundleExpiredEvent.h
BundleGeneratedEvent.cpp
BundleGeneratedEvent.h
BundlePurgeEvent.cpp
BundlePurgeEvent.h
CustodyEvent.cpp
CustodyEvent.h
Event.cpp
Event.h
EventDebugger.cpp
EventDebugger.h
EventDispatcher.h
EventReceiver.cpp
EventReceiver.h
EventSwitch.cpp
EventSwitch.h
FragmentManager.cpp
FragmentManager.h
GlobalEvent.cpp
GlobalEvent.h
Node.cpp
Node.h
NodeEvent.cpp
NodeEvent.h
StatusReportGenerator.cpp
StatusReportGenerator.h
TimeAdjustmentEvent.cpp
TimeAdjustmentEvent.h
TimeEvent.cpp
TimeEvent.h
WallClock.cpp
WallClock.h
net
routing
security
storage
CapsuleWorker.cpp
CapsuleWorker.h
Component.cpp
Component.h
config.h
Configuration.cpp
Configuration.h
Debugger.cpp
Debugger.h
DevNull.cpp
DevNull.h
DTNTPWorker.cpp
DTNTPWorker.h
EchoWorker.cpp
EchoWorker.h
Main.cpp
NativeDaemon.cpp
NativeDaemon.h
NTService.cpp
ibrcommon
ibrdtn
tools
File Members
EventSwitch.h
Go to the documentation of this file.
1
/*
2
* EventSwitch.h
3
*
4
* Copyright (C) 2011 IBR, TU Braunschweig
5
*
6
* Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*
20
*/
21
22
#ifndef EVENTSWITCH_H_
23
#define EVENTSWITCH_H_
24
25
#include "
Component.h
"
26
#include "
core/Event.h
"
27
#include <
ibrcommon/Exceptions.h
>
28
#include <
ibrcommon/thread/Mutex.h
>
29
#include <
ibrcommon/thread/Conditional.h
>
30
31
#include <list>
32
#include <map>
33
34
namespace
dtn
35
{
36
namespace
core
37
{
38
class
EventReceiver;
39
40
class
EventSwitch
:
public
dtn::daemon::IntegratedComponent
41
{
42
private
:
43
EventSwitch
();
44
virtual
~
EventSwitch
();
45
46
bool
_running;
47
bool
_shutdown;
48
52
virtual
const
std::string getName()
const
;
53
54
class
Task
55
{
56
public
:
57
Task(
EventProcessor
&proc,
dtn::core::Event
*evt);
58
~Task();
59
60
EventProcessor
&processor;
61
dtn::core::Event
*event;
62
};
63
64
class
Worker
:
public
ibrcommon::JoinableThread
65
{
66
public
:
67
Worker
(
EventSwitch
&sw);
68
~
Worker
();
69
70
protected
:
71
void
run()
throw
();
72
virtual
void
__cancellation()
throw
();
73
74
private
:
75
EventSwitch
&_switch;
76
bool
_running
;
77
};
78
79
ibrcommon::Conditional
_queue_cond;
80
std::list<Task*> _queue;
81
std::list<Task*> _prio_queue;
82
std::list<Task*> _low_queue;
83
84
void
process();
85
86
protected
:
87
virtual
void
componentUp
()
throw
();
88
virtual
void
componentDown
()
throw
();
89
90
public
:
91
static
EventSwitch
&
getInstance
();
92
void
loop
(
size_t
threads = 0);
93
97
bool
empty
()
const
;
98
103
void
shutdown
();
104
109
static
void
queue
(
EventProcessor
&proc,
Event
*evt);
110
111
friend
class
Worker
;
112
};
113
}
114
}
115
116
#endif
/* EVENTSWITCH_H_ */
daemon
src
core
EventSwitch.h
Generated on Thu Mar 27 2014 09:26:20 for IBR-DTNSuite by
1.8.4