#include <nodeBuilder.h>
Inheritance diagram for jobc::nodeBuilder:

Public Member Functions | |
| nodeBuilder (const char *tag) | |
| void | Build (const xmli::AttributeList &attr, const std::string &buffer) |
|
|
Definition at line 24 of file nodeBuilder.cxx.
00024 : xmli::Builder(tag) { } |
|
||||||||||||
|
Builders must implement this method which constructs a C++ object from XML attributes
Implements xmli::Builder. Definition at line 28 of file nodeBuilder.cxx. References jobc::Node::ActivateAna(), jobc::Node::ActivateReco(), xmli::AttributeList, xmli::Stack< T >::Instance(), xmli::ChString::IsFalse(), xmli::ChString::IsTrue(), jobc::Node::ReverseFilter(), and jobc::Node::SetFilter().
00030 {
00031 //======================================================================
00032 // Handle the link tag.
00033 //
00034 // At the end of the tag, parse each of the files listed in "buffer"
00035 //======================================================================
00036 std::string sequence("");
00037 std::string module("");
00038 std::string config;
00039 std::string reco;
00040 std::string ana;
00041 std::string filter;
00042
00043 xmli::AttributeList::const_iterator itr ( attr.begin() );
00044 xmli::AttributeList::const_iterator itrEnd( attr.end() );
00045 for (; itr!=itrEnd; ++itr) {
00046 std::string n = itr->Name();
00047 std::string v = itr->Value();
00048 if (n=="module") { module = v; continue; }
00049 if (n=="sequence") { sequence = v; continue; }
00050 if (n=="config") { config = v; continue; }
00051 if (n=="reco") { reco = v; continue; }
00052 if (n=="ana") { ana = v; continue; }
00053 if (n=="filter") { filter = v; continue; }
00054 std::cerr << "jobc::nodeBuilder:" << __LINE__
00055 << " Bad attribute for <node>=" << n
00056 << "=" << v << std::endl;
00057 exit(1);
00058 }
00059
00060 // Must have module or sequence tag, but not both
00061 bool haveMod = (module !="");
00062 bool haveSeq = (sequence!="");
00063 if ( haveMod && haveSeq) abort();
00064 if (!haveMod && !haveSeq) abort();
00065
00066 Node* n = 0;
00067 Sequence* s = 0;
00068 if (haveSeq) {
00069 Sequence* stb = 0;
00070 stb = SeqTable::Instance().Find(sequence.c_str());
00071 if (stb==0) abort();
00072 s = new Sequence(*stb);
00073 n = s;
00074 }
00075 if (haveMod) {
00076 n = new Node(module.c_str(), config.c_str());
00077 }
00078
00079 // Set the activity of the reco and ana methods
00080 if (xmli::ChString::IsTrue (reco)) n->ActivateReco(true);
00081 if (xmli::ChString::IsFalse(reco)) n->ActivateReco(false);
00082 if (xmli::ChString::IsTrue (ana)) n->ActivateAna(true);
00083 if (xmli::ChString::IsFalse(ana)) n->ActivateAna(false);
00084
00085 // Set the activity of the filter
00086 if (xmli::ChString::IsTrue(filter)) n->SetFilter(true);
00087 if (xmli::ChString::IsFalse(filter)) n->SetFilter(false);
00088 if (filter == "reverse") n->ReverseFilter();
00089 if (filter == "Reverse") n->ReverseFilter();
00090 if (filter == "REVERSE") n->ReverseFilter();
00091
00092 xmli::Stack<Node*>::Instance().push(n);
00093 }
|
1.3.5