IBR-DTNSuite  0.8
daemon/src/Component.h
Go to the documentation of this file.
00001 /*
00002  * Component.h
00003  *
00004  *  Created on: 21.04.2010
00005  *      Author: morgenro
00006  */
00007 
00008 #ifndef COMPONENT_H_
00009 #define COMPONENT_H_
00010 
00011 #include <ibrcommon/thread/Thread.h>
00012 #include <ibrcommon/thread/Mutex.h>
00013 
00014 namespace dtn
00015 {
00016         namespace daemon
00017         {
00018                 class Component
00019                 {
00020                 public:
00026                         virtual ~Component() = 0;
00027 
00032                         virtual void initialize() = 0;
00033 
00038                         virtual void startup() = 0;
00039 
00044                         virtual void terminate() = 0;
00045 
00050                         virtual const std::string getName() const = 0;
00051                 };
00052 
00056                 class IndependentComponent : public Component, protected ibrcommon::JoinableThread
00057                 {
00058                 public:
00059                         IndependentComponent();
00060                         virtual ~IndependentComponent();
00061 
00062                         virtual void initialize();
00063                         virtual void startup();
00064                         virtual void terminate();
00065 
00066                 protected:
00067                         void run();
00068                         virtual void __cancellation() = 0;
00069 
00070                         virtual void componentUp() = 0;
00071                         virtual void componentRun() = 0;
00072                         virtual void componentDown() = 0;
00073                 };
00074 
00075                 class IntegratedComponent : public Component
00076                 {
00077                 public:
00078                         IntegratedComponent();
00079                         virtual ~IntegratedComponent();
00080 
00081                         virtual void initialize();
00082                         virtual void startup();
00083                         virtual void terminate();
00084 
00085                 protected:
00086                         virtual void componentUp() = 0;
00087                         virtual void componentDown() = 0;
00088                 };
00089         }
00090 }
00091 
00092 #endif /* COMPONENT_H_ */