CMS 3D CMS Logo

Nodes.h

Go to the documentation of this file.
00001 #ifndef ParameterSet_Nodes_h
00002 #define ParameterSet_Nodes_h
00003 
00004 /*
00005   The parser output is a tree of Nodes containing unprocessed strings.
00006 
00007   Ownership rule: Objects passed by pointer into constructors are owned
00008   by the newly created object (defined by the classes below).  In other
00009   words ownership is transferred to these objects.  Furthermore, all
00010   object lifetimes are managed using boost share_ptr.
00011 
00012   The name method needs to be stripped out.  They are not useful
00013 */
00014 
00015 #include "FWCore/ParameterSet/interface/CompositeNode.h"
00016 #include "FWCore/ParameterSet/interface/Node.h"
00017 
00018 namespace edm {
00019   namespace pset {
00020 
00021 
00022     /*
00023       -----------------------------------------
00024       Usings hold: using
00025     */
00026 
00027     class UsingNode : public Node
00028     {
00029     public:
00030       explicit UsingNode(const std::string& name,int line=-1);
00031       virtual Node * clone() const { return new UsingNode(*this);}
00032       virtual std::string type() const;
00033       virtual void print(std::ostream& ost, PrintOptions options) const;
00034       virtual void accept(Visitor& v) const;
00035     };
00036 
00037 
00038 
00039     /*
00040      ------------------------------------------
00041      Rename: change the name to a module.  Old name no longer valid
00042     */
00043 
00044     class RenameNode : public Node
00045     {
00046     public:
00047       RenameNode(const std::string & type, const std::string& from,
00048                  const std::string & to, int line=-1)
00049       : Node(type, line), from_(from), to_(to) {}
00050       virtual Node * clone() const { return new RenameNode(*this);}
00051       virtual std::string type() const {return "rename";}
00052       virtual std::string from() const {return from_;}
00053       virtual std::string to() const {return to_;}
00054       virtual void print(std::ostream& ost, PrintOptions options) const;
00055       virtual void accept(Visitor& v) const;
00056                                                                                                           
00057     private:
00058       std::string from_;
00059       std::string to_;
00060     };
00061 
00062  
00063 
00064     /*
00065      ------------------------------------------
00066       CopyNode:  deep-copies an entire named node
00067     */
00068 
00069     class CopyNode : public Node
00070     {
00071     public:
00072       CopyNode(const std::string & type, const std::string& from,
00073                  const std::string & to, int line=-1)
00074       : Node(type, line), from_(from), to_(to) {}
00075       virtual Node * clone() const { return new CopyNode(*this);}
00076       virtual std::string type() const {return "copy";}
00077       virtual std::string from() const {return from_;}
00078       virtual std::string to() const {return to_;}
00079       virtual void print(std::ostream& ost, PrintOptions options) const;
00080       virtual void accept(Visitor& v) const;
00081                                                                                                     
00082     private:
00083       std::string from_;
00084       std::string to_;
00085     };
00086 
00087 
00088 
00089     /*
00090       -----------------------------------------
00091       Strings hold: a value without a name (used within VPSet)
00092     */
00093 
00094     class StringNode : public Node
00095     {
00096     public:
00097       explicit StringNode(const std::string& value, int line=-1);
00098       virtual Node * clone() const { return new StringNode(*this);}
00099       virtual std::string type() const;
00100       virtual std::string value() const {return value_;}
00101       virtual void print(std::ostream& ost, PrintOptions options) const;
00102       virtual void accept(Visitor& v) const;
00103 
00104     private:
00105       std::string value_;
00106     };
00107 
00108 
00109     /*
00110       -----------------------------------------
00111       Contents hold: Nodes
00112     */
00113 
00114     class ContentsNode : public CompositeNode
00115     {
00116     public:
00117       explicit ContentsNode(NodePtrListPtr value, int line=-1);
00118       virtual Node * clone() const { return new ContentsNode(*this);}
00119       virtual std::string type() const;
00120       virtual void accept(Visitor& v) const;
00121     };
00122 
00123     typedef boost::shared_ptr<ContentsNode> ContentsNodePtr;
00124 
00125   }
00126 }
00127 #endif

Generated on Tue Jun 9 17:36:25 2009 for CMSSW by  doxygen 1.5.4