Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
art::BranchDescription Class Reference

#include <BranchDescription.h>

Classes

struct  Transients
 

Public Member Functions

 BranchDescription ()=default
 
 BranchDescription (BranchType const bt, TypeLabel const &tl, std::string const &moduleLabel, fhicl::ParameterSetID const &modulePSetID, ProcessConfiguration const &processConfig)
 
 BranchDescription (BranchType bt, std::string const &moduleLabel, std::string const &processName, std::string const &producedClassName, std::string const &productInstanceName, fhicl::ParameterSetID const &psetID, ProcessConfigurationID const &processConfigurationID, Transients::validity_state validity, bool supportsView, bool transient)
 
void write (std::ostream &os) const
 
std::string const & moduleLabel () const noexcept
 
std::string const & processName () const noexcept
 
std::string const & producedClassName () const noexcept
 
std::string const & friendlyClassName () const noexcept
 
std::string const & productInstanceName () const noexcept
 
InputTag inputTag () const
 
bool produced () const noexcept
 
bool present () const noexcept
 
bool dropped () const noexcept
 
bool transient () const noexcept
 
int splitLevel () const noexcept
 
int basketSize () const noexcept
 
int compression () const noexcept
 
std::set< fhicl::ParameterSetID > const & psetIDs () const noexcept
 
ProductID productID () const noexcept
 
BranchType branchType () const noexcept
 
bool supportsView () const noexcept
 
std::string const & branchName () const noexcept
 
std::string const & wrappedName () const noexcept
 
void merge (BranchDescription const &other)
 
void swap (BranchDescription &other)
 
void setValidity (Transients::validity_state const state)
 

Static Public Attributes

static int constexpr invalidSplitLevel {-1}
 
static int constexpr invalidBasketSize {0}
 
static int constexpr invalidCompression {-1}
 

Private Member Functions

fhicl::ParameterSetID const & psetID () const
 
void initProductID_ ()
 
void fluffTransients_ () const
 
bool transientsFluffed_ () const noexcept
 
bool isPsetIDUnique () const noexcept
 
std::set< ProcessConfigurationID > const & processConfigurationIDs () const noexcept
 
Transientsguts () noexcept
 
Transients const & guts () const noexcept
 
void throwIfInvalid_ () const
 

Private Attributes

BranchType branchType_ {InEvent}
 
std::string moduleLabel_ {}
 
std::string processName_ {}
 
ProductID productID_ {}
 
std::string producedClassName_ {}
 
std::string friendlyClassName_ {}
 
std::string productInstanceName_ {}
 
bool supportsView_ {false}
 
std::set< fhicl::ParameterSetIDpsetIDs_ {}
 
std::set< ProcessConfigurationIDprocessConfigurationIDs_ {}
 
Transient< Transientstransients_ {}
 

Friends

class detail::BranchDescriptionStreamer
 
bool combinable (BranchDescription const &, BranchDescription const &)
 
bool operator< (BranchDescription const &, BranchDescription const &)
 
bool operator== (BranchDescription const &, BranchDescription const &)
 

Detailed Description

Definition at line 41 of file BranchDescription.h.

Constructor & Destructor Documentation

art::BranchDescription::BranchDescription ( )
default
art::BranchDescription::BranchDescription ( BranchType const  bt,
TypeLabel const &  tl,
std::string const &  moduleLabel,
fhicl::ParameterSetID const &  modulePSetID,
ProcessConfiguration const &  processConfig 
)

Definition at line 33 of file BranchDescription.cc.

40  tl.hasEmulatedModule() ? tl.emulatedModule() :
42  processConfig.processName(),
43  tl.className(),
44  tl.productInstanceName(),
45  modulePSetID,
46  processConfig.id(),
47  tl.hasEmulatedModule() ? Transients::PresentFromSource :
49  tl.supportsView(),
50  tl.transient()}
51  {}
bt
Definition: tracks.py:83
std::string const & moduleLabel() const noexcept
art::BranchDescription::BranchDescription ( BranchType  bt,
std::string const &  moduleLabel,
std::string const &  processName,
std::string const &  producedClassName,
std::string const &  productInstanceName,
fhicl::ParameterSetID const &  psetID,
ProcessConfigurationID const &  processConfigurationID,
Transients::validity_state  validity,
bool  supportsView,
bool  transient 
)

Definition at line 53 of file BranchDescription.cc.

71  {
72  guts().validity_ = validity;
73  guts().transient_ = transient;
74  psetIDs_.insert(psetID);
75  processConfigurationIDs_.insert(processConfigurationID);
79  }
fhicl::ParameterSetID const & psetID() const
void fluffTransients_() const
bool supportsView() const noexcept
std::set< ProcessConfigurationID > processConfigurationIDs_
std::string const & processName() const noexcept
BranchType branchType() const noexcept
std::string friendlyName(std::string const &iFullName)
std::string const & moduleLabel() const noexcept
std::set< fhicl::ParameterSetID > psetIDs_
std::string const & productInstanceName() const noexcept
std::string const & producedClassName() const noexcept
Transients & guts() noexcept

Member Function Documentation

int art::BranchDescription::basketSize ( ) const
inlinenoexcept

Definition at line 171 of file BranchDescription.h.

172  {
173  return guts().basketSize_;
174  }
Transients & guts() noexcept
std::string const& art::BranchDescription::branchName ( ) const
inlinenoexcept

Definition at line 203 of file BranchDescription.h.

204  {
205  return guts().branchName_;
206  }
Transients & guts() noexcept
BranchType art::BranchDescription::branchType ( ) const
inlinenoexcept

Definition at line 193 of file BranchDescription.h.

194  {
195  return branchType_;
196  }
int art::BranchDescription::compression ( ) const
inlinenoexcept

Definition at line 176 of file BranchDescription.h.

177  {
178  return guts().compression_;
179  }
Transients & guts() noexcept
bool art::BranchDescription::dropped ( ) const
inlinenoexcept

Definition at line 155 of file BranchDescription.h.

void art::BranchDescription::fluffTransients_ ( ) const
private

Definition at line 93 of file BranchDescription.cc.

94  {
95  if (transientsFluffed_()) {
96  return;
97  }
98  transients_.get().branchName_ = canonicalProductName(
100  transients_.get().wrappedName_ = wrappedClassName(producedClassName_);
101  }
std::string wrappedClassName(std::string const &className)
std::string const & processName() const noexcept
std::string canonicalProductName(std::string const &friendlyClassName, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName)
std::string const & moduleLabel() const noexcept
bool transientsFluffed_() const noexcept
std::string const & productInstanceName() const noexcept
std::string const & friendlyClassName() const noexcept
Transient< Transients > transients_
std::string const& art::BranchDescription::friendlyClassName ( ) const
inlinenoexcept

Definition at line 129 of file BranchDescription.h.

130  {
131  return friendlyClassName_;
132  }
BranchDescription::Transients & art::BranchDescription::guts ( )
privatenoexcept

Definition at line 234 of file BranchDescription.cc.

235  {
236  return transients_.get();
237  }
Transient< Transients > transients_
BranchDescription::Transients const & art::BranchDescription::guts ( ) const
privatenoexcept

Definition at line 240 of file BranchDescription.cc.

241  {
242  return transients_.get();
243  }
Transient< Transients > transients_
void art::BranchDescription::initProductID_ ( )
private

Definition at line 82 of file BranchDescription.cc.

83  {
84  if (!transientsFluffed_()) {
85  return;
86  }
87  if (!productID_.isValid()) {
88  productID_.setID(guts().branchName_);
89  }
90  }
constexpr bool isValid() const noexcept
Definition: ProductID.h:34
void setID(std::string const &canonicalProductName)
Definition: ProductID.cc:13
bool transientsFluffed_() const noexcept
Transients & guts() noexcept
InputTag art::BranchDescription::inputTag ( ) const
inline

Definition at line 139 of file BranchDescription.h.

140  {
141  return InputTag{moduleLabel(), productInstanceName(), processName()};
142  }
std::string const & processName() const noexcept
std::string const & moduleLabel() const noexcept
std::string const & productInstanceName() const noexcept
bool art::BranchDescription::isPsetIDUnique ( ) const
privatenoexcept

Definition at line 222 of file BranchDescription.cc.

223  {
224  return psetIDs().size() == 1;
225  }
std::set< fhicl::ParameterSetID > const & psetIDs() const noexcept
void art::BranchDescription::merge ( BranchDescription const &  other)

Definition at line 119 of file BranchDescription.cc.

120  {
121  psetIDs_.insert(other.psetIDs().begin(), other.psetIDs().end());
122  processConfigurationIDs_.insert(other.processConfigurationIDs().begin(),
123  other.processConfigurationIDs().end());
125  guts().splitLevel_ = other.guts().splitLevel_;
126  }
127  if (guts().basketSize_ == invalidBasketSize) {
128  guts().basketSize_ = other.guts().basketSize_;
129  }
130  // FIXME: This is probably wrong! We are going from defaulted compression
131  // to a possibly different compression, bad.
132  if (guts().compression_ == invalidCompression) {
133  guts().compression_ = other.guts().compression_;
134  }
135  }
static int constexpr invalidCompression
std::set< ProcessConfigurationID > processConfigurationIDs_
static int constexpr invalidSplitLevel
std::set< fhicl::ParameterSetID > psetIDs_
static int constexpr invalidBasketSize
Transients & guts() noexcept
std::string const& art::BranchDescription::moduleLabel ( ) const
inlinenoexcept

Definition at line 114 of file BranchDescription.h.

115  {
116  return moduleLabel_;
117  }
bool art::BranchDescription::present ( ) const
inlinenoexcept
set< ProcessConfigurationID > const & art::BranchDescription::processConfigurationIDs ( ) const
privatenoexcept

Definition at line 228 of file BranchDescription.cc.

229  {
231  }
std::set< ProcessConfigurationID > processConfigurationIDs_
std::string const& art::BranchDescription::processName ( ) const
inlinenoexcept

Definition at line 119 of file BranchDescription.h.

120  {
121  return processName_;
122  }
bool art::BranchDescription::produced ( ) const
inlinenoexcept
std::string const& art::BranchDescription::producedClassName ( ) const
inlinenoexcept

Definition at line 124 of file BranchDescription.h.

125  {
126  return producedClassName_;
127  }
ProductID art::BranchDescription::productID ( ) const
inlinenoexcept

Definition at line 188 of file BranchDescription.h.

189  {
190  return productID_;
191  }
std::string const& art::BranchDescription::productInstanceName ( ) const
inlinenoexcept

Definition at line 134 of file BranchDescription.h.

135  {
136  return productInstanceName_;
137  }
ParameterSetID const & art::BranchDescription::psetID ( ) const
private

Definition at line 104 of file BranchDescription.cc.

105  {
106  assert(!psetIDs().empty());
107  if (psetIDs().size() != 1) {
108  throw Exception(errors::Configuration, "AmbiguousProvenance")
109  << "Your application requires all events on Branch '"
110  << guts().branchName_
111  << "'\n to have the same provenance. This file has events with "
112  "mixed provenance\n"
113  << "on this branch. Use a different input file.\n";
114  }
115  return *psetIDs().begin();
116  }
std::set< fhicl::ParameterSetID > const & psetIDs() const noexcept
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Transients & guts() noexcept
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
std::set<fhicl::ParameterSetID> const& art::BranchDescription::psetIDs ( ) const
inlinenoexcept

Definition at line 182 of file BranchDescription.h.

183  {
184  return psetIDs_;
185  }
std::set< fhicl::ParameterSetID > psetIDs_
void art::BranchDescription::setValidity ( Transients::validity_state const  state)
inline

Definition at line 217 of file BranchDescription.h.

218  {
219  guts().validity_ = state;
220  }
Transients & guts() noexcept
int art::BranchDescription::splitLevel ( ) const
inlinenoexcept

Definition at line 166 of file BranchDescription.h.

167  {
168  return guts().splitLevel_;
169  }
Transients & guts() noexcept
bool art::BranchDescription::supportsView ( ) const
inlinenoexcept

Definition at line 198 of file BranchDescription.h.

199  {
200  return supportsView_;
201  }
void art::BranchDescription::swap ( BranchDescription other)

Definition at line 150 of file BranchDescription.cc.

151  {
152  using std::swap;
153  swap(branchType_, other.branchType_);
154  swap(moduleLabel_, other.moduleLabel_);
155  swap(processName_, other.processName_);
156  swap(productID_, other.productID_);
157  swap(producedClassName_, other.producedClassName_);
158  swap(friendlyClassName_, other.friendlyClassName_);
159  swap(productInstanceName_, other.productInstanceName_);
160  swap(supportsView_, other.supportsView_);
161  swap(psetIDs_, other.psetIDs_);
162  swap(processConfigurationIDs_, other.processConfigurationIDs_);
163  swap(transients_, other.transients_);
164  }
std::set< ProcessConfigurationID > processConfigurationIDs_
void swap(Handle< T > &a, Handle< T > &b)
void swap(BranchDescription &other)
std::set< fhicl::ParameterSetID > psetIDs_
Transient< Transients > transients_
void art::BranchDescription::throwIfInvalid_ ( ) const
private

Definition at line 168 of file BranchDescription.cc.

169  {
170  constexpr char underscore('_');
171  if (transientsFluffed_()) {
172  return;
173  }
174  if (branchType_ >= NumBranchTypes) {
175  throwExceptionWithText("Illegal BranchType detected");
176  }
177  if (moduleLabel_.empty()) {
178  throwExceptionWithText("Module label is not allowed to be empty");
179  }
180  if (processName_.empty()) {
181  throwExceptionWithText("Process name is not allowed to be empty");
182  }
183  if (producedClassName_.empty()) {
184  throwExceptionWithText("Full class name is not allowed to be empty");
185  }
186  if (friendlyClassName_.empty()) {
187  throwExceptionWithText("Friendly class name is not allowed to be empty");
188  }
189  if (friendlyClassName_.find(underscore) != string::npos) {
190  throw Exception(errors::LogicError, "IllegalCharacter")
191  << "Class name '" << friendlyClassName()
192  << "' contains an underscore ('_'), which is illegal in the "
193  << "name of a product.\n";
194  }
195  if (moduleLabel_.find(underscore) != string::npos) {
196  throw Exception(errors::Configuration, "IllegalCharacter")
197  << "Module label '" << moduleLabel()
198  << "' contains an underscore ('_'), which is illegal in a "
199  << "module label.\n";
200  }
201  if (productInstanceName_.find(underscore) != string::npos) {
202  throw Exception(errors::Configuration, "IllegalCharacter")
203  << "Product instance name '" << productInstanceName()
204  << "' contains an underscore ('_'), which is illegal in a "
205  << "product instance name.\n";
206  }
207  if (processName_.find(underscore) != string::npos) {
208  throw Exception(errors::Configuration, "IllegalCharacter")
209  << "Process name '" << processName()
210  << "' contains an underscore ('_'), which is illegal in a "
211  << "process name.\n";
212  }
213  }
std::string const & processName() const noexcept
std::string const & moduleLabel() const noexcept
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool transientsFluffed_() const noexcept
std::string const & productInstanceName() const noexcept
std::string const & friendlyClassName() const noexcept
bool art::BranchDescription::transient ( ) const
inlinenoexcept

Definition at line 160 of file BranchDescription.h.

161  {
162  return guts().transient_;
163  }
Transients & guts() noexcept
bool art::BranchDescription::transientsFluffed_ ( ) const
privatenoexcept

Definition at line 216 of file BranchDescription.cc.

217  {
218  return !guts().branchName_.empty();
219  }
Transients & guts() noexcept
std::string const& art::BranchDescription::wrappedName ( ) const
inlinenoexcept

Definition at line 208 of file BranchDescription.h.

209  {
210  return guts().wrappedName_;
211  }
Transients & guts() noexcept
void art::BranchDescription::write ( std::ostream &  os) const

Definition at line 138 of file BranchDescription.cc.

139  {
140  os << "Branch Type = " << branchType_ << endl;
141  os << "Process Name = " << processName() << endl;
142  os << "ModuleLabel = " << moduleLabel() << endl;
143  os << "Product ID = " << productID() << '\n';
144  os << "Class Name = " << producedClassName() << '\n';
145  os << "Friendly Class Name = " << friendlyClassName() << '\n';
146  os << "Product Instance Name = " << productInstanceName() << endl;
147  }
std::string const & processName() const noexcept
std::string const & moduleLabel() const noexcept
std::string const & productInstanceName() const noexcept
std::string const & producedClassName() const noexcept
std::string const & friendlyClassName() const noexcept
ProductID productID() const noexcept
QTextStream & endl(QTextStream &s)

Friends And Related Function Documentation

bool combinable ( BranchDescription const &  ,
BranchDescription const &   
)
friend

Definition at line 306 of file BranchDescription.cc.

307  {
308  return (a.branchType() == b.branchType()) &&
309  (a.processName() == b.processName()) &&
310  (a.producedClassName() == b.producedClassName()) &&
311  (a.friendlyClassName() == b.friendlyClassName()) &&
312  (a.productInstanceName() == b.productInstanceName()) &&
313  (a.moduleLabel() == b.moduleLabel()) &&
314  (a.productID() == b.productID());
315  }
const double a
static bool * b
Definition: config.cpp:1043
friend class detail::BranchDescriptionStreamer
friend

Definition at line 47 of file BranchDescription.h.

bool operator< ( BranchDescription const &  ,
BranchDescription const &   
)
friend

Definition at line 246 of file BranchDescription.cc.

247  {
248  if (a.processName() < b.processName()) {
249  return true;
250  }
251  if (b.processName() < a.processName()) {
252  return false;
253  }
254  if (a.producedClassName() < b.producedClassName()) {
255  return true;
256  }
257  if (b.producedClassName() < a.producedClassName()) {
258  return false;
259  }
260  if (a.friendlyClassName() < b.friendlyClassName()) {
261  return true;
262  }
263  if (b.friendlyClassName() < a.friendlyClassName()) {
264  return false;
265  }
266  if (a.productInstanceName() < b.productInstanceName()) {
267  return true;
268  }
269  if (b.productInstanceName() < a.productInstanceName()) {
270  return false;
271  }
272  if (a.moduleLabel() < b.moduleLabel()) {
273  return true;
274  }
275  if (b.moduleLabel() < a.moduleLabel()) {
276  return false;
277  }
278  if (a.branchType() < b.branchType()) {
279  return true;
280  }
281  if (b.branchType() < a.branchType()) {
282  return false;
283  }
284  if (a.productID() < b.productID()) {
285  return true;
286  }
287  if (b.productID() < a.productID()) {
288  return false;
289  }
290  if (a.psetIDs() < b.psetIDs()) {
291  return true;
292  }
293  if (b.psetIDs() < a.psetIDs()) {
294  return false;
295  }
296  if (a.processConfigurationIDs() < b.processConfigurationIDs()) {
297  return true;
298  }
299  if (b.processConfigurationIDs() < a.processConfigurationIDs()) {
300  return false;
301  }
302  return false;
303  }
const double a
static bool * b
Definition: config.cpp:1043
bool operator== ( BranchDescription const &  ,
BranchDescription const &   
)
friend

Definition at line 318 of file BranchDescription.cc.

319  {
320  return combinable(a, b) && (a.psetIDs() == b.psetIDs()) &&
321  (a.processConfigurationIDs() == b.processConfigurationIDs());
322  }
const double a
static bool * b
Definition: config.cpp:1043
friend bool combinable(BranchDescription const &, BranchDescription const &)

Member Data Documentation

BranchType art::BranchDescription::branchType_ {InEvent}
private

Definition at line 239 of file BranchDescription.h.

std::string art::BranchDescription::friendlyClassName_ {}
private

Definition at line 255 of file BranchDescription.h.

int constexpr art::BranchDescription::invalidBasketSize {0}
static

Definition at line 51 of file BranchDescription.h.

int constexpr art::BranchDescription::invalidCompression {-1}
static

Definition at line 52 of file BranchDescription.h.

int constexpr art::BranchDescription::invalidSplitLevel {-1}
static

Definition at line 50 of file BranchDescription.h.

std::string art::BranchDescription::moduleLabel_ {}
private

Definition at line 243 of file BranchDescription.h.

std::set<ProcessConfigurationID> art::BranchDescription::processConfigurationIDs_ {}
private

Definition at line 270 of file BranchDescription.h.

std::string art::BranchDescription::processName_ {}
private

Definition at line 246 of file BranchDescription.h.

std::string art::BranchDescription::producedClassName_ {}
private

Definition at line 252 of file BranchDescription.h.

ProductID art::BranchDescription::productID_ {}
private

Definition at line 249 of file BranchDescription.h.

std::string art::BranchDescription::productInstanceName_ {}
private

Definition at line 259 of file BranchDescription.h.

std::set<fhicl::ParameterSetID> art::BranchDescription::psetIDs_ {}
private

Definition at line 266 of file BranchDescription.h.

bool art::BranchDescription::supportsView_ {false}
private

Definition at line 262 of file BranchDescription.h.

Transient<Transients> art::BranchDescription::transients_ {}
mutableprivate

Definition at line 273 of file BranchDescription.h.


The documentation for this class was generated from the following files: