CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/FWCore/ParameterSet/interface/ConfigurationDescriptions.h

Go to the documentation of this file.
00001 #ifndef FWCore_ParameterSet_ConfigurationDescriptions_h
00002 #define FWCore_ParameterSet_ConfigurationDescriptions_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     ParameterSet
00006 // Class  :     ConfigurationDescriptions
00007 // 
00013 //
00014 // Original Author:  W. David Dagenhart
00015 //         Created:  17 December 2008
00016 //
00017 
00018 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00019 
00020 #include <vector>
00021 #include <string>
00022 #include <utility>
00023 #include <iosfwd>
00024 
00025 namespace edm {
00026 
00027   class ConfigurationDescriptions {
00028   public:
00029     
00030     typedef std::vector<std::pair<std::string, ParameterSetDescription> >::iterator iterator;
00031     
00032     //NOTE: This does not take ownership of the PreValidatorBase instance so
00033     // this instance must remain valid for as long as the ConfigurationDescriptions
00034     // is being modified
00035     ConfigurationDescriptions(std::string const& baseType);
00036 
00037     ~ConfigurationDescriptions();
00038 
00039     // ---------------------------------------------------------
00040     // These functions are used by module developers to create
00041     // a description for a module.
00042     // ---------------------------------------------------------
00043 
00044     std::string const& comment() const { return comment_; }
00045     void setComment(std::string const & value);
00046     void setComment(char const* value);
00047 
00048     void add(std::string const& label, ParameterSetDescription const& psetDescription);
00049     void add(char const* label, ParameterSetDescription const& psetDescription);
00050 
00051     void addDefault(ParameterSetDescription const& psetDescription);
00052 
00054     ParameterSetDescription* defaultDescription();
00055     iterator begin();
00056     iterator end();
00057     
00058     // ---------------------------------------------------------
00059     // These functions use the information in the descriptions
00060     // ---------------------------------------------------------
00061 
00062     void validate(ParameterSet & pset, std::string const& moduleLabel) const;
00063 
00064     void writeCfis(std::string const& baseType,
00065                    std::string const& pluginName) const;
00066 
00067     void print(std::ostream & os,
00068                std::string const& moduleLabel,
00069                bool brief,
00070                bool printOnlyLabels,
00071                size_t lineWidth,
00072                int indentation,
00073                int iPlugin) const;
00074 
00075     // ---------------------------------------------------------
00076 
00077   private:
00078 
00079     class DescriptionCounter {
00080     public:
00081       int iPlugin;
00082       int iSelectedModule;
00083       int iModule;
00084     };
00085 
00086     static void writeCfiForLabel(std::pair<std::string, ParameterSetDescription> const& labelAndDesc,
00087                                  std::string const& baseType,
00088                                  std::string const& pluginName);
00089 
00090     void printForLabel(std::pair<std::string, ParameterSetDescription> const& labelAndDesc,
00091                        std::ostream & os,
00092                        std::string const& moduleLabel,
00093                        bool brief,
00094                        bool printOnlyLabels,
00095                        size_t lineWidth,
00096                        int indentationn,
00097                        DescriptionCounter & counter) const;
00098 
00099     void printForLabel(std::ostream & os,
00100                        std::string const& label,
00101                        ParameterSetDescription const& description,
00102                        std::string const& moduleLabel,
00103                        bool brief,
00104                        bool printOnlyLabels,
00105                        size_t lineWidth,
00106                        int indentationn,
00107                        DescriptionCounter & counter) const;
00108 
00109     std::string baseType_;
00110 
00111     std::vector<std::pair<std::string, ParameterSetDescription> > descriptions_;
00112 
00113     ParameterSetDescription defaultDesc_;
00114 
00115     std::string comment_;
00116     bool defaultDescDefined_;
00117   };
00118 }
00119 
00120 #endif