CMS 3D CMS Logo

edm::Entry Class Reference

#include <FWCore/ParameterSet/interface/Entry.h>

List of all members.

Public Member Functions

 Entry (std::string const &name, std::string const &type, std::vector< std::string > const &value, bool is_tracked)
 Entry (std::string const &name, std::string const &type, std::string const &value, bool is_tracked)
 Entry (std::string const &name, std::string const &)
 Entry (std::string const &name, std::vector< ParameterSet > const &val, bool is_tracked)
 Entry (std::string const &name, ParameterSet const &val, bool is_tracked)
 Entry (std::string const &name, std::vector< edm::LuminosityBlockID > const &vtag, bool is_tracked)
 Entry (std::string const &name, edm::LuminosityBlockID const &tag, bool is_tracked)
 Entry (std::string const &name, std::vector< edm::EventID > const &vtag, bool is_tracked)
 Entry (std::string const &name, edm::EventID const &tag, bool is_tracked)
 Entry (std::string const &name, std::vector< edm::InputTag > const &vtag, bool is_tracked)
 Entry (std::string const &name, edm::InputTag const &tag, bool is_tracked)
 Entry (std::string const &name, edm::FileInPath const &val, bool is_tracked)
 Entry (std::string const &name, std::vector< std::string > const &val, bool is_tracked)
 Entry (std::string const &name, std::string const &val, bool is_tracked)
 Entry (std::string const &name, std::vector< double > const &val, bool is_tracked)
 Entry (std::string const &name, double val, bool is_tracked)
 Entry (std::string const &name, std::vector< boost::uint64_t > const &val, bool is_tracked)
 Entry (std::string const &name, boost::uint64_t val, bool is_tracked)
 Entry (std::string const &name, std::vector< boost::int64_t > const &val, bool is_tracked)
 Entry (std::string const &name, boost::int64_t val, bool is_tracked)
 Entry (std::string const &name, std::vector< unsigned > const &val, bool is_tracked)
 Entry (std::string const &name, unsigned val, bool is_tracked)
 Entry (std::string const &name, std::vector< int > const &val, bool is_tracked)
 Entry (std::string const &name, int val, bool is_tracked)
 Entry (std::string const &name, bool val, bool is_tracked)
bool getBool () const
double getDouble () const
edm::EventID getEventID () const
edm::FileInPath getFileInPath () const
edm::InputTag getInputTag () const
int getInt32 () const
boost::int64_t getInt64 () const
edm::LuminosityBlockID getLuminosityBlockID () const
ParameterSet getPSet () const
std::string getString () const
unsigned getUInt32 () const
boost::uint64_t getUInt64 () const
std::vector< double > getVDouble () const
std::vector< edm::EventIDgetVEventID () const
std::vector< edm::InputTaggetVInputTag () const
std::vector< intgetVInt32 () const
std::vector< boost::int64_t > getVInt64 () const
std::vector
< edm::LuminosityBlockID
getVLuminosityBlockID () const
std::vector< ParameterSetgetVPSet () const
std::vector< std::string > getVString () const
std::vector< unsigned > getVUInt32 () const
std::vector< boost::uint64_t > getVUInt64 () const
bool isTracked () const
size_t sizeOfString () const
size_t sizeOfStringOfTracked () const
std::string toString () const
std::string toStringOfTracked () const
char typeCode () const

Private Member Functions

bool fromString (std::string::const_iterator b, std::string::const_iterator e)
void throwEncodeError (const char *type) const
void throwEntryError (const char *expectedType, std::string const &badRep) const
void throwValueError (const char *expectedType) const
void validate () const

Private Attributes

std::string name_
std::string rep
char tracked
std::string tracked_rep
char type

Friends

std::ostream & operator<< (std::ostream &ost, const Entry &entry)


Detailed Description

Definition at line 37 of file Entry.h.


Constructor & Destructor Documentation

Entry::Entry ( std::string const &  name,
bool  val,
bool  is_tracked 
)

Definition at line 217 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00217                                                                : 
00218     name_(name), rep(), type('B'), tracked(is_tracked ? '+' : '-') 
00219   {
00220     if(!encode(rep, val)) throwEncodeError("bool");
00221     validate();
00222   }

edm::Entry::Entry ( std::string const &  name,
int  val,
bool  is_tracked 
)

Entry::Entry ( std::string const &  name,
std::vector< int > const &  val,
bool  is_tracked 
)

Definition at line 237 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00237                                                                                 : 
00238     name_(name), rep(), type('i'), tracked(is_tracked ? '+' : '-') 
00239   {
00240     if(!encode(rep, val)) throwEncodeError("vector<int>");
00241     validate();
00242   }

Entry::Entry ( std::string const &  name,
unsigned  val,
bool  is_tracked 
)

Definition at line 247 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00247                                                                    :
00248     name_(name), rep(), type('U'), tracked(is_tracked ? '+' : '-')
00249   {
00250     if(!encode(rep, val)) throwEncodeError("unsigned int");
00251     validate();
00252   }

Entry::Entry ( std::string const &  name,
std::vector< unsigned > const &  val,
bool  is_tracked 
)

Definition at line 257 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00257                                                                                     :
00258    name_(name), rep(), type('u'), tracked(is_tracked ? '+' : '-') 
00259  {
00260    if(!encode(rep, val)) throwEncodeError("vector<unsigned int>");
00261     validate();
00262   }

Entry::Entry ( std::string const &  name,
boost::int64_t  val,
bool  is_tracked 
)

Definition at line 267 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00267                                                                        :
00268     name_(name), rep(), type('L'), tracked(is_tracked ? '+' : '-')
00269   {
00270     if(!encode(rep, val)) throwEncodeError("int64");
00271     validate();
00272   }

Entry::Entry ( std::string const &  name,
std::vector< boost::int64_t > const &  val,
bool  is_tracked 
)

Definition at line 277 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00277                                                                                          :
00278     name_(name), rep(), type('l'), tracked(is_tracked ? '+' : '-')
00279   {
00280     if(!encode(rep, val)) throwEncodeError("vector<int64>");
00281     validate();
00282   }

Entry::Entry ( std::string const &  name,
boost::uint64_t  val,
bool  is_tracked 
)

Definition at line 287 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00287                                                                         :
00288     name_(name), rep(), type('X'), tracked(is_tracked ? '+' : '-')
00289   {
00290     if(!encode(rep, val)) throwEncodeError("unsigned int64");
00291     validate();
00292   }

Entry::Entry ( std::string const &  name,
std::vector< boost::uint64_t > const &  val,
bool  is_tracked 
)

Definition at line 297 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00297                                                                                          :
00298    name_(name), rep(), type('x'), tracked(is_tracked ? '+' : '-')
00299  {
00300    if(!encode(rep, val)) throwEncodeError("vector<unsigned int64>");
00301     validate();
00302   }

Entry::Entry ( std::string const &  name,
double  val,
bool  is_tracked 
)

Definition at line 307 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00307                                                                 : 
00308    name_(name), rep(), type('D'), tracked(is_tracked ? '+' : '-') 
00309  {
00310    if(!encode(rep, val)) throwEncodeError("double");
00311     validate();
00312   }

Entry::Entry ( std::string const &  name,
std::vector< double > const &  val,
bool  is_tracked 
)

Definition at line 317 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00317                                                                                    : 
00318     name_(name), rep(), type('d'), tracked(is_tracked ? '+' : '-') 
00319   {
00320     if(!encode(rep, val)) throwEncodeError("vector<double>");
00321     validate();
00322   }

Entry::Entry ( std::string const &  name,
std::string const &  val,
bool  is_tracked 
)

Definition at line 327 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00327                                                                            :
00328     name_(name), rep(), type('S'), tracked(is_tracked ? '+' : '-') 
00329   {
00330     if(!encode(rep, val)) throwEncodeError("string");
00331     validate();
00332   }

Entry::Entry ( std::string const &  name,
std::vector< std::string > const &  val,
bool  is_tracked 
)

Definition at line 337 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00337                                                                                       :
00338        name_(name), rep(), type('s'), tracked(is_tracked ? '+' : '-') 
00339   {
00340     if(!encode(rep, val)) throwEncodeError("vector<string>");
00341     validate();
00342   }

Entry::Entry ( std::string const &  name,
edm::FileInPath const &  val,
bool  is_tracked 
)

Definition at line 347 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00347                                                                                : 
00348     name_(name), rep(), type('F'), tracked(is_tracked ? '+' : '-') 
00349   {
00350     if (!encode(rep, val)) throwEncodeError("FileInPath");
00351     validate();
00352   }

Entry::Entry ( std::string const &  name,
edm::InputTag const &  tag,
bool  is_tracked 
)

Definition at line 358 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00358                                                                              :
00359     name_(name), rep(), type('t'), tracked(is_tracked ? '+' : '-')
00360   {
00361     if (!encode(rep, val)) throwEncodeError("InputTag");
00362     validate();
00363   }

Entry::Entry ( std::string const &  name,
std::vector< edm::InputTag > const &  vtag,
bool  is_tracked 
)

Definition at line 369 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00369                                                                                         :
00370     name_(name), rep(), type('v'), tracked(is_tracked ? '+' : '-')
00371   {
00372     if (!encode(rep, val)) throwEncodeError("VInputTag");
00373     validate();
00374   }

Entry::Entry ( std::string const &  name,
edm::EventID const &  tag,
bool  is_tracked 
)

Definition at line 380 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00380                                                                             :
00381     name_(name), rep(), type('E'), tracked(is_tracked ? '+' : '-')
00382   {
00383     if (!encode(rep, val)) throwEncodeError("EventID");
00384     validate();
00385   }

Entry::Entry ( std::string const &  name,
std::vector< edm::EventID > const &  vtag,
bool  is_tracked 
)

Definition at line 391 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00391                                                                                        :
00392     name_(name), rep(), type('e'), tracked(is_tracked ? '+' : '-')
00393   {
00394     if (!encode(rep, val)) throwEncodeError("VEventID");
00395     validate();
00396   }

Entry::Entry ( std::string const &  name,
edm::LuminosityBlockID const &  tag,
bool  is_tracked 
)

Definition at line 403 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00403                                                                                       :
00404     name_(name), rep(), type('M'), tracked(is_tracked ? '+' : '-')
00405   {
00406     if (!encode(rep, val)) throwEncodeError("LuminosityBlockID");
00407     validate();
00408   }

Entry::Entry ( std::string const &  name,
std::vector< edm::LuminosityBlockID > const &  vtag,
bool  is_tracked 
)

Definition at line 414 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00414                                                                                                  :
00415     name_(name), rep(), type('m'), tracked(is_tracked ? '+' : '-')
00416   {
00417     if (!encode(rep, val)) throwEncodeError("VLuminosityBlockID");
00418     validate();
00419   }

Entry::Entry ( std::string const &  name,
ParameterSet const &  val,
bool  is_tracked 
)

Definition at line 426 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00426                                                                               : 
00427     name_(name), rep(), type('P'), tracked(is_tracked ? '+' : '-') 
00428   {
00429     if(!encode(rep, val)) throwEncodeError("ParameterSet");
00430     validate();
00431   }

Entry::Entry ( std::string const &  name,
std::vector< ParameterSet > const &  val,
bool  is_tracked 
)

Definition at line 436 of file Entry.cc.

References edm::encode(), rep, throwEncodeError(), and validate().

00436                                                                                          :
00437       name_(name), rep(), type('p'), tracked(is_tracked ? '+' : '-') 
00438   {
00439     if(!encode(rep, val)) throwEncodeError("vector<ParameterSet>");
00440     validate();
00441   }

Entry::Entry ( std::string const &  name,
std::string const &  code 
)

Definition at line 446 of file Entry.cc.

References fromString(), throwEncodeError(), and validate().

00446                                                            : 
00447     name_(name), rep(), type('?'), tracked('?') 
00448   {
00449     if(!fromString(code.begin(), code.end())) 
00450       throwEncodeError("coded string");
00451     validate();
00452   }

Entry::Entry ( std::string const &  name,
std::string const &  type,
std::string const &  value,
bool  is_tracked 
)

Definition at line 455 of file Entry.cc.

References edm::errors::Configuration, fromString(), edm::sTypeTranslations, edm::pset::TypeTrans::type2Code_, and validate().

00456                                 :
00457     name_(name), rep(), type('?'), tracked('?') 
00458   {
00459     std::string codedString(is_tracked ?"-":"+");
00460    
00461     Type2Code::const_iterator itFound = sTypeTranslations.type2Code_.find(type);
00462     if(itFound == sTypeTranslations.type2Code_.end()) 
00463       {
00464         throw edm::Exception(errors::Configuration)
00465           << "bad type name used for Entry : " << type;
00466       }
00467    
00468     codedString += itFound->second;
00469     codedString +='(';
00470     codedString += value;
00471     codedString +=')';
00472    
00473     if(!fromString(codedString.begin(), codedString.end()))
00474       {
00475         throw edm::Exception(errors::Configuration)
00476           <<  "bad encoded Entry string " <<  codedString;
00477       }
00478     validate();   
00479   }

Entry::Entry ( std::string const &  name,
std::string const &  type,
std::vector< std::string > const &  value,
bool  is_tracked 
)

Definition at line 481 of file Entry.cc.

References edm::errors::Configuration, e, fromString(), i, edm::sTypeTranslations, edm::pset::TypeTrans::type2Code_, and validate().

00483                                 :
00484     name_(name), rep() , type('?'), tracked('?') 
00485   {
00486     std::string codedString(is_tracked ?"-":"+");
00487    
00488     Type2Code::const_iterator itFound = 
00489       sTypeTranslations.type2Code_.find(type);
00490     if(itFound == sTypeTranslations.type2Code_.end()) 
00491       {
00492         throw edm::Exception(errors::Configuration)
00493           << "bad type name used for Entry : " << type;
00494       }
00495    
00496     codedString += itFound->second;
00497     codedString += '(';
00498     codedString += '{';
00499     std::vector<std::string>::const_iterator i = value.begin();
00500     std::vector<std::string>::const_iterator e = value.end();
00501     const std::string kSeparator(",");
00502     std::string sep("");
00503     for(; i!= e; ++i) {
00504       codedString += sep;
00505       codedString += *i;
00506       sep = kSeparator;
00507     }
00508     codedString += '}';
00509     codedString += ')';
00510 
00511     if(!fromString(codedString.begin(), codedString.end()))
00512       {
00513         throw edm::Exception(errors::Configuration)
00514           << "bad encoded Entry string " << codedString;
00515       }
00516     validate();
00517   }


Member Function Documentation

bool Entry::fromString ( std::string::const_iterator  b,
std::string::const_iterator  e 
) [private]

Definition at line 611 of file Entry.cc.

Referenced by Entry().

00611                                                                                     {
00612     if(static_cast<unsigned int>(e - b) < 4u || b[ 2] != '(' || e[-1] != ')')
00613 
00614       return false;
00615 
00616     tracked = b[0];
00617     type = b[1];
00618     rep = std::string(b+3, e-1);
00619 
00620     return true;
00621   }  // from_string()

bool Entry::getBool (  )  const

Definition at line 632 of file Entry.cc.

References decode().

00632                        {
00633     if (type != 'B') throwValueError("bool");
00634     bool  val;
00635     if (!decode(val, rep)) throwEntryError("bool", rep);
00636     return val;
00637   }

double Entry::getDouble (  )  const

Definition at line 744 of file Entry.cc.

References decode().

00745   {
00746     if(type != 'D') throwValueError("double");
00747     double  val;
00748     if(!decode(val, rep)) throwEntryError("double", rep);
00749     return val;
00750   }

edm::EventID Entry::getEventID (  )  const

Definition at line 831 of file Entry.cc.

References decode().

00832   {
00833     if(type != 'E') throwValueError("EventID");
00834     edm::EventID val;
00835     if(!decode(val, rep)) throwEntryError("EventID", rep);
00836     return val;
00837   }

edm::FileInPath Entry::getFileInPath (  )  const

Definition at line 793 of file Entry.cc.

References decode().

Referenced by edm::ParameterSet::getAllFileInPaths(), PhysicsTools::MVAComputerESSourceBase::MVAComputerESSourceBase(), and PhysicsTools::MVATrainerLooper::Trainer::Trainer().

00794   {
00795     if(type != 'F') throwValueError("FileInPath");
00796     edm::FileInPath val;
00797     if(!decode(val, rep)) throwEntryError("FileInPath", rep);
00798     return val;
00799   }

edm::InputTag Entry::getInputTag (  )  const

Definition at line 805 of file Entry.cc.

References decode().

00806   {
00807     if(type != 't') throwValueError("InputTag");
00808     edm::InputTag val;
00809     if(!decode(val, rep)) throwEntryError("InputTag", rep);
00810     return val;
00811   }

int Entry::getInt32 (  )  const

Definition at line 644 of file Entry.cc.

References decode().

Referenced by edm::operator<<().

00645   {
00646     if(type != 'I') throwValueError("int");
00647     int  val;
00648     if(!decode(val, rep)) throwEntryError("int", rep);
00649     return val;
00650   }

boost::int64_t Entry::getInt64 (  )  const

Definition at line 669 of file Entry.cc.

References decode().

00670   {
00671     if(type != 'L') throwValueError("int64");
00672     boost::int64_t  val;
00673     if(!decode(val, rep)) throwEntryError("int64", rep);
00674     return val;
00675   }

edm::LuminosityBlockID Entry::getLuminosityBlockID (  )  const

Definition at line 856 of file Entry.cc.

References decode().

00857   {
00858     if(type != 'M') throwValueError("LuminosityBlockID");
00859     edm::LuminosityBlockID val;
00860     if(!decode(val, rep)) throwEntryError("LuminosityBlockID", rep);
00861     return val;
00862   }

ParameterSet Entry::getPSet (  )  const

Definition at line 881 of file Entry.cc.

References decode().

Referenced by edm::operator<<().

00882   {
00883     if(type != 'P') throwValueError("ParameterSet");
00884     ParameterSet val;
00885     if(!decode(val, rep)) throwEntryError("ParameterSet", rep);
00886     return val;
00887   }

std::string Entry::getString ( void   )  const

Definition at line 768 of file Entry.cc.

References decode().

Referenced by PhysicsTools::MVAComputerESSourceBase::MVAComputerESSourceBase(), edm::operator<<(), and PhysicsTools::MVATrainerLooper::Trainer::Trainer().

00769   {
00770     if(type != 'S') throwValueError("string");
00771     std::string  val;
00772     if(!decode(val, rep)) throwEntryError("string", rep);
00773     return val;
00774   }

unsigned Entry::getUInt32 (  )  const

Definition at line 695 of file Entry.cc.

References decode().

Referenced by edm::operator<<().

00696   {
00697     if(type != 'U') throwValueError("unsigned int");
00698     unsigned  val;
00699     if(!decode(val, rep)) throwEntryError("unsigned int", rep);
00700     return val;
00701   }

boost::uint64_t Entry::getUInt64 (  )  const

Definition at line 720 of file Entry.cc.

References decode().

00721   {
00722     if(type != 'X') throwValueError("uint64");
00723     boost::uint64_t val;
00724     if(!decode(val, rep)) throwEntryError("uint64", rep);
00725     return val;
00726   }

std::vector< double > Entry::getVDouble (  )  const

Definition at line 756 of file Entry.cc.

References decode().

00757   {
00758     if(type != 'd') throwValueError("vector<double>");
00759     std::vector<double>  val;
00760     if(!decode(val, rep)) throwEntryError("vector<double>", rep);
00761     return val;
00762   }

std::vector< edm::EventID > Entry::getVEventID (  )  const

Definition at line 843 of file Entry.cc.

References decode().

00844   {
00845     if(type != 'e') throwValueError("VEventID");
00846     std::vector<edm::EventID> val;
00847     if(!decode(val, rep)) throwEntryError("EventID", rep);
00848     return val;
00849   }

std::vector< edm::InputTag > Entry::getVInputTag (  )  const

Definition at line 818 of file Entry.cc.

References decode().

Referenced by edm::operator<<().

00819   {
00820     if(type != 'v') throwValueError("VInputTag");
00821     std::vector<edm::InputTag> val;
00822     if(!decode(val, rep)) throwEntryError("InputTag", rep);
00823     return val;
00824   }

std::vector< int > Entry::getVInt32 (  )  const

Definition at line 656 of file Entry.cc.

References decode().

00657   {
00658     if(type != 'i') throwValueError("vector<int>");
00659     std::vector<int>  val;
00660     if(!decode(val, rep)) throwEntryError("vector<int>", rep);
00661     return val;
00662   }

std::vector< boost::int64_t > Entry::getVInt64 (  )  const

Definition at line 681 of file Entry.cc.

References decode().

00682   {
00683     if(type != 'l') throwValueError("vector<int64>");
00684     std::vector<boost::int64_t>  val;
00685     if(!decode(val, rep)) throwEntryError("vector<int64>", rep);
00686     return val;
00687   }

std::vector< edm::LuminosityBlockID > Entry::getVLuminosityBlockID (  )  const

Definition at line 868 of file Entry.cc.

References decode().

00869   {
00870     if(type != 'm') throwValueError("VLuminosityBlockID");
00871     std::vector<edm::LuminosityBlockID> val;
00872     if(!decode(val, rep)) throwEntryError("LuminosityBlockID", rep);
00873     return val;
00874   }

std::vector< ParameterSet > Entry::getVPSet (  )  const

Definition at line 893 of file Entry.cc.

References decode().

Referenced by edm::operator<<().

00894   {
00895     if(type != 'p') throwValueError("vector<ParameterSet>");
00896     std::vector<ParameterSet>  val;
00897     if(!decode(val, rep)) throwEntryError("vector<ParameterSet>", rep);
00898     return val;
00899   }

std::vector< std::string > Entry::getVString (  )  const

Definition at line 780 of file Entry.cc.

References decode().

Referenced by edm::operator<<().

00781   {
00782     if(type != 's') throwValueError("vector<string>");
00783     std::vector<std::string>  val;
00784     if(!decode(val, rep)) throwEntryError("vector<string>", rep);
00785     return val;
00786   }

std::vector< unsigned > Entry::getVUInt32 (  )  const

Definition at line 707 of file Entry.cc.

References decode().

00708   {
00709     if(type != 'u') throwValueError("vector<unsigned int>");
00710     std::vector<unsigned>  val;
00711     if(!decode(val, rep)) throwEntryError("vector<unsigned int>", rep);
00712     return val;
00713   }

std::vector< boost::uint64_t > Entry::getVUInt64 (  )  const

Definition at line 732 of file Entry.cc.

References decode().

00733   {
00734     if(type != 'x') throwValueError("vector<uint64>");
00735     std::vector<boost::uint64_t>  val;
00736     if(!decode(val, rep)) throwEntryError("vector<uint64>", rep);
00737     return val;
00738   }

bool edm::Entry::isTracked (  )  const [inline]

Definition at line 146 of file Entry.h.

References tracked.

Referenced by edm::ParameterSet::getNamesByCode_(), and edm::operator<<().

00146 { return tracked == '+'; }

size_t edm::Entry::sizeOfString (  )  const [inline]

Definition at line 142 of file Entry.h.

References rep.

00142 {return rep.size() + 4;}

size_t Entry::sizeOfStringOfTracked (  )  const

Definition at line 565 of file Entry.cc.

References e, encode(), i, size, and edm::ParameterSet::toStringOfTracked().

00565                                      {
00566     size_t size = 0;
00567     switch (type) {
00568       case 'P':
00569         {      
00570           if (tracked_rep.empty()) {
00571             // Make sure we get the representation of each contained
00572             // ParameterSet including *only* tracked parameters
00573             ParameterSet val = getPSet();
00574             tracked_rep = val.toStringOfTracked();
00575           }
00576           size = tracked_rep.size() + 4;
00577           break;
00578         }
00579       case 'p':
00580         {      
00581           if (tracked_rep.empty()) {
00582             // Make sure we get the representation of each contained
00583             // ParameterSet including *only* tracked parameters
00584             std::vector<ParameterSet> whole = getVPSet();
00585             std::vector<ParameterSet> onlytracked;
00586             onlytracked.reserve(whole.size());
00587             std::vector<ParameterSet>::const_iterator i = whole.begin();
00588             std::vector<ParameterSet>::const_iterator e = whole.end();
00589             for ( ; i != e; ++i ) {
00590               ParameterSet tracked_part( i->toStringOfTracked() );
00591               onlytracked.push_back(tracked_part);
00592             }
00593             if(!encode(tracked_rep, onlytracked)) 
00594               throwEncodeError("vector<ParameterSet>");   
00595           }
00596           size = tracked_rep.size() + 4;
00597           break;
00598        }
00599       default: // everything else
00600         {
00601           size = sizeOfString();
00602           break;          
00603         }
00604     }
00605     return size;
00606   }

void Entry::throwEncodeError ( const char *  type  )  const [private]

Definition at line 1013 of file Entry.cc.

References edm::errors::Configuration, and Entry::name_.

Referenced by Entry().

01014     {
01015       throw edm::Exception(errors::Configuration, "EncodingError")
01016         << "can not encode " << name_ << " as type: " << type;
01017     }

void Entry::throwEntryError ( const char *  expectedType,
std::string const &  badRep 
) const [private]

Definition at line 1004 of file Entry.cc.

References edm::errors::Configuration, and Entry::name_.

01006     {
01007       throw edm::Exception(errors::Configuration, "EntryError")
01008         << "can not convert representation of " << name_ << ": "
01009         << badRep
01010         << " to value of type " << expectedType << " ";
01011     }

void Entry::throwValueError ( const char *  expectedType  )  const [private]

Definition at line 997 of file Entry.cc.

References edm::errors::Configuration, Entry::name_, edm::sTypeTranslations, and edm::pset::TypeTrans::table_.

00998     {
00999       throw edm::Exception(errors::Configuration, "ValueError")
01000         << "type of " << name_ << " is expected to be " << expectedType
01001         << " but declared as " << sTypeTranslations.table_[type];
01002     }

std::string Entry::toString (  )  const

Definition at line 524 of file Entry.cc.

References HLT_VtxMuL3::result.

00524                         {
00525     std::string result;
00526     result.reserve(sizeOfString());
00527     result += tracked;
00528     result += type;
00529     result += '(';
00530     result += rep;
00531     result += ')';
00532     return result;
00533   }

std::string Entry::toStringOfTracked (  )  const

Definition at line 536 of file Entry.cc.

References HLT_VtxMuL3::result, and size.

00536                                  {
00537     size_t size = sizeOfStringOfTracked();
00538     std::string result;
00539     result.reserve(size);
00540     result += tracked;
00541     result += type;
00542     result += '(';
00543     switch (type) {
00544       case 'P':
00545         {      
00546           result += tracked_rep;
00547           break;
00548         }
00549       case 'p':
00550         {      
00551           result += tracked_rep;
00552           break;
00553        }
00554       default: // everything else
00555         {
00556           result += rep;
00557           break;
00558         }
00559     }
00560     result += ')';
00561     return result;
00562   }

char edm::Entry::typeCode (  )  const [inline]

Definition at line 148 of file Entry.h.

Referenced by edm::ParameterSet::getAllFileInPaths(), edm::ParameterSet::getNamesByCode_(), edm::ParameterSet::getParameterNamesForType(), PhysicsTools::MVAComputerESSourceBase::MVAComputerESSourceBase(), edm::operator<<(), and PhysicsTools::MVATrainerLooper::Trainer::Trainer().

00148 { return type; }

void Entry::validate (  )  const [private]

Definition at line 78 of file Entry.cc.

References decode().

Referenced by Entry().

00078                         {
00079     // tracked
00080     assert ( tracked == '+' || tracked == '-' );
00081 //     if(tracked != '+' && tracked != '-')
00082 //       throw EntryError(std::string("invalid tracked code ") + tracked);
00083   
00084     // type and rep
00085     switch(type)  {
00086       case 'B':  {  // Bool
00087         bool  val;
00088         if (!decode(val, rep)) throwEntryError("bool", rep);
00089         break;
00090       }
00091       case 'b':  {  // vBool
00092         std::vector<bool>  val;
00093         if(!decode(val, rep)) throwEntryError("vector<bool>", rep);
00094         break;
00095       }
00096       case 'I':  {  // Int32
00097         int  val;
00098         if(!decode(val, rep)) throwEntryError("int", rep);
00099         break;
00100       }
00101       case 'i':  {  // vInt32
00102         std::vector<int>  val;
00103         if(!decode(val, rep)) throwEntryError("vector<int>", rep);
00104         break;
00105       }
00106       case 'U':  {  // Uint32
00107         unsigned  val;
00108         if(!decode(val, rep)) throwEntryError("unsigned int", rep);
00109         break;
00110       }
00111       case 'u':  {  // vUint32
00112         std::vector<unsigned>  val;
00113         if(!decode(val, rep)) throwEntryError("vector<unsigned int>", rep);
00114         break;
00115       }
00116       case 'L':  {  // Int64
00117         int  val;
00118         if(!decode(val, rep)) throwEntryError("int64", rep);
00119         break;
00120       }
00121       case 'l':  {  // vInt64
00122         std::vector<int>  val;
00123         if(!decode(val, rep)) throwEntryError("vector<int64>", rep);
00124         break;
00125       }
00126       case 'X':  {  // Uint64
00127         unsigned  val;
00128         if(!decode(val, rep)) throwEntryError("unsigned int64", rep);
00129         break;
00130       }
00131       case 'x':  {  // vUint64
00132         std::vector<unsigned>  val;
00133         if(!decode(val, rep)) throwEntryError("vector<unsigned int64>", rep);
00134         break;
00135       }
00136       case 'S':  {  // String
00137         std::string  val;
00138         if(!decode(val, rep)) throwEntryError("string", rep);
00139         break;
00140       }
00141       case 's':  {  // vString
00142         std::vector<std::string>  val;
00143         if(!decode(val, rep)) throwEntryError("vector<string>", rep);
00144         break;
00145       }
00146       case 'F':  {  // FileInPath
00147         edm::FileInPath val;
00148         if(!decode(val, rep)) throwEntryError("FileInPath", rep);
00149         break;
00150       }
00151       case 't':  {  // InputTag
00152         edm::InputTag val;
00153         if(!decode(val, rep)) throwEntryError("InputTag", rep);
00154         break;
00155       }
00156       case 'v':  {  // VInputTag
00157         std::vector<edm::InputTag> val;
00158         if(!decode(val, rep)) throwEntryError("VInputTag", rep);
00159         break;
00160       }
00161       case 'E':  {  // EventID
00162         edm::EventID val; 
00163         if(!decode(val, rep)) throwEntryError("EventID", rep);
00164         break;
00165       }
00166       case 'e':  {  // VEventID
00167         std::vector<edm::EventID> val;
00168         if(!decode(val, rep)) throwEntryError("VEventID", rep);
00169         break;
00170       }
00171       case 'M':  {  // LuminosityBlockID
00172         edm::LuminosityBlockID val; 
00173         if(!decode(val, rep)) throwEntryError("LuminosityBlockID", rep);
00174         break;
00175       }
00176       case 'm':  {  // VLuminosityBlockID
00177         std::vector<edm::LuminosityBlockID> val;
00178         if(!decode(val, rep)) throwEntryError("VLuminosityBlockID", rep);
00179         break;
00180       }
00181       case 'D':  {  // Double
00182         double  val;
00183         if(!decode(val, rep)) throwEntryError("double", rep);
00184         break;
00185       }
00186       case 'd':  {  // vDouble
00187         std::vector<double>  val;
00188         if(!decode(val, rep)) throwEntryError("vector<double>", rep);
00189         break;
00190       }
00191       case 'P':  {  // ParameterSet
00192         ParameterSet val;
00193         if(!decode(val, rep)) throwEntryError("ParameterSet", rep);
00194         break;
00195       }
00196       case 'p':  {  // vParameterSet
00197         std::vector<ParameterSet>  val;
00198         if(!decode(val, rep)) throwEntryError("vector<ParameterSet>", rep);
00199         break;
00200       }
00201       default:  {
00202         // We should never get here.
00203         assert ("Invalid type code" == 0);
00204         //throw EntryError(std::string("invalid type code ") + type);
00205         break;
00206       }
00207     }  // switch(type)
00208   }  // Entry::validate()


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ost,
const Entry entry 
) [friend]

Definition at line 903 of file Entry.cc.

00904   {
00905     os << sTypeTranslations.table_[entry.typeCode()] << " " 
00906        << (entry.isTracked() ? "tracked " : "untracked ") <<" = "; 
00907 
00908     // now handle the difficult cases
00909     switch(entry.typeCode())
00910     {
00911       case 'P': // ParameterSet
00912       {
00913         os << entry.getPSet();
00914         break;
00915       }
00916       case 'p': // vector<ParameterSet>
00917       {
00918         // Make sure we get the representation of each contained
00919         // ParameterSet including *only* tracked parameters
00920         std::vector<ParameterSet> whole = entry.getVPSet();
00921         std::vector<ParameterSet>::const_iterator i = whole.begin();
00922         std::vector<ParameterSet>::const_iterator e = whole.end();
00923         std::string start ="";
00924         const std::string between(",\n");
00925         os << "{"<<std::endl;
00926          for ( ; i != e; ++i )
00927          {
00928            os <<  start<< *i;
00929            start = between;
00930          }
00931          if (whole.size()) {
00932            os << std::endl;
00933          }
00934          os << "}";
00935          break;
00936       } 
00937       case 'S':
00938       {
00939         os << "'" << entry.getString() << "'";
00940         break;
00941       }
00942       case 's':
00943       {
00944         
00945         os << "{";
00946         std::string start ="'";
00947         const std::string between(",'");
00948         std::vector<std::string> strings = entry.getVString();
00949         for(std::vector<std::string>::const_iterator it = strings.begin(), itEnd = strings.end();
00950             it != itEnd;
00951             ++it) {
00952           os << start << *it << "'";
00953           start = between;
00954         }
00955         os << "}";
00956         break;
00957       }
00958       case 'I':
00959       {
00960         os << entry.getInt32();
00961         break;
00962       }
00963       case 'U':
00964       {
00965         os << entry.getUInt32();
00966         break;
00967       }
00968       case 'v':
00969       {
00970         //VInputTag needs to be treated seperately because it is encode like
00971         // vector<string> rather than using the individual encodings of each InputTag
00972         os << "{";
00973         std::string start = "";
00974         const std::string between(",");
00975         std::vector<InputTag> tags = entry.getVInputTag();
00976         for(std::vector<InputTag>::const_iterator it = tags.begin(), itEnd = tags.end();
00977             it != itEnd;
00978             ++it) {
00979           os << start << it->encode();
00980           start = between;
00981         }
00982         os << "}";
00983         break;
00984       }
00985       default:
00986       {
00987         os << entry.rep;
00988         break;
00989       }
00990     }
00991 
00992     return os;
00993   }


Member Data Documentation

std::string edm::Entry::name_ [private]

Definition at line 152 of file Entry.h.

std::string edm::Entry::rep [private]

Definition at line 153 of file Entry.h.

Referenced by Entry(), edm::operator<<(), and sizeOfString().

char edm::Entry::tracked [private]

Definition at line 156 of file Entry.h.

Referenced by isTracked().

std::string edm::Entry::tracked_rep [mutable, private]

Definition at line 154 of file Entry.h.

char edm::Entry::type [private]

Definition at line 155 of file Entry.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:40:40 2009 for CMSSW by  doxygen 1.5.4