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
 
WrapperInterfaceBase const * getInterface () 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
 
WrapperInterfaceBase *& wrapperInterfaceBase ()
 
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 33 of file BranchDescription.h.

Member Enumeration Documentation

Enumerator
Strict 
Permissive 

Definition at line 37 of file BranchDescription.h.

Constructor & Destructor Documentation

edm::BranchDescription::BranchDescription ( )

Definition at line 41 of file BranchDescription.cc.

41  :
43  moduleLabel_(),
44  processName_(),
45  branchID_(),
51  transient_() {
52  // do not call init here! It will result in an exception throw.
53  }
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 55 of file BranchDescription.cc.

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

66  :
70  branchID_(),
75  transient_() {
76  setDropped(false);
78  setOnDemand(false);
81  setUnwrappedType(theTypeWithDict);
82  init();
83  }
dictionary aliases
Definition: autoCond.py:51
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 85 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().

88  :
89  branchType_(aliasForBranch.branchType()),
90  moduleLabel_(moduleLabelAlias),
91  processName_(aliasForBranch.processName()),
92  branchID_(),
93  fullClassName_(aliasForBranch.className()),
94  friendlyClassName_(aliasForBranch.friendlyClassName()),
95  productInstanceName_(productInstanceAlias),
96  branchAliases_(aliasForBranch.branchAliases()),
97  aliasForBranchID_(aliasForBranch.branchID()),
98  transient_() {
99  setDropped(false);
100  setProduced(aliasForBranch.produced());
101  setOnDemand(aliasForBranch.onDemand());
102  transient_.moduleName_ = aliasForBranch.moduleName();
103  transient_.parameterSetID_ = aliasForBranch.parameterSetID();
104  setUnwrappedType(aliasForBranch.unwrappedType());
105  init();
106  }
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 58 of file BranchDescription.h.

58 {}

Member Function Documentation

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

Definition at line 76 of file BranchDescription.h.

References aliasForBranchID_.

76 {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
WrapperInterfaceBase const * edm::BranchDescription::getInterface ( ) const
void edm::BranchDescription::init ( void  )
inline
void edm::BranchDescription::initBranchName ( )

Definition at line 109 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().

109  {
110  if(!branchName().empty()) {
111  return; // already called
112  }
113  throwIfInvalid_();
114 
115  char const underscore('_');
116  char const period('.');
117 
118  if(friendlyClassName_.find(underscore) != std::string::npos) {
119  throw cms::Exception("IllegalCharacter") << "Class name '" << friendlyClassName()
120  << "' contains an underscore ('_'), which is illegal in the name of a product.\n";
121  }
122 
123  if(moduleLabel_.find(underscore) != std::string::npos) {
124  throw cms::Exception("IllegalCharacter") << "Module label '" << moduleLabel()
125  << "' contains an underscore ('_'), which is illegal in a module label.\n";
126  }
127 
128  if(productInstanceName_.find(underscore) != std::string::npos) {
129  throw cms::Exception("IllegalCharacter") << "Product instance name '" << productInstanceName()
130  << "' contains an underscore ('_'), which is illegal in a product instance name.\n";
131  }
132 
133  if(processName_.find(underscore) != std::string::npos) {
134  throw cms::Exception("IllegalCharacter") << "Process name '" << processName()
135  << "' contains an underscore ('_'), which is illegal in a process name.\n";
136  }
137 
139  brName.reserve(friendlyClassName().size() +
140  moduleLabel().size() +
142  processName().size() + 4);
143  brName += friendlyClassName();
144  brName += underscore;
145  brName += moduleLabel();
146  brName += underscore;
147  brName += productInstanceName();
148  brName += underscore;
149  brName += processName();
150  brName += period;
151 
152  if(!branchID_.isValid()) {
153  branchID_.setID(brName);
154  }
155  }
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 158 of file BranchDescription.cc.

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

Referenced by init().

158  {
159  if(bool(wrappedType())) {
160  return; // already initialized;
161  }
162 
163  throwIfInvalid_();
164 
166 
167  // unwrapped type.
169  if(!bool(unwrappedType())) {
172  setTransient(false);
173  return;
174  }
175 
177  if(!bool(wrappedType())) {
180  return;
181  }
182  wrappedType().invokeByName(wrapperInterfaceBase(), "getInterface");
183  assert(wrapperInterfaceBase() != 0);
184  Reflex::PropertyList wp = Reflex::Type::ByTypeInfo(wrappedType().typeInfo()).Properties();
185  setTransient((wp.HasProperty("persistent") ? wp.PropertyAsString("persistent") == std::string("false") : false));
186  if(transient()) {
189  return;
190  }
191  if(wp.HasProperty("splitLevel")) {
192  setSplitLevel(strtol(wp.PropertyAsString("splitLevel").c_str(), 0, 0));
193  if(splitLevel() < 0) {
194  throw cms::Exception("IllegalSplitLevel") << "' An illegal ROOT split level of " <<
195  splitLevel() << " is specified for class " << wrappedName() << ".'\n";
196  }
197  setSplitLevel(splitLevel() + 1); //Compensate for wrapper
198  } else {
200  }
201  if(wp.HasProperty("basketSize")) {
202  setBasketSize(strtol(wp.PropertyAsString("basketSize").c_str(), 0, 0));
203  if(basketSize() <= 0) {
204  throw cms::Exception("IllegalBasketSize") << "' An illegal ROOT basket size of " <<
205  basketSize() << " is specified for class " << wrappedName() << "'.\n";
206  }
207  } else {
209  }
210  }
static TypeWithDict byName(std::string const &className)
static int const invalidSplitLevel
static int const invalidBasketSize
void invokeByName(T &obj, std::string const &name) const
Definition: TypeWithDict.h:124
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)
WrapperInterfaceBase *& wrapperInterfaceBase()
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 107 of file BranchDescription.h.

References branchAliases_.

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

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

Definition at line 213 of file BranchDescription.cc.

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

213  {
214  branchAliases_.insert(other.branchAliases().begin(), other.branchAliases().end());
215  if(splitLevel() == invalidSplitLevel) setSplitLevel(other.splitLevel());
216  if(basketSize() == invalidBasketSize) setBasketSize(other.basketSize());
217  }
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 239 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().

239  {
241  throwExceptionWithText("Illegal BranchType detected");
242 
243  if(moduleLabel_.empty())
244  throwExceptionWithText("Module label is not allowed to be empty");
245 
246  if(processName_.empty())
247  throwExceptionWithText("Process name is not allowed to be empty");
248 
249  if(fullClassName_.empty())
250  throwExceptionWithText("Full class name is not allowed to be empty");
251 
252  if(friendlyClassName_.empty())
253  throwExceptionWithText("Friendly class name is not allowed to be empty");
254 
255  if(produced() && !parameterSetID().isValid())
256  throwExceptionWithText("Invalid ParameterSetID detected");
257  }
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
WrapperInterfaceBase*& edm::BranchDescription::wrapperInterfaceBase ( )
inline
void edm::BranchDescription::write ( std::ostream &  os) const

Definition at line 220 of file BranchDescription.cc.

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

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

220  {
221  os << "Branch Type = " << branchType() << std::endl;
222  os << "Process Name = " << processName() << std::endl;
223  os << "ModuleLabel = " << moduleLabel() << std::endl;
224  os << "Branch ID = " << branchID() << '\n';
225  os << "Class Name = " << fullClassName() << '\n';
226  os << "Friendly Class Name = " << friendlyClassName() << '\n';
227  os << "Product Instance Name = " << productInstanceName() << std::endl;
228  }
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 207 of file BranchDescription.h.

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

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

Definition at line 202 of file BranchDescription.h.

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

BranchID edm::BranchDescription::branchID_
private

Definition at line 189 of file BranchDescription.h.

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

BranchType edm::BranchDescription::branchType_
private

Definition at line 179 of file BranchDescription.h.

Referenced by branchType(), and throwIfInvalid_().

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

Definition at line 192 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 186 of file BranchDescription.h.

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

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

Definition at line 199 of file BranchDescription.h.

Referenced by initBranchName(), and productInstanceName().

Transients edm::BranchDescription::transient_
private