JobCNode Class Reference

#include <JobCNode.h>

List of all members.

Public Member Functions

 JobCNode ()
 JobCNode (JobCModule *module, const JobCMethod *method)
virtual ~JobCNode ()
void FilterOn ()
void FilterOff ()
void ReverseFilter ()
JobCResult Execute (MomNavigator *mom)
bool MatchModuleMethod (const char *mod, const char *meth)
JobCMethod GetMethod () const
JobCModuleGetModule () const
void SetModule (JobCModule *module)
void SetMethod (JobCMethod *method)

Private Member Functions

JobCNodeoperator= (const JobCNode &)
void Init ()

Private Attributes

JobCModulefModule
const JobCMethodfMethod
bool fFilterActive
bool fFilterReverse
int fNin
int fNpass
int fNfail
long int fUserTime
long int fSystemTime

Friends

std::ostream & operator<< (std::ostream &os, const JobCNode &n)

Detailed Description

Definition at line 37 of file JobCNode.h.


Constructor & Destructor Documentation

JobCNode::JobCNode (  ) 

Definition at line 93 of file JobCNode.cxx.

References Init().

00094 {
00095 //======================================================================
00096 // Purpose: Create an empty node
00097 //======================================================================
00098   this->Init();
00099 }

JobCNode::JobCNode ( JobCModule module,
const JobCMethod method 
)

Definition at line 103 of file JobCNode.cxx.

References JobCMethod::Exists(), fMethod, fModule, Init(), Msg::kWarning, and MSG.

00104 {
00105 //======================================================================
00106 // Purpose: Create a node give a module and a method pair
00107 //
00108 // Inputs: module - the module to use
00109 //         method - the module's method to use
00110 //======================================================================
00111   this->Init();
00112 
00113   // Set the module and method for this node
00114   fModule = module;
00115   fMethod = method;
00116   
00117   // Make sure the module implementes this method
00118   if (fMethod->Exists(fModule) == false) {
00119     MSG("JobC", Msg::kWarning) 
00120       << "Module does not implement this method\n";
00121     fModule = 0;
00122     fMethod = 0;
00123     return;
00124   }
00125 }

JobCNode::~JobCNode (  )  [virtual]

Definition at line 129 of file JobCNode.cxx.

00129 {}


Member Function Documentation

JobCResult JobCNode::Execute ( MomNavigator mom  ) 

Definition at line 133 of file JobCNode.cxx.

References JobCMethod::Execute(), fFilterActive, fFilterReverse, fMethod, fModule, fNfail, fNin, fNpass, fSystemTime, and fUserTime.

00134 {
00135 //======================================================================
00136 // Purpose: Give this node a look at a data records
00137 //
00138 // Inputs: mom - the MINOS Object Map that holds the data to process
00139 //
00140 // Returns: Pass/Fail/No Decision depending on how the data record
00141 //          is evaluted by the module::method
00142 //======================================================================
00143   clock_t dummyt;    // Unused return variable
00144   struct tms t1;     // Times before execution of node
00145   struct tms t2;     // Times after execution of node
00146   JobCResult result; // Result of node
00147 
00148   // Evaluate the data record -- keep track of the time it takes...
00149   dummyt = times(&t1);
00150   result = fMethod->Execute(fModule, mom);
00151   dummyt = times(&t2);
00152 
00153   fUserTime   += (t2.tms_utime-t1.tms_utime);
00154   fSystemTime += (t2.tms_stime-t1.tms_stime);
00155 
00156   // If we've reached the end of input, return before accumulating
00157   // statistics
00158   if (result.EndOfInputStream()) return result;
00159 
00160   // Count records seen
00161   ++fNin;
00162 
00163   // Count records passed and failed at each node
00164   if (result.Failed()) {
00165     ++fNfail;
00166   } 
00167   else {
00168     // "No-decisions" and "Passed" count as pass
00169     ++fNpass;
00170   }
00171   
00172   // Determine return type
00173   if (fFilterActive) {
00174     if (fFilterReverse) {
00175       // Reverse the meaning of pass/fail
00176       if      (result.Passed()) result.SetFailed(); 
00177       else if (result.Failed()) result.SetPassed();
00178     }
00179   }
00180   else {
00181     // The filter is not active -- clear any pass/fail decisions
00182     result.ClearPassFail();
00183   }
00184 
00185   return result;
00186 }

void JobCNode::FilterOff (  ) 

Definition at line 268 of file JobCNode.cxx.

References fFilterActive.

Referenced by JobCPathHandler::PathFilterCommand().

00269 {
00270 //======================================================================
00271 // Purpose: Deactivate filtering on this node
00272 //======================================================================
00273   fFilterActive = false;
00274 #ifdef SITE_HAS_SIGC
00275   this->SigUpdate(this,JobCNode::kFilter);
00276 #endif
00277 }

void JobCNode::FilterOn (  ) 

Definition at line 255 of file JobCNode.cxx.

References fFilterActive.

Referenced by attach_blinded_output(), attach_mrcc_path_far(), attach_mrcc_path_near(), cosmic_set_filter(), far_all_configure_filters(), far_configure_filters(), far_spill_configure_filters(), merge_configure_filter(), near_configure_filter(), near_cosmic_set_filter(), JobCPathHandler::PathFilterCommand(), and spill_configure_filter().

00256 {
00257 //======================================================================
00258 // Purpose: Activate filtering on this node
00259 //======================================================================
00260   fFilterActive = true;
00261 #ifdef SITE_HAS_SIGC
00262   this->SigUpdate(this,JobCNode::kFilter);
00263 #endif
00264 }

JobCMethod JobCNode::GetMethod (  )  const

Definition at line 213 of file JobCNode.cxx.

References fMethod.

00214 {
00215 //======================================================================
00216 // Purpose: Return the method this node uses
00217 //======================================================================
00218   return (*fMethod);
00219 }

JobCModule * JobCNode::GetModule (  )  const

Definition at line 209 of file JobCNode.cxx.

References fModule.

Referenced by JobController::BuildSystemPath().

00209 { return fModule; }

void JobCNode::Init ( void   )  [private]

Definition at line 75 of file JobCNode.cxx.

References fFilterActive, fFilterReverse, fMethod, fModule, fNfail, fNin, fNpass, fSystemTime, and fUserTime.

Referenced by JobCNode().

00076 {
00077 //======================================================================
00078 // Purpose: Initialize this node
00079 //======================================================================
00080   fModule = 0;
00081   fMethod = 0;
00082   fFilterActive  = true;
00083   fFilterReverse = false;
00084   fNin   = 0;
00085   fNpass = 0;
00086   fNfail = 0;
00087   fUserTime   = 0l;
00088   fSystemTime = 0l;
00089 }

bool JobCNode::MatchModuleMethod ( const char *  mod,
const char *  meth 
)

Definition at line 190 of file JobCNode.cxx.

References fMethod, fModule, JobCModule::GetName(), and JobCMethod::GetName().

00191 {
00192 //======================================================================
00193 // Purpose: Check if this node matches a module::method pair
00194 //
00195 // Inputs: mod  - name of the module
00196 //         meth - name of the method
00197 //
00198 // Returns: true/false depending on if this node is a perfect match
00199 //======================================================================
00200   if (strcmp(mod ,fModule->GetName())==0 && 
00201       strcmp(meth,fMethod->GetName())==0) {
00202     return true;
00203   }
00204   return false;
00205 }

JobCNode& JobCNode::operator= ( const JobCNode  )  [inline, private]

Definition at line 73 of file JobCNode.h.

00073 { abort(); return *this; } // no assignment

void JobCNode::ReverseFilter (  ) 

Definition at line 281 of file JobCNode.cxx.

References fFilterActive, and fFilterReverse.

Referenced by cosmic_set_filter(), near_cosmic_set_filter(), and JobCPathHandler::PathFilterCommand().

00282 {
00283 //======================================================================
00284 // Purpose: Reverse the meaning of pass/fail for this node
00285 //======================================================================
00286   fFilterActive  = true;
00287   fFilterReverse = !fFilterReverse;
00288 #ifdef SITE_HAS_SIGC
00289   this->SigUpdate(this,JobCNode::kFilter);
00290 #endif
00291 }

void JobCNode::SetMethod ( JobCMethod method  ) 

Definition at line 239 of file JobCNode.cxx.

References fMethod, Msg::kError, and MSG.

00240 {
00241 //======================================================================
00242 // Purpose: Set the method this node should call
00243 //
00244 // Inputs: method - pointer to the method to use at this node
00245 //======================================================================
00246   fMethod = method;
00247   if (fMethod == 0) {
00248     MSG("JobC", Msg::kError) 
00249       << "Attempt to set NULL method.\n";
00250   }
00251 }

void JobCNode::SetModule ( JobCModule module  ) 

Definition at line 223 of file JobCNode.cxx.

References fModule, Msg::kError, and MSG.

00224 {
00225 //======================================================================
00226 // Purpose: Set the module this node should use
00227 //
00228 // Inputs: module - pointer to the job module to use at this node
00229 //======================================================================
00230   fModule = module;
00231   if (fModule == 0) {
00232     MSG("JobC", Msg::kError) 
00233       << "Attempt to set NULL module.\n";
00234   }
00235 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const JobCNode n 
) [friend]

Member Data Documentation

bool JobCNode::fFilterActive [private]

Definition at line 81 of file JobCNode.h.

Referenced by Execute(), FilterOff(), FilterOn(), Init(), and ReverseFilter().

bool JobCNode::fFilterReverse [private]

Definition at line 82 of file JobCNode.h.

Referenced by Execute(), Init(), and ReverseFilter().

const JobCMethod* JobCNode::fMethod [private]

Definition at line 80 of file JobCNode.h.

Referenced by Execute(), GetMethod(), Init(), JobCNode(), MatchModuleMethod(), and SetMethod().

Definition at line 79 of file JobCNode.h.

Referenced by Execute(), GetModule(), Init(), JobCNode(), MatchModuleMethod(), and SetModule().

int JobCNode::fNfail [private]

Definition at line 85 of file JobCNode.h.

Referenced by Execute(), and Init().

int JobCNode::fNin [private]

Definition at line 83 of file JobCNode.h.

Referenced by Execute(), and Init().

int JobCNode::fNpass [private]

Definition at line 84 of file JobCNode.h.

Referenced by Execute(), and Init().

long int JobCNode::fSystemTime [private]

Definition at line 87 of file JobCNode.h.

Referenced by Execute(), and Init().

long int JobCNode::fUserTime [private]

Definition at line 86 of file JobCNode.h.

Referenced by Execute(), and Init().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1