IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
Component.cpp
Go to the documentation of this file.
1
/*
2
* Component.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 "
Component.h
"
23
#include <
ibrcommon/thread/MutexLock.h
>
24
#include <
ibrcommon/Logger.h
>
25
26
namespace
dtn
27
{
28
namespace
daemon
29
{
30
Component::~Component
()
31
{
32
}
33
34
IndependentComponent::IndependentComponent
()
35
{
36
}
37
38
IndependentComponent::~IndependentComponent
()
39
{
40
join
();
41
}
42
43
void
IndependentComponent::initialize
() throw ()
44
{
45
// reset thread if necessary
46
if
(JoinableThread::isFinalized()) JoinableThread::reset();
47
48
componentUp
();
49
}
50
51
void
IndependentComponent::startup
() throw ()
52
{
53
try
{
54
JoinableThread::start();
55
}
catch
(
const
ibrcommon::ThreadException
&ex) {
56
IBRCOMMON_LOGGER_TAG
(
"IndependentComponent"
,
error
) << ex.
what
() <<
IBRCOMMON_LOGGER_ENDL
;
57
}
58
}
59
60
void
IndependentComponent::terminate
() throw ()
61
{
62
componentDown
();
63
JoinableThread::stop();
64
}
65
66
void
IndependentComponent::run
() throw ()
67
{
68
componentRun
();
69
}
70
71
IntegratedComponent::IntegratedComponent
()
72
{
73
}
74
75
IntegratedComponent::~IntegratedComponent
()
76
{
77
}
78
79
void
IntegratedComponent::initialize
() throw ()
80
{
81
componentUp
();
82
}
83
84
void
IntegratedComponent::startup
() throw ()
85
{
86
// nothing to do
87
}
88
89
void
IntegratedComponent::terminate
() throw ()
90
{
91
componentDown
();
92
}
93
}
94
}
daemon
src
Component.cpp
Generated on Thu Mar 27 2014 09:26:19 for IBR-DTNSuite by
1.8.4