| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

StageProcessor.h

Go to the documentation of this file.
00001 
00013 #ifndef STAGEPROCESSOR
00014 #define STAGEPROCESSOR
00015 
00016 #include "Event/HeaderObject.h"
00017 #include "DybAlg/DybAlgorithm.h"
00018 
00019 #include "Stage/IStage.h"
00020 #include "Stage/IStageDataManager.h"
00021 
00022 #include <string>
00023 
00024 template <class HEADER>
00025 class StageProcessor : public DybAlgorithm<HEADER>
00026 {
00027 public:
00028     StageProcessor(const std::string& name, ISvcLocator* pSvcLocator);
00029 
00030     virtual ~StageProcessor();
00031     
00033     StatusCode initialize();
00034 
00035     StatusCode registerData(IStageData& data);
00036 
00037     IStage* thisStage() { return m_thisStage; }
00038     IStage* lowerStage() { return m_lowerStage; }
00039 
00040 private:
00041 
00042     std::string m_thisStageName;
00043     std::string m_lowerStageName;
00044 
00045     IStage* m_thisStage;
00046     IStage* m_lowerStage;
00047 
00048 
00049     IStageDataManager* m_sdmgr;
00050 };
00051 
00052 //#include "Stage/StageProcessorImp.h"
00053 
00054 template <class HEADER>
00055 StageProcessor<HEADER>::StageProcessor(const std::string& name, ISvcLocator* pSvcLocator)
00056     : DybAlgorithm<HEADER>(name,pSvcLocator)
00057 {
00058     declareProperty("ThisStageName",m_thisStageName = "", "Name of this stage");
00059     declareProperty("LowerStageName",m_lowerStageName = "", "Name of the lower stage");
00060 
00061     this->m_pullMode = true;
00062 }
00063 
00064 
00065 template <class HEADER>
00066 StageProcessor<HEADER>::~StageProcessor()
00067 {
00068 }
00069 
00070 template <class HEADER>
00071 StatusCode StageProcessor<HEADER>::initialize()
00072 {
00073     // infinite loop?
00074     StatusCode sc = DybAlgorithm<HEADER>::initialize();
00075     if (sc.isFailure()) return sc;
00076 
00077     // should probably make this configurable one day
00078     sc = this->service("StageDataManager",m_sdmgr);
00079     if (sc.isFailure()) return sc;
00080 
00081 
00082     this->debug() << "This Stage " <<m_thisStageName <<endreq;
00083     this->debug() << "Lower Stage " <<m_lowerStageName <<endreq;
00084 
00085     if ("" == m_thisStageName) {
00086         this->error() << "Not configured with a stage name" << endreq;
00087         return StatusCode::FAILURE;
00088     }
00089 
00090     sc = this->toolSvc()->retrieveTool("Stage",m_thisStageName,m_thisStage);
00091     if ( sc.isFailure() ) {
00092         this->error() << "Error retrieving the public tool" << endreq;
00093         return sc;
00094     }
00095 
00096     if ("" != m_lowerStageName) {
00097         sc= this->toolSvc()->retrieveTool("Stage",m_lowerStageName,m_lowerStage);
00098         if( sc.isFailure() ) {
00099             this->error() << "Error retrieving the public tool" << endreq;
00100             return StatusCode::FAILURE;
00101         }
00102     }
00103     return StatusCode::SUCCESS;
00104 }
00105 
00106 template <class HEADER>
00107 StatusCode StageProcessor<HEADER>::registerData(IStageData& data)
00108 {
00109     return m_sdmgr->registerData(this->Location(), data);
00110 }
00111 
00112 #endif  // STAGEPROCESSOR
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:36:09 2011 for Stage by doxygen 1.4.7