00001 #include "FWCore/ParameterSet/interface/WrapperNode.h" 00002 #include "FWCore/ParameterSet/interface/ProcessDesc.h" 00003 #include "FWCore/ParameterSet/interface/Visitor.h" 00004 #include "FWCore/Utilities/interface/EDMException.h" 00005 00006 00007 namespace edm { 00008 namespace pset { 00009 00010 WrapperNode::WrapperNode(const std::string& type, const std::string& name, 00011 NodePtr w,int line): 00012 Node(name, line), 00013 type_(type), 00014 wrapped_(w) 00015 { } 00016 00017 std::string WrapperNode::type() const { return type_; } 00018 00019 00020 Node * WrapperNode::clone() const 00021 { 00022 // deep-copy wrapped 00023 WrapperNode * newNode = new WrapperNode(*this); 00024 newNode->wrapped_ = NodePtr( wrapped_->clone() ); 00025 newNode->wrapped_->setParent(newNode); 00026 return newNode; 00027 } 00028 00029 00030 bool WrapperNode::findChild(const std::string & childName, NodePtr & result) 00031 { 00032 bool found = false; 00033 // first check the wrapped node 00034 if(wrapped()->name() == childName) 00035 { 00036 result = wrapped(); 00037 found = true; 00038 } 00039 // be transparent. 00040 else 00041 { 00042 found = wrapped()->findChild(childName, result); 00043 } 00044 return found; 00045 } 00046 00047 00048 void WrapperNode::print(std::ostream& ost, Node::PrintOptions options) const 00049 { 00050 ost << type() << " " << name() << " = {\n" 00051 << wrapped_ 00052 << "\n}\n"; 00053 } 00054 00055 void WrapperNode::accept(Visitor& v) const 00056 { 00057 // we do not visit lower module here, the scheduler uses those 00058 v.visitWrapper(*this); 00059 } 00060 00061 00062 void WrapperNode::insertInto(edm::ProcessDesc & procDesc) const 00063 { 00064 boost::shared_ptr<WrapperNode> wrapperClone(new WrapperNode(*this)); 00065 procDesc.addPathFragment(wrapperClone); 00066 } 00067 00068 } 00069 } 00070