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 }; 00046 00050 class IndependentComponent : public Component, protected ibrcommon::JoinableThread 00051 { 00052 public: 00053 IndependentComponent(); 00054 virtual ~IndependentComponent(); 00055 00056 void initialize(); 00057 void startup(); 00058 void terminate(); 00059 00060 bool isRunning(); 00061 00062 protected: 00063 void run(); 00064 00065 virtual void componentUp() = 0; 00066 virtual void componentRun() = 0; 00067 virtual void componentDown() = 0; 00068 00069 private: 00070 ibrcommon::Mutex _running_lock; 00071 bool _running; 00072 }; 00073 00074 class IntegratedComponent : public Component 00075 { 00076 public: 00077 IntegratedComponent(); 00078 virtual ~IntegratedComponent(); 00079 00080 void initialize(); 00081 void startup(); 00082 void terminate(); 00083 00084 protected: 00085 virtual void componentUp() = 0; 00086 virtual void componentDown() = 0; 00087 }; 00088 } 00089 } 00090 00091 #endif /* COMPONENT_H_ */
1.6.3