IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
EventDebugger.cpp
Go to the documentation of this file.
1
/*
2
* EventDebugger.cpp
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
#include "
core/EventDebugger.h
"
23
#include "
core/EventDispatcher.h
"
24
25
#include "
core/NodeEvent.h
"
26
#include "
core/CustodyEvent.h
"
27
#include "
core/BundleEvent.h
"
28
#include "
core/GlobalEvent.h
"
29
#include "
core/BundlePurgeEvent.h
"
30
#include "
core/BundleExpiredEvent.h
"
31
#include "
core/BundleGeneratedEvent.h
"
32
#include "
core/TimeAdjustmentEvent.h
"
33
34
#include "
net/ConnectionEvent.h
"
35
#include "
net/TransferAbortedEvent.h
"
36
#include "
net/TransferCompletedEvent.h
"
37
#include "
net/BundleReceivedEvent.h
"
38
39
#include "
routing/StaticRouteChangeEvent.h
"
40
#include "
routing/QueueBundleEvent.h
"
41
#include "
routing/RequeueBundleEvent.h
"
42
43
#include <
ibrcommon/Logger.h
>
44
#include <iostream>
45
46
namespace
dtn
47
{
48
namespace
core
49
{
50
EventDebugger::EventDebugger
()
51
{
52
}
53
54
EventDebugger::~EventDebugger
()
55
{
56
}
57
58
void
EventDebugger::componentUp
() throw ()
59
{
60
dtn::core::EventDispatcher<dtn::core::CustodyEvent>::add
(
this
);
61
dtn::core::EventDispatcher<dtn::core::BundleEvent>::add
(
this
);
62
dtn::core::EventDispatcher<dtn::core::NodeEvent>::add
(
this
);
63
dtn::core::EventDispatcher<dtn::core::GlobalEvent>::add
(
this
);
64
65
dtn::core::EventDispatcher<dtn::core::BundlePurgeEvent>::add
(
this
);
66
dtn::core::EventDispatcher<dtn::core::BundleExpiredEvent>::add
(
this
);
67
dtn::core::EventDispatcher<dtn::core::BundleGeneratedEvent>::add
(
this
);
68
dtn::core::EventDispatcher<dtn::core::TimeAdjustmentEvent>::add
(
this
);
69
70
dtn::core::EventDispatcher<dtn::net::ConnectionEvent>::add
(
this
);
71
dtn::core::EventDispatcher<dtn::net::TransferAbortedEvent>::add
(
this
);
72
dtn::core::EventDispatcher<dtn::net::TransferCompletedEvent>::add
(
this
);
73
dtn::core::EventDispatcher<dtn::net::BundleReceivedEvent>::add
(
this
);
74
75
dtn::core::EventDispatcher<dtn::routing::StaticRouteChangeEvent>::add
(
this
);
76
dtn::core::EventDispatcher<dtn::routing::QueueBundleEvent>::add
(
this
);
77
dtn::core::EventDispatcher<dtn::routing::RequeueBundleEvent>::add
(
this
);
78
84
}
85
86
void
EventDebugger::componentDown
() throw ()
87
{
88
dtn::core::EventDispatcher<dtn::core::CustodyEvent>::remove
(
this
);
89
dtn::core::EventDispatcher<dtn::core::BundleEvent>::remove
(
this
);
90
dtn::core::EventDispatcher<dtn::core::NodeEvent>::remove
(
this
);
91
dtn::core::EventDispatcher<dtn::core::GlobalEvent>::remove
(
this
);
92
93
dtn::core::EventDispatcher<dtn::core::BundlePurgeEvent>::remove
(
this
);
94
dtn::core::EventDispatcher<dtn::core::BundleExpiredEvent>::remove
(
this
);
95
dtn::core::EventDispatcher<dtn::core::BundleGeneratedEvent>::remove
(
this
);
96
dtn::core::EventDispatcher<dtn::core::TimeAdjustmentEvent>::remove
(
this
);
97
98
dtn::core::EventDispatcher<dtn::net::ConnectionEvent>::remove
(
this
);
99
dtn::core::EventDispatcher<dtn::net::TransferAbortedEvent>::remove
(
this
);
100
dtn::core::EventDispatcher<dtn::net::TransferCompletedEvent>::remove
(
this
);
101
dtn::core::EventDispatcher<dtn::net::BundleReceivedEvent>::remove
(
this
);
102
103
dtn::core::EventDispatcher<dtn::routing::StaticRouteChangeEvent>::remove
(
this
);
104
dtn::core::EventDispatcher<dtn::routing::QueueBundleEvent>::remove
(
this
);
105
dtn::core::EventDispatcher<dtn::routing::RequeueBundleEvent>::remove
(
this
);
106
}
107
108
void
EventDebugger::raiseEvent
(
const
dtn::core::Event
*evt)
throw
()
109
{
110
// print event
111
if
(evt->isLoggable())
112
{
113
IBRCOMMON_LOGGER_TAG
(evt->getName(),
notice
) << evt->getMessage() <<
IBRCOMMON_LOGGER_ENDL
;
114
}
115
}
116
117
const
std::string
EventDebugger::getName
()
const
118
{
119
return
"EventDebugger"
;
120
}
121
}
122
}
daemon
src
core
EventDebugger.cpp
Generated on Thu Mar 27 2014 09:26:20 for IBR-DTNSuite by
1.8.4