CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
edm::BranchDescription Class Reference

#include <BranchDescription.h>

Classes

struct  Transients
 

Public Types

enum  MatchMode { Strict = 0, Permissive }
 

Public Member Functions

BranchID const & aliasForBranchID () const
 
int basketSize () const
 
std::set< std::string > const & branchAliases () const
 
 BranchDescription ()
 
 BranchDescription (BranchType const &branchType, std::string const &moduleLabel, std::string const &processName, std::string const &className, std::string const &friendlyClassName, std::string const &productInstanceName, std::string const &moduleName, ParameterSetID const &parameterSetID, TypeWithDict const &theTypeWithDict, bool produced=true, std::set< std::string > const &aliases=std::set< std::string >())
 
 BranchDescription (BranchDescription const &aliasForBranch, std::string const &moduleLabelAlias, std::string const &poruductInstanceAlias)
 
BranchID const & branchID () const
 
std::string const & branchName () const
 
BranchType const & branchType () const
 
std::string const & className () const
 
void clearBranchName ()
 
bool dropped () const
 
std::string const & friendlyClassName () const
 
std::string const & fullClassName () const
 
void init ()
 
void initBranchName ()
 
void initFromDictionary ()
 
void initializeTransients ()
 
void insertBranchAlias (std::string const &alias)
 
bool isAlias () const
 
void merge (BranchDescription const &other)
 
std::string const & moduleLabel () const
 
std::string const & moduleName () const
 
bool onDemand () const
 
BranchID const & originalBranchID () const
 
ParameterSetID const & parameterSetID () const
 
bool present () const
 
std::string const & processName () const
 
bool produced () const
 
std::string const & productInstanceName () const
 
void setBasketSize (int size)
 
void setDropped (bool isDropped)
 
void setOnDemand (bool isOnDemand)
 
void setProduced (bool isProduced)
 
void setSplitLevel (int level)
 
void setTransient (bool isTransient)
 
void setUnwrappedType (TypeWithDict const &type)
 
void setWrappedName (std::string const &name)
 
void setWrappedType (TypeWithDict const &type)
 
int splitLevel () const
 
bool transient () const
 
TypeWithDict const & unwrappedType () const
 
TypeID unwrappedTypeID () const
 
void updateFriendlyClassName ()
 
std::string const & wrappedName () const
 
TypeWithDict const & wrappedType () const
 
TypeID wrappedTypeID () const
 
void write (std::ostream &os) const
 
 ~BranchDescription ()
 

Static Public Attributes

static int const invalidBasketSize = 0
 
static int const invalidSplitLevel = -1
 

Private Member Functions

void throwIfInvalid_ () const
 

Private Attributes

BranchID aliasForBranchID_
 
std::set< std::string > branchAliases_
 
BranchID branchID_
 
BranchType branchType_
 
std::string friendlyClassName_
 
std::string fullClassName_
 
std::string moduleLabel_
 
std::string processName_
 
std::string productInstanceName_
 
Transients transient_
 

Detailed Description

Definition at line 32 of file BranchDescription.h.

Member Enumeration Documentation

Enumerator
Strict 
Permissive 

Definition at line 36 of file BranchDescription.h.

Constructor & Destructor Documentation

edm::BranchDescription::BranchDescription ( )

Definition at line 39 of file BranchDescription.cc.

39  :
41  moduleLabel_(),
42  processName_(),
43  branchID_(),
49  transient_() {
50  // do not call init here! It will result in an exception throw.
51  }
std::set< std::string > branchAliases_
edm::BranchDescription::BranchDescription ( BranchType const &  branchType,
std::string const &  moduleLabel,
std::string const &  processName,
std::string const &  className,
std::string const &  friendlyClassName,
std::string const &  productInstanceName,
std::string const &  moduleName,
ParameterSetID const &  parameterSetID,
TypeWithDict const &  theTypeWithDict,
bool  produced = true,
std::set< std::string > const &  aliases = std::set<std::string>() 
)

Definition at line 53 of file BranchDescription.cc.

References init(), moduleName(), edm::BranchDescription::Transients::moduleName_, parameterSetID(), edm::BranchDescription::Transients::parameterSetID_, setDropped(), setOnDemand(), setProduced(), setUnwrappedType(), and transient_.

64  :
68  branchID_(),
73  transient_() {
74  setDropped(false);
76  setOnDemand(false);
79  setUnwrappedType(theTypeWithDict);
80  init();
81  }
dictionary aliases
Definition: autoCond.py:34
BranchType const & branchType() const
void setOnDemand(bool isOnDemand)
std::string const & processName() const
std::string const & className() const
std::string const & moduleLabel() const
std::string const & productInstanceName() const
std::string const & friendlyClassName() const
void setDropped(bool isDropped)
std::string const & moduleName() const
ParameterSetID const & parameterSetID() const
std::set< std::string > branchAliases_
void setUnwrappedType(TypeWithDict const &type)
void setProduced(bool isProduced)
edm::BranchDescription::BranchDescription ( BranchDescription const &  aliasForBranch,
std::string const &  moduleLabelAlias,
std::string const &  poruductInstanceAlias 
)

Definition at line 83 of file BranchDescription.cc.

References init(), moduleName(), edm::BranchDescription::Transients::moduleName_, onDemand(), parameterSetID(), edm::BranchDescription::Transients::parameterSetID_, produced(), setDropped(), setOnDemand(), setProduced(), setUnwrappedType(), transient_, and unwrappedType().

86  :
87  branchType_(aliasForBranch.branchType()),
88  moduleLabel_(moduleLabelAlias),
89  processName_(aliasForBranch.processName()),
90  branchID_(),
91  fullClassName_(aliasForBranch.className()),
92  friendlyClassName_(aliasForBranch.friendlyClassName()),
93  productInstanceName_(productInstanceAlias),
94  branchAliases_(aliasForBranch.branchAliases()),
95  aliasForBranchID_(aliasForBranch.branchID()),
96  transient_() {
97  setDropped(false);
98  setProduced(aliasForBranch.produced());
99  setOnDemand(aliasForBranch.onDemand());
100  transient_.moduleName_ = aliasForBranch.moduleName();
101  transient_.parameterSetID_ = aliasForBranch.parameterSetID();
102  setUnwrappedType(aliasForBranch.unwrappedType());
103  init();
104  }
void setOnDemand(bool isOnDemand)
void setDropped(bool isDropped)
std::set< std::string > branchAliases_
void setUnwrappedType(TypeWithDict const &type)
void setProduced(bool isProduced)
edm::BranchDescription::~BranchDescription ( )
inline

Definition at line 57 of file BranchDescription.h.

57 {}

Member Function Documentation

BranchID const& edm::BranchDescription::aliasForBranchID ( ) const
inline

Definition at line 75 of file BranchDescription.h.

References aliasForBranchID_.

75 {return aliasForBranchID_;}
int edm::BranchDescription::basketSize ( ) const
inline
std::set<std::string> const& edm::BranchDescription::branchAliases ( ) const
inline
BranchID const& edm::BranchDescription::branchID ( ) const
inline
std::string const& edm::BranchDescription::branchName ( ) const
inline
BranchType const& edm::BranchDescription::branchType ( ) const
inline
std::string const& edm::BranchDescription::className ( ) const
inline
void edm::BranchDescription::clearBranchName ( )
inline
bool edm::BranchDescription::dropped ( ) const
inline
std::string const& edm::BranchDescription::friendlyClassName ( ) const
inline
std::string const& edm::BranchDescription::fullClassName ( ) const
inline
void edm::BranchDescription::init ( void  )
inline
void edm::BranchDescription::initBranchName ( )

Definition at line 107 of file BranchDescription.cc.

References branchID_, branchName(), edm::BranchDescription::Transients::branchName_, relativeConstraints::empty, edm::hlt::Exception, friendlyClassName(), friendlyClassName_, edm::BranchID::isValid(), moduleLabel(), moduleLabel_, processName(), processName_, productInstanceName(), productInstanceName_, edm::BranchID::setID(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, throwIfInvalid_(), and transient_.

Referenced by init(), edm::StreamedProduct::StreamedProduct(), and updateFriendlyClassName().

107  {
108  if(!branchName().empty()) {
109  return; // already called
110  }
111  throwIfInvalid_();
112 
113  char const underscore('_');
114  char const period('.');
115 
116  if(friendlyClassName_.find(underscore) != std::string::npos) {
117  throw cms::Exception("IllegalCharacter") << "Class name '" << friendlyClassName()
118  << "' contains an underscore ('_'), which is illegal in the name of a product.\n";
119  }
120 
121  if(moduleLabel_.find(underscore) != std::string::npos) {
122  throw cms::Exception("IllegalCharacter") << "Module label '" << moduleLabel()
123  << "' contains an underscore ('_'), which is illegal in a module label.\n";
124  }
125 
126  if(productInstanceName_.find(underscore) != std::string::npos) {
127  throw cms::Exception("IllegalCharacter") << "Product instance name '" << productInstanceName()
128  << "' contains an underscore ('_'), which is illegal in a product instance name.\n";
129  }
130 
131  if(processName_.find(underscore) != std::string::npos) {
132  throw cms::Exception("IllegalCharacter") << "Process name '" << processName()
133  << "' contains an underscore ('_'), which is illegal in a process name.\n";
134  }
135 
137  brName.reserve(friendlyClassName().size() +
138  moduleLabel().size() +
140  processName().size() + 4);
141  brName += friendlyClassName();
142  brName += underscore;
143  brName += moduleLabel();
144  brName += underscore;
145  brName += productInstanceName();
146  brName += underscore;
147  brName += processName();
148  brName += period;
149 
150  if(!branchID_.isValid()) {
151  branchID_.setID(brName);
152  }
153  }
std::string const & branchName() const
std::string const & processName() const
bool isValid() const
Definition: BranchID.h:24
std::string const & moduleLabel() const
std::string const & productInstanceName() const
std::string const & friendlyClassName() const
tuple size
Write out results.
void setID(std::string const &branchName)
Definition: BranchID.h:22
void edm::BranchDescription::initFromDictionary ( )

Definition at line 156 of file BranchDescription.cc.

References cms::Exception::addContext(), basketSize(), branchName(), edm::TypeWithDict::byName(), edm::hlt::Exception, fullClassName(), invalidBasketSize, invalidSplitLevel, setBasketSize(), setSplitLevel(), setTransient(), setUnwrappedType(), setWrappedName(), setWrappedType(), splitLevel(), AlCaHLTBitMon_QueryRunRegistry::string, throwIfInvalid_(), unwrappedType(), edm::wrappedClassName(), wrappedName(), and wrappedType().

Referenced by init().

156  {
157  if(bool(wrappedType())) {
158  return; // already initialized;
159  }
160 
161  throwIfInvalid_();
162 
163  try {
165 
166  // unwrapped type.
168  if(!bool(unwrappedType())) {
171  setTransient(false);
172  return;
173  }
174 
175 
177  if(!bool(wrappedType())) {
180  return;
181  }
182  } catch( edm::Exception& caughtException) {
183  caughtException.addContext(std::string{"While initializing meta data for branch: "}+branchName());
184  throw;
185  }
186  Reflex::PropertyList wp = Reflex::Type::ByTypeInfo(wrappedType().typeInfo()).Properties();
187  setTransient((wp.HasProperty("persistent") ? wp.PropertyAsString("persistent") == std::string("false") : false));
188  if(transient()) {
191  return;
192  }
193  if(wp.HasProperty("splitLevel")) {
194  setSplitLevel(strtol(wp.PropertyAsString("splitLevel").c_str(), 0, 0));
195  if(splitLevel() < 0) {
196  throw cms::Exception("IllegalSplitLevel") << "' An illegal ROOT split level of " <<
197  splitLevel() << " is specified for class " << wrappedName() << ".'\n";
198  }
199  setSplitLevel(splitLevel() + 1); //Compensate for wrapper
200  } else {
202  }
203  if(wp.HasProperty("basketSize")) {
204  setBasketSize(strtol(wp.PropertyAsString("basketSize").c_str(), 0, 0));
205  if(basketSize() <= 0) {
206  throw cms::Exception("IllegalBasketSize") << "' An illegal ROOT basket size of " <<
207  basketSize() << " is specified for class " << wrappedName() << "'.\n";
208  }
209  } else {
211  }
212  }
std::string const & branchName() const
static TypeWithDict byName(std::string const &className)
static int const invalidSplitLevel
static int const invalidBasketSize
void setWrappedType(TypeWithDict const &type)
void setTransient(bool isTransient)
void setWrappedName(std::string const &name)
void setSplitLevel(int level)
TypeWithDict const & unwrappedType() const
std::string const & fullClassName() const
std::string wrappedClassName(std::string const &iFullName)
void addContext(std::string const &context)
Definition: Exception.cc:227
void setUnwrappedType(TypeWithDict const &type)
volatile std::atomic< bool > shutdown_flag false
void setBasketSize(int size)
std::string const & wrappedName() const
TypeWithDict const & wrappedType() const
void edm::BranchDescription::initializeTransients ( )
inline
void edm::BranchDescription::insertBranchAlias ( std::string const &  alias)
inline

Definition at line 106 of file BranchDescription.h.

References branchAliases_.

Referenced by edm::ProductRegistryHelper::addToRegistry().

106  {
107  branchAliases_.insert(alias);
108  }
std::set< std::string > branchAliases_
bool edm::BranchDescription::isAlias ( ) const
inline
void edm::BranchDescription::merge ( BranchDescription const &  other)

Definition at line 215 of file BranchDescription.cc.

References basketSize(), branchAliases(), branchAliases_, invalidBasketSize, invalidSplitLevel, setBasketSize(), setSplitLevel(), and splitLevel().

215  {
216  branchAliases_.insert(other.branchAliases().begin(), other.branchAliases().end());
217  if(splitLevel() == invalidSplitLevel) setSplitLevel(other.splitLevel());
218  if(basketSize() == invalidBasketSize) setBasketSize(other.basketSize());
219  }
static int const invalidSplitLevel
static int const invalidBasketSize
void setSplitLevel(int level)
std::set< std::string > branchAliases_
void setBasketSize(int size)
std::string const& edm::BranchDescription::moduleLabel ( ) const
inline
std::string const& edm::BranchDescription::moduleName ( ) const
inline
bool edm::BranchDescription::onDemand ( ) const
inline
BranchID const& edm::BranchDescription::originalBranchID ( ) const
inline
ParameterSetID const& edm::BranchDescription::parameterSetID ( ) const
inline
bool edm::BranchDescription::present ( ) const
inline
std::string const& edm::BranchDescription::processName ( ) const
inline
bool edm::BranchDescription::produced ( ) const
inline
std::string const& edm::BranchDescription::productInstanceName ( ) const
inline
void edm::BranchDescription::setBasketSize ( int  size)
inline
void edm::BranchDescription::setDropped ( bool  isDropped)
inline
void edm::BranchDescription::setOnDemand ( bool  isOnDemand)
inline
void edm::BranchDescription::setProduced ( bool  isProduced)
inline
void edm::BranchDescription::setSplitLevel ( int  level)
inline
void edm::BranchDescription::setTransient ( bool  isTransient)
inline
void edm::BranchDescription::setUnwrappedType ( TypeWithDict const &  type)
inline
void edm::BranchDescription::setWrappedName ( std::string const &  name)
inline
void edm::BranchDescription::setWrappedType ( TypeWithDict const &  type)
inline
int edm::BranchDescription::splitLevel ( ) const
inline
void edm::BranchDescription::throwIfInvalid_ ( ) const
private

Definition at line 241 of file BranchDescription.cc.

References branchType_, friendlyClassName_, fullClassName_, edm::Hash< I >::isValid(), moduleLabel_, edm::NumBranchTypes, parameterSetID(), processName_, produced(), and edm::throwExceptionWithText().

Referenced by initBranchName(), and initFromDictionary().

241  {
243  throwExceptionWithText("Illegal BranchType detected");
244 
245  if(moduleLabel_.empty())
246  throwExceptionWithText("Module label is not allowed to be empty");
247 
248  if(processName_.empty())
249  throwExceptionWithText("Process name is not allowed to be empty");
250 
251  if(fullClassName_.empty())
252  throwExceptionWithText("Full class name is not allowed to be empty");
253 
254  if(friendlyClassName_.empty())
255  throwExceptionWithText("Friendly class name is not allowed to be empty");
256 
257  if(produced() && !parameterSetID().isValid())
258  throwExceptionWithText("Invalid ParameterSetID detected");
259  }
void throwExceptionWithText(char const *txt)
ParameterSetID const & parameterSetID() const
bool isValid() const
Definition: Hash.h:150
bool edm::BranchDescription::transient ( ) const
inline
TypeWithDict const& edm::BranchDescription::unwrappedType ( ) const
inline
TypeID edm::BranchDescription::unwrappedTypeID ( ) const
inline
void edm::BranchDescription::updateFriendlyClassName ( )
std::string const& edm::BranchDescription::wrappedName ( ) const
inline
TypeWithDict const& edm::BranchDescription::wrappedType ( ) const
inline
TypeID edm::BranchDescription::wrappedTypeID ( ) const
inline
void edm::BranchDescription::write ( std::ostream &  os) const

Definition at line 222 of file BranchDescription.cc.

References branchID(), branchType(), friendlyClassName(), fullClassName(), moduleLabel(), processName(), and productInstanceName().

Referenced by pkg.AbstractPkg::generate(), edm::operator<<(), and edm::Provenance::write().

222  {
223  os << "Branch Type = " << branchType() << std::endl;
224  os << "Process Name = " << processName() << std::endl;
225  os << "ModuleLabel = " << moduleLabel() << std::endl;
226  os << "Branch ID = " << branchID() << '\n';
227  os << "Class Name = " << fullClassName() << '\n';
228  os << "Friendly Class Name = " << friendlyClassName() << '\n';
229  os << "Product Instance Name = " << productInstanceName() << std::endl;
230  }
BranchType const & branchType() const
std::string const & processName() const
std::string const & moduleLabel() const
std::string const & productInstanceName() const
std::string const & friendlyClassName() const
BranchID const & branchID() const
std::string const & fullClassName() const

Member Data Documentation

BranchID edm::BranchDescription::aliasForBranchID_
private

Definition at line 201 of file BranchDescription.h.

Referenced by aliasForBranchID(), isAlias(), and originalBranchID().

std::set<std::string> edm::BranchDescription::branchAliases_
private

Definition at line 196 of file BranchDescription.h.

Referenced by branchAliases(), insertBranchAlias(), and merge().

BranchID edm::BranchDescription::branchID_
private

Definition at line 183 of file BranchDescription.h.

Referenced by branchID(), initBranchName(), and originalBranchID().

BranchType edm::BranchDescription::branchType_
private

Definition at line 173 of file BranchDescription.h.

Referenced by branchType(), and throwIfInvalid_().

std::string edm::BranchDescription::friendlyClassName_
private
std::string edm::BranchDescription::fullClassName_
private

Definition at line 186 of file BranchDescription.h.

Referenced by fullClassName(), and throwIfInvalid_().

int const edm::BranchDescription::invalidBasketSize = 0
static
int const edm::BranchDescription::invalidSplitLevel = -1
static
std::string edm::BranchDescription::moduleLabel_
private
std::string edm::BranchDescription::processName_
private

Definition at line 180 of file BranchDescription.h.

Referenced by initBranchName(), processName(), and throwIfInvalid_().

std::string edm::BranchDescription::productInstanceName_
private

Definition at line 193 of file BranchDescription.h.

Referenced by initBranchName(), and productInstanceName().

Transients edm::BranchDescription::transient_
private