CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/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     ConfigurationDescriptions(std::string const& baseType);
00031 
00032     ~ConfigurationDescriptions();
00033 
00034     // ---------------------------------------------------------
00035     // These functions are used by module developers to create
00036     // a description for a module.
00037     // ---------------------------------------------------------
00038 
00039     std::string const& comment() const { return comment_; }
00040     void setComment(std::string const & value);
00041     void setComment(char const* value);
00042 
00043     void add(std::string const& label, ParameterSetDescription const& psetDescription);
00044     void add(char const* label, ParameterSetDescription const& psetDescription);
00045 
00046     void addDefault(ParameterSetDescription const& psetDescription);
00047 
00048     // ---------------------------------------------------------
00049     // These functions use the information in the descriptions
00050     // ---------------------------------------------------------
00051 
00052     void validate(ParameterSet & pset, std::string const& moduleLabel) const;
00053 
00054     void writeCfis(std::string const& baseType,
00055                    std::string const& pluginName) const;
00056 
00057     void print(std::ostream & os,
00058                std::string const& moduleLabel,
00059                bool brief,
00060                bool printOnlyLabels,
00061                size_t lineWidth,
00062                int indentation,
00063                int iPlugin) const;
00064 
00065     // ---------------------------------------------------------
00066 
00067   private:
00068 
00069     class DescriptionCounter {
00070     public:
00071       int iPlugin;
00072       int iSelectedModule;
00073       int iModule;
00074     };
00075 
00076     static void writeCfiForLabel(std::pair<std::string, ParameterSetDescription> const& labelAndDesc,
00077                                  std::string const& baseType,
00078                                  std::string const& pluginName);
00079 
00080     void printForLabel(std::pair<std::string, ParameterSetDescription> const& labelAndDesc,
00081                        std::ostream & os,
00082                        std::string const& moduleLabel,
00083                        bool brief,
00084                        bool printOnlyLabels,
00085                        size_t lineWidth,
00086                        int indentationn,
00087                        DescriptionCounter & counter) const;
00088 
00089     void printForLabel(std::ostream & os,
00090                        std::string const& label,
00091                        ParameterSetDescription const& description,
00092                        std::string const& moduleLabel,
00093                        bool brief,
00094                        bool printOnlyLabels,
00095                        size_t lineWidth,
00096                        int indentationn,
00097                        DescriptionCounter & counter) const;
00098 
00099     std::string baseType_;
00100 
00101     std::vector<std::pair<std::string, ParameterSetDescription> > descriptions_;
00102 
00103     bool defaultDescDefined_;
00104     ParameterSetDescription defaultDesc_;
00105 
00106     std::string comment_;
00107   };
00108 }
00109 
00110 #endif