IBR-DTNSuite  0.10
Component.h
Go to the documentation of this file.
1 /*
2  * Component.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 COMPONENT_H_
23 #define COMPONENT_H_
24 
26 #include <ibrcommon/thread/Mutex.h>
27 
28 namespace dtn
29 {
30  namespace daemon
31  {
32  class Component
33  {
34  public:
40  virtual ~Component() = 0;
41 
46  virtual void initialize() throw () = 0;
47 
52  virtual void startup() throw () = 0;
53 
58  virtual void terminate() throw () = 0;
59 
64  virtual const std::string getName() const = 0;
65  };
66 
71  {
72  public:
74  virtual ~IndependentComponent();
75 
76  virtual void initialize() throw ();
77  virtual void startup() throw ();
78  virtual void terminate() throw ();
79 
80  protected:
81  void run() throw ();
82 
88  virtual void __cancellation() throw () = 0;
89 
94  virtual void componentUp() throw () = 0;
95 
100  virtual void componentRun() throw () = 0;
101 
106  virtual void componentDown() throw () = 0;
107  };
108 
110  {
111  public:
113  virtual ~IntegratedComponent();
114 
115  virtual void initialize() throw ();
116  virtual void startup() throw ();
117  virtual void terminate() throw ();
118 
119  protected:
120  virtual void componentUp() throw () = 0;
121  virtual void componentDown() throw () = 0;
122  };
123  }
124 }
125 
126 #endif /* COMPONENT_H_ */