00001 /* 00002 * Component.cpp 00003 * 00004 * Created on: 21.04.2010 00005 * Author: morgenro 00006 */ 00007 00008 #include "Component.h" 00009 #include <ibrcommon/thread/MutexLock.h> 00010 00011 namespace dtn 00012 { 00013 namespace daemon 00014 { 00015 Component::~Component() 00016 { 00017 } 00018 00019 IndependentComponent::IndependentComponent() 00020 : _running(false) 00021 { 00022 } 00023 00024 IndependentComponent::~IndependentComponent() 00025 { 00026 join(); 00027 } 00028 00029 bool IndependentComponent::isRunning() 00030 { 00031 ibrcommon::MutexLock l(_running_lock); 00032 return _running; 00033 } 00034 00035 void IndependentComponent::initialize() 00036 { 00037 componentUp(); 00038 } 00039 00040 void IndependentComponent::startup() 00041 { 00042 ibrcommon::MutexLock l(_running_lock); 00043 _running = true; 00044 00045 this->start(); 00046 } 00047 00048 void IndependentComponent::terminate() 00049 { 00050 { 00051 ibrcommon::MutexLock l(_running_lock); 00052 _running = false; 00053 } 00054 00055 componentDown(); 00056 } 00057 00058 void IndependentComponent::run() 00059 { 00060 componentRun(); 00061 00062 ibrcommon::MutexLock l(_running_lock); 00063 _running = false; 00064 } 00065 00066 IntegratedComponent::IntegratedComponent() 00067 { 00068 } 00069 00070 IntegratedComponent::~IntegratedComponent() 00071 { 00072 } 00073 00074 void IntegratedComponent::initialize() 00075 { 00076 componentUp(); 00077 } 00078 00079 void IntegratedComponent::startup() 00080 { 00081 // nothing to do 00082 } 00083 00084 void IntegratedComponent::terminate() 00085 { 00086 componentDown(); 00087 } 00088 } 00089 }
1.6.3