00001
00002
00003
00004
00005
00006
00008 #ifndef JOBCPATH_H
00009 #define JOBCPATH_H
00010 #ifndef STRING
00011 #include <string>
00012 #define STRING
00013 #endif
00014 #ifndef LIST
00015 #include <list>
00016 #define LIST
00017 #endif
00018 #ifndef __CINT__
00019 # ifdef SITE_HAS_SIGC
00020 # ifndef SIGNAL_H
00021 # include "sigc++/signal.h"
00022 # define SIGNAL_H
00023 # endif
00024 # endif
00025 #endif
00026 #ifndef JOBCRESULT_H
00027 #include "JobControl/JobCResult.h"
00028 #endif
00029 #ifndef JOBCGRAPHVTX_H
00030 #include "JobControl/JobCGraphVtx.h"
00031 #endif
00032 #ifndef JOBCNODE_H
00033 #include "JobControl/JobCNode.h"
00034 #endif
00035 #ifndef ROOT_Rtypes
00036 #if !defined(__CINT__) || defined(__MAKECINT__)
00037 #include "Rtypes.h"
00038 #endif
00039 #endif
00040
00041 class MomNavigator;
00042 class JobCModule;
00043 class JobCInputModule;
00044 class JobCNode;
00045
00046
00047 #define JOBCPATH_RUN_LIMIT (1000000000)
00048
00049 class JobCPath : public JobCGraphVtx
00050 {
00051 friend ostream& operator<<(ostream& os, const JobCPath& p);
00052 public:
00053 typedef enum ERunMode {
00054 kRunAll,
00055 kRunNin,
00056 kRunNpass,
00057 kRunNfail
00058 } RunMode_t;
00059
00060 typedef list<JobCModule*>::const_iterator ModuleIterator;
00061 typedef list<JobCNode*>::const_iterator NodeIterator;
00062
00063 public:
00064 JobCPath();
00065 JobCPath(const char *name, MomNavigator* mom, JobCInputModule* input);
00066 virtual ~JobCPath();
00067
00068 public:
00069
00070 JobCModule& Mod(const char *moduleName);
00071 JobCNode& Node(const char* nodeName);
00072 void Report();
00073 void Run(int n=JOBCPATH_RUN_LIMIT, RunMode_t mode=JobCPath::kRunNin);
00074 void RunNin(int n);
00075 void RunNpass(int n);
00076 void RunNfail(int n);
00077 void SetAllFilters(bool onOff);
00078 void ReverseAllFilters();
00079
00080 JobCResult LastResult() const { return fResult; }
00081
00082
00083 const char* GetName() const;
00084 void Print(ostream& os) const;
00085
00086 JobCModule* GetModule(const char* moduleName, bool create=false);
00087 JobCNode* FindNode(const char* module, const char* method);
00088 JobCInputModule* GetInputModule();
00089
00090 JobCNode* PushFront( const char *moduleName, const char *methodName);
00091 JobCNode* PushBack( const char *moduleName, const char *methodName);
00092 JobCNode* AddAt( const char *moduleName, const char *methodName, int n);
00093 JobCNode* AddBetween(const char *moduleName, const char *methodName,
00094 const char *afterNodeName, const char *beforeNodeName);
00095 void Remove( const char *moduleName, const char *methodName);
00096
00097
00098 void Attach(JobCGraphVtx *p);
00099 void Detach(JobCGraphVtx *p) ;
00100 bool EvalInput(JobCRecord* rec);
00101 JobCResult Execute(JobCRecord* rec);
00102 void BeginJob() const;
00103
00104 ModuleIterator GetModuleBegin() { return fModuleList.begin(); }
00105 ModuleIterator GetModuleEnd() { return fModuleList.end(); }
00106 NodeIterator GetNodeBegin() { return fNodeList.begin(); }
00107 NodeIterator GetNodeEnd() { return fNodeList.end(); }
00108 void HandleResult(const JobCResult& r) const;
00109 void SetRefreshMode(bool onOff) const;
00110
00111 #ifndef __CINT__
00112 #ifdef SITE_HAS_SIGC
00113 public:
00114
00115 typedef enum EUpdateCodes {
00116 kAddNode,
00117 kRemoveNode,
00118 kAddConnection,
00119 kRemoveConnection,
00120 kFilters,
00121 kGeneral
00122 } Update_t;
00123 SigC::Signal1<void,JobCPath*> SigDelete;
00124 SigC::Signal2<void,JobCPath*,JobCPath::Update_t> SigUpdate;
00125 SigC::Signal1<void,JobCPath*> SigStartRun;
00126 SigC::Signal1<void,JobCPath*> SigEndRun;
00127
00128
00129 void NodeUpdateCB(JobCNode* n, JobCNode::Update_t u);
00130 #endif
00131 private:
00132 public:
00133
00134
00135 JobCPath& operator= (const JobCPath&) { abort(); return *this; }
00136 #endif
00137
00138 private:
00139 bool AtJobStart() const;
00140 void CheckResult(const JobCResult& r);
00141 JobCNode* CreateNode(const char* modName, const char* metName);
00142 bool HandleError(const JobCResult& r, const JobCNode* n);
00143 static void PropagateResult(const JobCResult& r, JobCPath* p);
00144 void PropagateRefreshMode(bool onOff);
00145 void SetUniquePaths(const char* base="");
00146
00147 private:
00148 mutable bool fIsRefreshRun;
00149 mutable bool fAtJobStart;
00150 string fName;
00151 int fNin;
00152 int fNpass;
00153 int fNfail;
00154
00155 MomNavigator* fMom;
00156 JobCInputModule* fInput;
00157 list<JobCModule*> fModuleList;
00158 list<JobCNode*> fNodeList;
00159 JobCResult fResult;
00160
00161 mutable JobCModule* fDummyModule;
00162 mutable JobCNode* fDummyNode;
00163
00164 ClassDef(JobCPath,0)
00165 };
00166
00167 #endif // JOBCPATH_H