Public Member Functions | Private Attributes | List of all members
art::GroupSelector Class Reference

#include <GroupSelector.h>

Public Member Functions

 GroupSelector (GroupSelectorRules const &rules, ProductDescriptionsByID const &descriptions)
 
bool selected (BranchDescription const &desc) const
 
void print (std::ostream &os) const
 

Private Attributes

std::vector< BranchDescription const * > groupsToSelect_ {}
 

Detailed Description

Definition at line 26 of file GroupSelector.h.

Constructor & Destructor Documentation

GroupSelector::GroupSelector ( GroupSelectorRules const &  rules,
ProductDescriptionsByID const &  descriptions 
)
explicit

Definition at line 14 of file GroupSelector.cc.

16 {
17  using BranchSelectState = GroupSelectorRules::BranchSelectState;
18 
19  // Get a BranchSelectState for each branch, containing the branch
20  // name, with its 'select bit' set to false.
21  vector<BranchSelectState> branchstates;
22  branchstates.reserve(descriptions.size());
23  for (auto const& pr : descriptions) {
24  branchstates.push_back(BranchSelectState{&pr.second});
25  }
26 
27  // Now apply the rules to the branchstates, in order. Each rule
28  // can override any previous rule, or all previous rules.
29  rules.applyToAll(branchstates);
30 
31  // For each of the BranchSelectStates that indicates the branch is
32  // to be selected, remember the branch. The list of branch pointers
33  // must be sorted for subsequent binary search to work.
34  for (auto const& state : branchstates) {
35  if (state.selectMe) {
36  groupsToSelect_.push_back(state.desc);
37  }
38  }
40 }
void sort_all(RandCont &)
std::vector< BranchDescription const * > groupsToSelect_
Definition: GroupSelector.h:39

Member Function Documentation

void GroupSelector::print ( std::ostream &  os) const

Definition at line 49 of file GroupSelector.cc.

50 {
51  os << "GroupSelector at: " << static_cast<void const*>(this) << " has "
52  << groupsToSelect_.size() << " groups to select:\n";
53  for (auto const& bd_ptr : groupsToSelect_) {
54  os << bd_ptr->branchName() << '\n';
55  }
56 }
std::vector< BranchDescription const * > groupsToSelect_
Definition: GroupSelector.h:39
bool GroupSelector::selected ( BranchDescription const &  desc) const

Definition at line 43 of file GroupSelector.cc.

44 {
46 }
std::vector< BranchDescription const * > groupsToSelect_
Definition: GroupSelector.h:39
bool binary_search_all(FwdCont const &, Datum const &)

Member Data Documentation

std::vector<BranchDescription const*> art::GroupSelector::groupsToSelect_ {}
private

Definition at line 39 of file GroupSelector.h.


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