IBR-DTNSuite  0.10
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"
24 #include <ibrcommon/Logger.h>
25 
26 namespace dtn
27 {
28  namespace daemon
29  {
31  {
32  }
33 
35  {
36  }
37 
39  {
40  join();
41  }
42 
44  {
45  // reset thread is necessary
46  if (JoinableThread::isFinalized()) JoinableThread::reset();
47 
48  componentUp();
49  }
50 
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 
61  {
62  componentDown();
63  JoinableThread::stop();
64  }
65 
66  void IndependentComponent::run() throw ()
67  {
68  componentRun();
69  }
70 
72  {
73  }
74 
76  {
77  }
78 
80  {
81  componentUp();
82  }
83 
85  {
86  // nothing to do
87  }
88 
90  {
91  componentDown();
92  }
93  }
94 }