LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::BranchDescription Class Reference

#include "BranchDescription.h"

Classes

struct  Transients
 

Public Member Functions

 BranchDescription ()
 
 BranchDescription (BranchDescription const &)
 
 BranchDescription (BranchDescription &&)
 
BranchDescriptionoperator= (BranchDescription const &)
 
BranchDescriptionoperator= (BranchDescription &&)
 
 ~BranchDescription ()
 
 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 ( BranchDescription const &  )
default
art::BranchDescription::BranchDescription ( BranchDescription &&  )
default
art::BranchDescription::~BranchDescription ( )
default
art::BranchDescription::BranchDescription ( BranchType const  bt,
TypeLabel const &  tl,
std::string const &  moduleLabel,
fhicl::ParameterSetID const &  modulePSetID,
ProcessConfiguration const &  processConfig 
)
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 62 of file BranchDescription.cc.

References fluffTransients_(), friendlyClassName_, art::friendlyname::friendlyName(), guts(), initProductID_(), moduleLabel(), moduleLabel_, processConfigurationIDs_, processName(), processName_, producedClassName(), producedClassName_, productInstanceName(), productInstanceName_, psetID(), psetIDs_, supportsView(), supportsView_, throwIfInvalid_(), art::BranchDescription::Transients::transient_, and art::BranchDescription::Transients::validity_.

80  {
81  guts().validity_ = validity;
82  guts().transient_ = transient;
83  psetIDs_.insert(psetID);
84  processConfigurationIDs_.insert(processConfigurationID);
88  }
fhicl::ParameterSetID const & psetID() 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 176 of file BranchDescription.h.

177  {
178  return guts().basketSize_;
179  }
Transients & guts() noexcept
std::string const& art::BranchDescription::branchName ( ) const
inlinenoexcept

Definition at line 208 of file BranchDescription.h.

Referenced by art::Principal::put().

209  {
210  return guts().branchName_;
211  }
Transients & guts() noexcept
BranchType art::BranchDescription::branchType ( ) const
inlinenoexcept
int art::BranchDescription::compression ( ) const
inlinenoexcept

Definition at line 181 of file BranchDescription.h.

182  {
183  return guts().compression_;
184  }
Transients & guts() noexcept
bool art::BranchDescription::dropped ( ) const
inlinenoexcept
void art::BranchDescription::fluffTransients_ ( ) const
private

Definition at line 102 of file BranchDescription.cc.

References art::canonicalProductName(), friendlyClassName(), moduleLabel(), processName(), producedClassName_, productInstanceName(), transients_, transientsFluffed_(), and art::wrappedClassName().

Referenced by BranchDescription().

103  {
104  if (transientsFluffed_()) {
105  return;
106  }
107  transients_.get().branchName_ = canonicalProductName(
109  transients_.get().wrappedName_ = wrappedClassName(producedClassName_);
110  }
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
BranchDescription::Transients & art::BranchDescription::guts ( )
privatenoexcept

Definition at line 243 of file BranchDescription.cc.

References transients_.

Referenced by BranchDescription(), initProductID_(), merge(), psetID(), and transientsFluffed_().

244  {
245  return transients_.get();
246  }
Transient< Transients > transients_
BranchDescription::Transients const & art::BranchDescription::guts ( ) const
privatenoexcept

Definition at line 249 of file BranchDescription.cc.

References transients_.

250  {
251  return transients_.get();
252  }
Transient< Transients > transients_
void art::BranchDescription::initProductID_ ( )
private

Definition at line 91 of file BranchDescription.cc.

References guts(), art::ProductID::isValid(), productID_, art::ProductID::setID(), and transientsFluffed_().

Referenced by BranchDescription().

92  {
93  if (!transientsFluffed_()) {
94  return;
95  }
96  if (!productID_.isValid()) {
97  productID_.setID(guts().branchName_);
98  }
99  }
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 144 of file BranchDescription.h.

145  {
146  return InputTag{moduleLabel(), productInstanceName(), processName()};
147  }
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 231 of file BranchDescription.cc.

References psetIDs().

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

Definition at line 128 of file BranchDescription.cc.

References art::BranchDescription::Transients::basketSize_, art::BranchDescription::Transients::compression_, guts(), invalidBasketSize, invalidCompression, invalidSplitLevel, processConfigurationIDs(), processConfigurationIDs_, psetIDs(), psetIDs_, and art::BranchDescription::Transients::splitLevel_.

129  {
130  psetIDs_.insert(other.psetIDs().begin(), other.psetIDs().end());
131  processConfigurationIDs_.insert(other.processConfigurationIDs().begin(),
132  other.processConfigurationIDs().end());
134  guts().splitLevel_ = other.guts().splitLevel_;
135  }
136  if (guts().basketSize_ == invalidBasketSize) {
137  guts().basketSize_ = other.guts().basketSize_;
138  }
139  // FIXME: This is probably wrong! We are going from defaulted compression
140  // to a possibly different compression, bad.
141  if (guts().compression_ == invalidCompression) {
142  guts().compression_ = other.guts().compression_;
143  }
144  }
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
BranchDescription & art::BranchDescription::operator= ( BranchDescription const &  )
default
BranchDescription & art::BranchDescription::operator= ( BranchDescription &&  )
default
bool art::BranchDescription::present ( ) const
inlinenoexcept
set< ProcessConfigurationID > const & art::BranchDescription::processConfigurationIDs ( ) const
privatenoexcept

Definition at line 237 of file BranchDescription.cc.

References processConfigurationIDs_.

Referenced by merge(), art::operator<(), and art::operator==().

238  {
240  }
std::set< ProcessConfigurationID > processConfigurationIDs_
bool art::BranchDescription::produced ( ) const
inlinenoexcept
std::string const& art::BranchDescription::producedClassName ( ) const
inlinenoexcept

Definition at line 129 of file BranchDescription.h.

Referenced by BranchDescription(), art::combinable(), art::operator<(), and write().

130  {
131  return producedClassName_;
132  }
ProductID art::BranchDescription::productID ( ) const
inlinenoexcept
std::string const& art::BranchDescription::productInstanceName ( ) const
inlinenoexcept
ParameterSetID const & art::BranchDescription::psetID ( ) const
private

Definition at line 113 of file BranchDescription.cc.

References art::BranchDescription::Transients::branchName_, art::errors::Configuration, util::empty(), guts(), psetIDs(), and util::size().

Referenced by BranchDescription().

114  {
115  assert(!psetIDs().empty());
116  if (psetIDs().size() != 1) {
117  throw Exception(errors::Configuration, "AmbiguousProvenance")
118  << "Your application requires all events on Branch '"
119  << guts().branchName_
120  << "'\n to have the same provenance. This file has events with "
121  "mixed provenance\n"
122  << "on this branch. Use a different input file.\n";
123  }
124  return *psetIDs().begin();
125  }
std::set< fhicl::ParameterSetID > const & psetIDs() const noexcept
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
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:109
std::set<fhicl::ParameterSetID> const& art::BranchDescription::psetIDs ( ) const
inlinenoexcept

Definition at line 187 of file BranchDescription.h.

Referenced by isPsetIDUnique(), merge(), art::operator<(), art::operator==(), and psetID().

188  {
189  return psetIDs_;
190  }
std::set< fhicl::ParameterSetID > psetIDs_
void art::BranchDescription::setValidity ( Transients::validity_state const  state)
inline

Definition at line 222 of file BranchDescription.h.

223  {
224  guts().validity_ = state;
225  }
Transients & guts() noexcept
int art::BranchDescription::splitLevel ( ) const
inlinenoexcept

Definition at line 171 of file BranchDescription.h.

172  {
173  return guts().splitLevel_;
174  }
Transients & guts() noexcept
bool art::BranchDescription::supportsView ( ) const
inlinenoexcept

Definition at line 203 of file BranchDescription.h.

Referenced by BranchDescription().

204  {
205  return supportsView_;
206  }
void art::BranchDescription::swap ( BranchDescription other)

Definition at line 159 of file BranchDescription.cc.

References branchType_, friendlyClassName_, moduleLabel_, processConfigurationIDs_, processName_, producedClassName_, productID_, productInstanceName_, psetIDs_, supportsView_, std::swap(), and transients_.

160  {
161  using std::swap;
162  swap(branchType_, other.branchType_);
163  swap(moduleLabel_, other.moduleLabel_);
164  swap(processName_, other.processName_);
165  swap(productID_, other.productID_);
166  swap(producedClassName_, other.producedClassName_);
167  swap(friendlyClassName_, other.friendlyClassName_);
168  swap(productInstanceName_, other.productInstanceName_);
169  swap(supportsView_, other.supportsView_);
170  swap(psetIDs_, other.psetIDs_);
171  swap(processConfigurationIDs_, other.processConfigurationIDs_);
172  swap(transients_, other.transients_);
173  }
std::set< ProcessConfigurationID > processConfigurationIDs_
void swap(BranchDescription &other)
std::set< fhicl::ParameterSetID > psetIDs_
void swap(lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &a, lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &b)
Transient< Transients > transients_
void art::BranchDescription::throwIfInvalid_ ( ) const
private

Definition at line 177 of file BranchDescription.cc.

References branchType_, art::errors::Configuration, friendlyClassName(), friendlyClassName_, art::errors::LogicError, moduleLabel(), moduleLabel_, art::NumBranchTypes, processName(), processName_, producedClassName_, productInstanceName(), productInstanceName_, and transientsFluffed_().

Referenced by BranchDescription().

178  {
179  constexpr char underscore('_');
180  if (transientsFluffed_()) {
181  return;
182  }
183  if (branchType_ >= NumBranchTypes) {
184  throwExceptionWithText("Illegal BranchType detected");
185  }
186  if (moduleLabel_.empty()) {
187  throwExceptionWithText("Module label is not allowed to be empty");
188  }
189  if (processName_.empty()) {
190  throwExceptionWithText("Process name is not allowed to be empty");
191  }
192  if (producedClassName_.empty()) {
193  throwExceptionWithText("Full class name is not allowed to be empty");
194  }
195  if (friendlyClassName_.empty()) {
196  throwExceptionWithText("Friendly class name is not allowed to be empty");
197  }
198  if (friendlyClassName_.find(underscore) != string::npos) {
199  throw Exception(errors::LogicError, "IllegalCharacter")
200  << "Class name '" << friendlyClassName()
201  << "' contains an underscore ('_'), which is illegal in the "
202  << "name of a product.\n";
203  }
204  if (moduleLabel_.find(underscore) != string::npos) {
205  throw Exception(errors::Configuration, "IllegalCharacter")
206  << "Module label '" << moduleLabel()
207  << "' contains an underscore ('_'), which is illegal in a "
208  << "module label.\n";
209  }
210  if (productInstanceName_.find(underscore) != string::npos) {
211  throw Exception(errors::Configuration, "IllegalCharacter")
212  << "Product instance name '" << productInstanceName()
213  << "' contains an underscore ('_'), which is illegal in a "
214  << "product instance name.\n";
215  }
216  if (processName_.find(underscore) != string::npos) {
217  throw Exception(errors::Configuration, "IllegalCharacter")
218  << "Process name '" << processName()
219  << "' contains an underscore ('_'), which is illegal in a "
220  << "process name.\n";
221  }
222  }
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 165 of file BranchDescription.h.

166  {
167  return guts().transient_;
168  }
Transients & guts() noexcept
bool art::BranchDescription::transientsFluffed_ ( ) const
privatenoexcept

Definition at line 225 of file BranchDescription.cc.

References art::BranchDescription::Transients::branchName_, and guts().

Referenced by fluffTransients_(), initProductID_(), and throwIfInvalid_().

226  {
227  return !guts().branchName_.empty();
228  }
Transients & guts() noexcept
std::string const& art::BranchDescription::wrappedName ( ) const
inlinenoexcept

Definition at line 213 of file BranchDescription.h.

References fhicl::other, and art::swap().

214  {
215  return guts().wrappedName_;
216  }
Transients & guts() noexcept
void art::BranchDescription::write ( std::ostream &  os) const

Definition at line 147 of file BranchDescription.cc.

References branchType_, friendlyClassName(), moduleLabel(), processName(), producedClassName(), productID(), and productInstanceName().

Referenced by art::operator<<().

148  {
149  os << "Branch Type = " << branchType_ << endl;
150  os << "Process Name = " << processName() << endl;
151  os << "ModuleLabel = " << moduleLabel() << endl;
152  os << "Product ID = " << productID() << '\n';
153  os << "Class Name = " << producedClassName() << '\n';
154  os << "Friendly Class Name = " << friendlyClassName() << '\n';
155  os << "Product Instance Name = " << productInstanceName() << endl;
156  }
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

Friends And Related Function Documentation

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

Definition at line 315 of file BranchDescription.cc.

Referenced by art::operator==().

316  {
317  return (a.branchType() == b.branchType()) &&
318  (a.processName() == b.processName()) &&
319  (a.producedClassName() == b.producedClassName()) &&
320  (a.friendlyClassName() == b.friendlyClassName()) &&
321  (a.productInstanceName() == b.productInstanceName()) &&
322  (a.moduleLabel() == b.moduleLabel()) &&
323  (a.productID() == b.productID());
324  }
friend class detail::BranchDescriptionStreamer
friend

Definition at line 47 of file BranchDescription.h.

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

Definition at line 255 of file BranchDescription.cc.

256  {
257  if (a.processName() < b.processName()) {
258  return true;
259  }
260  if (b.processName() < a.processName()) {
261  return false;
262  }
263  if (a.producedClassName() < b.producedClassName()) {
264  return true;
265  }
266  if (b.producedClassName() < a.producedClassName()) {
267  return false;
268  }
269  if (a.friendlyClassName() < b.friendlyClassName()) {
270  return true;
271  }
272  if (b.friendlyClassName() < a.friendlyClassName()) {
273  return false;
274  }
275  if (a.productInstanceName() < b.productInstanceName()) {
276  return true;
277  }
278  if (b.productInstanceName() < a.productInstanceName()) {
279  return false;
280  }
281  if (a.moduleLabel() < b.moduleLabel()) {
282  return true;
283  }
284  if (b.moduleLabel() < a.moduleLabel()) {
285  return false;
286  }
287  if (a.branchType() < b.branchType()) {
288  return true;
289  }
290  if (b.branchType() < a.branchType()) {
291  return false;
292  }
293  if (a.productID() < b.productID()) {
294  return true;
295  }
296  if (b.productID() < a.productID()) {
297  return false;
298  }
299  if (a.psetIDs() < b.psetIDs()) {
300  return true;
301  }
302  if (b.psetIDs() < a.psetIDs()) {
303  return false;
304  }
305  if (a.processConfigurationIDs() < b.processConfigurationIDs()) {
306  return true;
307  }
308  if (b.processConfigurationIDs() < a.processConfigurationIDs()) {
309  return false;
310  }
311  return false;
312  }
bool operator== ( BranchDescription const &  ,
BranchDescription const &   
)
friend

Definition at line 327 of file BranchDescription.cc.

328  {
329  return combinable(a, b) && (a.psetIDs() == b.psetIDs()) &&
330  (a.processConfigurationIDs() == b.processConfigurationIDs());
331  }
friend bool combinable(BranchDescription const &, BranchDescription const &)

Member Data Documentation

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

Definition at line 244 of file BranchDescription.h.

Referenced by swap(), throwIfInvalid_(), and write().

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

Definition at line 260 of file BranchDescription.h.

Referenced by BranchDescription(), swap(), and throwIfInvalid_().

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

Definition at line 51 of file BranchDescription.h.

Referenced by merge().

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

Definition at line 52 of file BranchDescription.h.

Referenced by merge().

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

Definition at line 50 of file BranchDescription.h.

Referenced by merge().

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

Definition at line 248 of file BranchDescription.h.

Referenced by BranchDescription(), swap(), and throwIfInvalid_().

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

Definition at line 275 of file BranchDescription.h.

Referenced by BranchDescription(), merge(), processConfigurationIDs(), and swap().

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

Definition at line 251 of file BranchDescription.h.

Referenced by BranchDescription(), swap(), and throwIfInvalid_().

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

Definition at line 257 of file BranchDescription.h.

Referenced by BranchDescription(), fluffTransients_(), swap(), and throwIfInvalid_().

ProductID art::BranchDescription::productID_ {}
private

Definition at line 254 of file BranchDescription.h.

Referenced by initProductID_(), and swap().

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

Definition at line 264 of file BranchDescription.h.

Referenced by BranchDescription(), swap(), and throwIfInvalid_().

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

Definition at line 271 of file BranchDescription.h.

Referenced by BranchDescription(), merge(), and swap().

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

Definition at line 267 of file BranchDescription.h.

Referenced by BranchDescription(), and swap().

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

Definition at line 278 of file BranchDescription.h.

Referenced by fluffTransients_(), guts(), and swap().


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