00001 #include "Utilities/General/interface/ConfigurationRecord.h" 00002 #include "Utilities/General/interface/ConfigurationDictionary.h" 00003 00004 #include "Utilities/General/interface/GenUtilVerbosity.h" 00005 00006 using std::string; 00007 00008 ConfigurationDictionary::ConfigurationDictionary(const ConfigurationRecord& conf) { 00009 add(conf); 00010 } 00011 00012 void ConfigurationDictionary::add(const ConfigurationRecord& conf) { 00013 for (ConfigurationRecord::DictCI p=conf.begin(); p!=conf.end();++p) { 00014 if ( (*p).first[(*p).first.size()-1]=='+' ) 00015 (*this)[(*p).first.substr(0,(*p).first.size()-1)] += string(" ") + (*p).second; 00016 else (*this)[(*p).first] = (*p).second; 00017 } 00018 } 00019 00020 void ConfigurationDictionary::dump() const { 00021 dump(GenUtil::cout); 00022 } 00023 00024 void ConfigurationDictionary::dump(std::ostream& co) const { 00025 for (const_iterator p=begin(); p!=end(); ++p) 00026 co << (*p).first << " = " << (*p).second << "\n"; 00027 co.flush(); 00028 } 00029 00030 00031 ConfigurationDictionary::CRange ConfigurationDictionary::partial_range(const string & prefix, char sep) const { 00032 00033 string l1 = prefix + sep; 00034 sep++; 00035 string l2 = prefix + sep; 00036 return CRange(lower_bound(l1),lower_bound(l2)); 00037 00038 }