CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/FWCore/ParameterSet/interface/ParameterDescriptionBase.h

Go to the documentation of this file.
00001 
00002 #ifndef FWCore_ParameterSet_ParameterDescriptionBase_h
00003 #define FWCore_ParameterSet_ParameterDescriptionBase_h
00004 // -*- C++ -*-
00005 //
00006 // Package:     ParameterSet
00007 // Class  :     ParameterDescriptionBase
00008 //
00017 //
00018 // Original Author:  Chris Jones
00019 //         Created:  Thu Aug  2 15:33:46 EDT 2007
00020 //
00021 
00022 #include "FWCore/ParameterSet/interface/ParameterDescriptionNode.h"
00023 
00024 #include <string>
00025 #include <set>
00026 #include <iosfwd>
00027 
00028 namespace edm {
00029 
00030   class ParameterSetDescription;
00031   class DocFormatHelper;
00032 
00033   class ParameterDescriptionBase : public ParameterDescriptionNode 
00034   {
00035   public:
00036     virtual ~ParameterDescriptionBase();
00037 
00038     std::string const& label() const { return label_; }
00039     ParameterTypes type() const { return type_; }
00040     bool isTracked() const { return isTracked_; }
00041     bool hasDefault() const { return hasDefault_; }
00042 
00043     virtual ParameterSetDescription const* parameterSetDescription() const { return 0; }
00044     virtual ParameterSetDescription * parameterSetDescription() { return 0; }
00045 
00046   protected:
00047     void throwParameterWrongTrackiness() const;
00048     void throwParameterWrongType() const;
00049     void throwMissingRequiredNoDefault() const;
00050 
00051     ParameterDescriptionBase(std::string const& iLabel,
00052                              ParameterTypes iType,
00053                              bool isTracked,
00054                              bool hasDefault
00055                             );
00056 
00057     ParameterDescriptionBase(char const* iLabel,
00058                              ParameterTypes iType,
00059                              bool isTracked,
00060                              bool hasDefault
00061                             );
00062 
00063   private:
00064 
00065     virtual void checkAndGetLabelsAndTypes_(std::set<std::string> & usedLabels,
00066                                             std::set<ParameterTypes> & parameterTypes,
00067                                             std::set<ParameterTypes> & wildcardTypes) const;
00068 
00069     virtual void validate_(ParameterSet & pset,
00070                            std::set<std::string> & validatedLabels,
00071                            bool optional) const;
00072 
00073     virtual void writeCfi_(std::ostream & os,
00074                            bool & startWithComma,
00075                            int indentation,
00076                            bool & wroteSomething) const;
00077 
00078     virtual bool partiallyExists_(ParameterSet const& pset) const;
00079 
00080     virtual int howManyXORSubNodesExist_(ParameterSet const& pset) const;
00081 
00082     virtual void writeCfi_(std::ostream & os, int indentation) const = 0;
00083 
00084     virtual void writeDoc_(std::ostream & os, int indentation) const = 0;
00085 
00086     virtual void print_(std::ostream & os,
00087                         bool optional,
00088                         bool writeToCfi,
00089                         DocFormatHelper & dfh);
00090 
00091     virtual void printDefault_(std::ostream & os,
00092                                  bool writeToCfi,
00093                                  DocFormatHelper & dfh);
00094 
00095     virtual void printNestedContent_(std::ostream & os,
00096                                      bool optional,
00097                                      DocFormatHelper & dfh);
00098 
00099     virtual bool exists_(ParameterSet const& pset, bool isTracked) const = 0;
00100 
00101     virtual void insertDefault_(ParameterSet & pset) const = 0;
00102 
00103     std::string label_;
00104     ParameterTypes type_;
00105     bool isTracked_;
00106     bool hasDefault_;
00107   };
00108 }
00109 #endif