00001 // -*- C++ -*- 00002 // 00003 // Package: Core 00004 // Class : CmsShowTaskExecutorBase 00005 // 00006 // Implementation: 00007 // <Notes on implementation> 00008 // 00009 // Original Author: Chris Jones 00010 // Created: Fri Jul 11 12:09:41 EDT 2008 00011 // $Id: CmsShowTaskExecutorBase.cc,v 1.6 2009/01/23 21:35:42 amraktad Exp $ 00012 // 00013 00014 // system include files 00015 #include <iostream> 00016 #include <TTimer.h> 00017 00018 // user include files 00019 #include "Fireworks/Core/src/CmsShowTaskExecutorBase.h" 00020 #include "Fireworks/Core/src/CmsShowTaskTimer.h" 00021 00022 // 00023 // constants, enums and typedefs 00024 // 00025 00026 // 00027 // static data member definitions 00028 // 00029 00030 // 00031 // constructors and destructor 00032 // 00033 CmsShowTaskExecutorBase::CmsShowTaskExecutorBase() 00034 //:m_timer( new TTimer(1) ) 00035 { 00036 //m_timer->Connect("Timeout()","CmsShowTaskExecutorBase",this,"doNextTask()"); 00037 m_taskTimer = new CmsShowTaskTimer(this, 10); 00038 } 00039 00040 // CmsShowTaskExecutorBase::CmsShowTaskExecutorBase(const CmsShowTaskExecutorBase& rhs) 00041 // { 00042 // // do actual copying here; 00043 // } 00044 00045 CmsShowTaskExecutorBase::~CmsShowTaskExecutorBase() 00046 { 00047 //delete m_timer; 00048 } 00049 00050 // 00051 // assignment operators 00052 // 00053 // const CmsShowTaskExecutorBase& CmsShowTaskExecutorBase::operator=(const CmsShowTaskExecutorBase& rhs) 00054 // { 00055 // //An exception safe implementation is 00056 // CmsShowTaskExecutorBase temp(rhs); 00057 // swap(rhs); 00058 // 00059 // return *this; 00060 // } 00061 00062 // 00063 // member functions 00064 // 00065 void 00066 CmsShowTaskExecutorBase::requestNextTask() 00067 { 00068 //NOTE: If I use my own timer then the first time I call Start it works but the second 00069 // time causes a segmentation fault 00070 00071 //Emit("requestNextTask()"); 00072 //m_timer->Start(1,kTRUE); 00073 //std::cout <<"requestNextTask"<<std::endl; 00074 m_taskTimer->TurnOn(); 00075 } 00076 00077 void 00078 CmsShowTaskExecutorBase::doNextTask() 00079 { 00080 m_taskTimer->TurnOff(); 00081 doNextTaskImp(); 00082 if(moreTasksAvailable()) { 00083 requestNextTask(); 00084 } 00085 else { 00086 tasksCompleted_.emit(); 00087 } 00088 } 00089 00090 // 00091 // const member functions 00092 // 00093 00094 // 00095 // static member functions 00096 //