JobCGraphVtx Class Reference

#include <JobCGraphVtx.h>

Inheritance diagram for JobCGraphVtx:
JobCPath

List of all members.

Public Member Functions

 JobCGraphVtx ()
virtual ~JobCGraphVtx ()
JobCGraphVtxGetAttached (unsigned int i) const
virtual bool EvalInput (JobCRecord *rec)=0
virtual void Attach (JobCGraphVtx *p)
virtual void Detach (JobCGraphVtx *p)
void EvaluateGraph (JobCRecord *rec)
void EvaluateNode (JobCRecord *rec)

Private Member Functions

void AddUpStream ()
void ReceiveNotification (bool passfail)
void SendNotification (bool passfail)
void InitGraphEvaluate ()
virtual void DerivedInitGraphEvaluate ()

Private Attributes

int fNupStream
int fNupStreamPassed
int fNupStreamFailed
vector< JobCGraphVtx * > fDownStream

Detailed Description

Definition at line 24 of file JobCGraphVtx.h.


Constructor & Destructor Documentation

JobCGraphVtx::JobCGraphVtx (  ) 

Definition at line 16 of file JobCGraphVtx.cxx.

00016                            : 
00017   fNupStream(0), fNupStreamPassed(0), fNupStreamFailed(0) 
00018 { }

virtual JobCGraphVtx::~JobCGraphVtx (  )  [inline, virtual]

Definition at line 28 of file JobCGraphVtx.h.

00028 { }


Member Function Documentation

void JobCGraphVtx::AddUpStream (  )  [private]

Definition at line 74 of file JobCGraphVtx.cxx.

References fNupStream.

Referenced by Attach().

00074 { ++fNupStream; }

void JobCGraphVtx::Attach ( JobCGraphVtx p  )  [virtual]

Definition at line 22 of file JobCGraphVtx.cxx.

References AddUpStream(), and fDownStream.

00023 {
00024   fDownStream.push_back(JobCGraphVtx);
00025   JobCGraphVtx->AddUpStream();
00026 }

virtual void JobCGraphVtx::DerivedInitGraphEvaluate (  )  [inline, private, virtual]

Definition at line 44 of file JobCGraphVtx.h.

Referenced by InitGraphEvaluate().

00044 { }

void JobCGraphVtx::Detach ( JobCGraphVtx p  )  [virtual]

Definition at line 30 of file JobCGraphVtx.cxx.

References Msg::kWarning, and MSG.

00031 {
00032   // not implemented
00033   MSG("JobC",Msg::kWarning) << "Detach not implemented.\n";
00034 }

virtual bool JobCGraphVtx::EvalInput ( JobCRecord rec  )  [pure virtual]

Implemented in JobCPath.

Referenced by EvaluateNode().

void JobCGraphVtx::EvaluateGraph ( JobCRecord rec  ) 

Definition at line 38 of file JobCGraphVtx.cxx.

References EvaluateNode(), and InitGraphEvaluate().

Referenced by JobCPath::Run().

00039 {
00040   this->InitGraphEvaluate();
00041   this->EvaluateNode(rec);
00042 }

void JobCGraphVtx::EvaluateNode ( JobCRecord rec  ) 

Definition at line 46 of file JobCGraphVtx.cxx.

References EvalInput(), fDownStream, fNupStream, fNupStreamFailed, fNupStreamPassed, and SendNotification().

Referenced by EvaluateGraph().

00047 {
00048   // If we have streams feeding into this JobCGraphVtx check their status
00049   if (fNupStream) {
00050     // If all upstream nodes have failed just propagate that
00051     // information down the line
00052     if (fNupStreamFailed == fNupStream) {
00053       this->SendNotification(false);
00054       return;
00055     }
00056     // Check if we're still waiting for upstream nodes to finish
00057     if ((fNupStreamFailed+fNupStreamPassed)<fNupStream) {
00058       return;
00059     }
00060   }
00061   
00062   // Evaluate this node
00063   bool passed = this->EvalInput(rec);
00064   if (fDownStream.size()>0) {
00065     this->SendNotification(passed);
00066     vector<JobCGraphVtx*>::iterator itr(fDownStream.begin());
00067     vector<JobCGraphVtx*>::iterator itrEnd(fDownStream.end());
00068     for (;itr!=itrEnd;++itr) (*itr)->EvaluateNode(rec);
00069   }
00070 }

JobCGraphVtx * JobCGraphVtx::GetAttached ( unsigned int  i  )  const

Definition at line 107 of file JobCGraphVtx.cxx.

References fDownStream.

Referenced by JobCPathConnectionHelper::BuildConnectionList(), JobCPath::Print(), and JobCPath::SetUniquePaths().

00108 { 
00109   //always true: assert(i>=0);
00110   if (i<fDownStream.size()) return fDownStream[i];
00111   return 0;
00112 }

void JobCGraphVtx::InitGraphEvaluate (  )  [private]

Definition at line 95 of file JobCGraphVtx.cxx.

References DerivedInitGraphEvaluate(), fDownStream, fNupStreamFailed, and fNupStreamPassed.

Referenced by EvaluateGraph().

00096 {
00097   fNupStreamPassed = 0;
00098   fNupStreamFailed = 0;
00099   this->DerivedInitGraphEvaluate();
00100   vector<JobCGraphVtx*>::iterator itr(fDownStream.begin());
00101   vector<JobCGraphVtx*>::iterator itrEnd(fDownStream.end());
00102   for (;itr!=itrEnd;++itr) (*itr)->InitGraphEvaluate();
00103 }

void JobCGraphVtx::ReceiveNotification ( bool  passfail  )  [private]

Definition at line 78 of file JobCGraphVtx.cxx.

References fNupStreamFailed, and fNupStreamPassed.

00079 {
00080   if (passfail) ++fNupStreamPassed;
00081   else          ++fNupStreamFailed;
00082 }

void JobCGraphVtx::SendNotification ( bool  passfail  )  [private]

Definition at line 86 of file JobCGraphVtx.cxx.

References fDownStream.

Referenced by EvaluateNode().

00087 {
00088   vector<JobCGraphVtx*>::iterator itr(fDownStream.begin());
00089   vector<JobCGraphVtx*>::iterator itrEnd(fDownStream.end());
00090   for (;itr!=itrEnd;++itr) (*itr)->ReceiveNotification(passfail);
00091 }


Member Data Documentation

Definition at line 49 of file JobCGraphVtx.h.

Referenced by Attach(), EvaluateNode(), GetAttached(), InitGraphEvaluate(), and SendNotification().

int JobCGraphVtx::fNupStream [private]

Definition at line 46 of file JobCGraphVtx.h.

Referenced by AddUpStream(), and EvaluateNode().

Definition at line 48 of file JobCGraphVtx.h.

Referenced by EvaluateNode(), InitGraphEvaluate(), and ReceiveNotification().

Definition at line 47 of file JobCGraphVtx.h.

Referenced by EvaluateNode(), InitGraphEvaluate(), and ReceiveNotification().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1