Anp::RunAlgStore Class Reference

#include <RunAlgStore.h>

Inheritance diagram for Anp::RunAlgStore:
Anp::AlgStore Anp::Base

List of all members.

Public Member Functions

 RunAlgStore ()
virtual ~RunAlgStore ()
bool Run (Record &record, TObject *ptr)
void Config (const Registry &reg)

Private Types

typedef std::vector
< Anp::AlgCaddy< Anp::AlgStore > > 
StoreVec

Private Member Functions

void Init ()

Private Attributes

bool fPrint
StoreVec fAlgVec
Anp::AlgCaddy< Anp::AlgStorefCount

Detailed Description

Definition at line 18 of file RunAlgStore.h.


Member Typedef Documentation

typedef std::vector<Anp::AlgCaddy<Anp::AlgStore> > Anp::RunAlgStore::StoreVec [private]

Definition at line 31 of file RunAlgStore.h.


Constructor & Destructor Documentation

Anp::RunAlgStore::RunAlgStore (  ) 

Definition at line 24 of file RunAlgStore.cxx.

00025    :fPrint(true)
00026 {
00027    fCount.name = "RunAlgStore";
00028 }

Anp::RunAlgStore::~RunAlgStore (  )  [virtual]

Definition at line 31 of file RunAlgStore.cxx.

References fAlgVec, fCount, fPrint, and Anp::AlgCaddy< T >::Print().

00032 {
00033    if(fPrint)
00034    {
00035       cout << "--------------------------------------------------------------------" << endl;
00036       fCount.Print(7, 7, "snarl");
00037       fAlgVec.clear();
00038       cout << "--------------------------------------------------------------------" << endl;
00039    }
00040 }


Member Function Documentation

void Anp::RunAlgStore::Config ( const Registry reg  )  [virtual]

Reimplemented from Anp::AlgStore.

Definition at line 73 of file RunAlgStore.cxx.

References fAlgVec, fPrint, Registry::Get(), it, Anp::AlgStore::Name(), Anp::Read(), UtilString::StringTok(), and Anp::Handle< T >::valid().

00074 { 
00075    //
00076    // Configure children algorithms
00077    //
00078 
00079    Anp::Read(reg, "RunAlgStorePrint", fPrint);
00080 
00081    const char *value = 0;
00082    vector<string> namelist;
00083 
00084    if(!reg.Get("AlgStoreList", value))
00085    {
00086       cerr << "RunAlgStore::Config - AlgStoreList Registry key doesn't exist" << endl;
00087       return;
00088    }
00089    else if(value)
00090    {
00091       UtilString::StringTok(namelist, string(value), ", ");
00092    }
00093 
00094    cout << endl;
00095    
00096    if(namelist.empty())
00097    {  
00098       cerr << "RunAlgStore::Config - could not determine AlgStoreList names" << endl;
00099    } 
00100    else if(fPrint)
00101    {
00102       cout << "RunAlgStore::Config - creating " << namelist.size() << " AlgStore algorithm(s)" << endl;
00103    }
00104 
00105    for(vector<string>::const_iterator it = namelist.begin(); it != namelist.end(); ++it)
00106    {
00107       AlgStorePtr alg = Factory<AlgStore>::Instance().Create(*it);
00108 
00109       if(alg.valid())
00110       {
00111          if(fPrint) cout << "   " << *it << endl;
00112 
00113          alg -> Name(*it);
00114 
00115          fAlgVec.push_back(AlgCaddy<AlgStore>(alg, *it));        
00116       }
00117       else
00118       {
00119          cerr << "RunAlgStore::Config - failed to create algorithm " << *it << endl;
00120       }
00121    }
00122    
00123    for(StoreVec::iterator it = fAlgVec.begin(); it != fAlgVec.end(); ++it)
00124    {
00125       it -> alg -> Config(reg);
00126    }
00127 }

void Anp::RunAlgStore::Init (  )  [private]
bool Anp::RunAlgStore::Run ( Record record,
TObject *  ptr 
) [virtual]

Implements Anp::AlgStore.

Definition at line 43 of file RunAlgStore.cxx.

References Anp::AlgCaddy< T >::AllSnarl(), fAlgVec, fCount, it, and Anp::AlgCaddy< T >::OutSnarl().

00044 {
00045    //
00046    // Run children algorithms
00047    //
00048 
00049    fCount.AllSnarl(record);
00050 
00051    for(StoreVec::iterator it = fAlgVec.begin(); it != fAlgVec.end(); ++it)
00052    {
00053       AlgStorePtr alg = it -> alg;
00054 
00055       it -> AllSnarl(record);
00056       
00057       if(alg -> Run(record, ptr))
00058       {
00059          it -> OutSnarl(record);
00060       }
00061       else
00062       {
00063          return false;
00064       }
00065    }
00066 
00067    fCount.OutSnarl(record);
00068 
00069    return true;
00070 }


Member Data Documentation

Definition at line 39 of file RunAlgStore.h.

Referenced by Config(), Run(), and ~RunAlgStore().

Reimplemented from Anp::Base.

Definition at line 41 of file RunAlgStore.h.

Referenced by Run(), and ~RunAlgStore().

bool Anp::RunAlgStore::fPrint [private]

Definition at line 37 of file RunAlgStore.h.

Referenced by Config(), and ~RunAlgStore().


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

Generated on 17 Jun 2018 for loon by  doxygen 1.6.1