32 return x.parent() < y.parent();
43 return x.parent() < y.parent();
51 return x.parent() < y.parent() ?
true
52 : y.parent() < x.parent() ?
false : x.association() < y.association();
66 std::vector<std::pair<BranchID, ThinnedAssociationBranches const*> >
68 std::vector<std::pair<BranchID, ThinnedAssociationBranches const*> >
temp;
70 temp.push_back(std::make_pair(
item.association(), &
item));
72 std::sort(
temp.begin(),
74 [](std::pair<BranchID, ThinnedAssociationBranches const*>
const& x,
75 std::pair<BranchID, ThinnedAssociationBranches const*>
const& y) {
return x.first < y.first; });
80 std::vector<BranchDescription const*>
const& associationDescriptions,
81 std::set<BranchID>
const& keptProductsInEvent,
82 std::map<BranchID, bool>& keepAssociation)
const {
83 keepAssociation.clear();
86 std::vector<std::pair<BranchID, ThinnedAssociationBranches const*> > assocToBranches =
associationToBranches();
91 keepAssociation.insert(std::make_pair(
association->branchID(),
false));
93 std::set<BranchID> branchesInRecursion;
95 association->branchID(), assocToBranches, branchesInRecursion, keptProductsInEvent, keepAssociation);
102 std::vector<std::pair<BranchID, ThinnedAssociationBranches const*> >
const& associationToBranches,
103 std::set<BranchID>& branchesInRecursion,
104 std::set<BranchID>
const& keptProductsInEvent,
105 std::map<BranchID, bool>& keepAssociation)
const {
109 if (decision != keepAssociation.end()) {
110 return decision->second;
115 if (!branchesInRecursion.insert(
association).second) {
123 std::make_pair(
association, static_cast<ThinnedAssociationBranches const*>(
nullptr)),
124 [](std::pair<BranchID, ThinnedAssociationBranches const*>
const& x,
125 std::pair<BranchID, ThinnedAssociationBranches const*>
const& y) {
return x.first < y.first; });
129 "ThinnedAssociationHelper::shouldKeepAssociation could not find branches information, "
130 "contact Framework developers");
132 BranchID const& thinnedCollection = branches->second->thinned();
133 if (keptProductsInEvent.find(thinnedCollection) != keptProductsInEvent.end()) {
134 keepAssociation.insert(std::make_pair(
association,
true));
140 auto iterEnd =
parentEnd(thinnedCollection);
144 keepAssociation.insert(std::make_pair(
association,
true));
149 keepAssociation.insert(std::make_pair(
association,
false));
154 bool foundMatch =
false;
164 "ThinnedAssociationHelper::requireMatch, Illegal attempt to merge files with different ThinnedAssociations");
173 std::vector<ThinnedAssociationBranches>
const& inputData =
helper.data();
174 for (
auto const& inputEntry : inputData) {
180 std::vector<BranchID>
const& associationsFromSecondary) {
181 if (associationsFromSecondary.empty())
184 std::vector<std::pair<BranchID, ThinnedAssociationBranches const*> > assocToBranches =
185 helper.associationToBranches();
189 assocToBranches.begin(),
190 assocToBranches.end(),
191 std::make_pair(
association, static_cast<ThinnedAssociationBranches const*>(
nullptr)),
192 [](std::pair<BranchID, ThinnedAssociationBranches const*>
const& x,
193 std::pair<BranchID, ThinnedAssociationBranches const*>
const& y) {
return x.first < y.first; });
195 if (branches == assocToBranches.end() || branches->first !=
association) {
197 "ThinnedAssociationHelper::initAssociationsFromSecondary could not find branches "
198 "information, contact Framework developers");
206 std::map<BranchID, bool>
const& keepAssociation,
207 std::map<BranchID::value_type, BranchID::value_type>
const& droppedBranchIDToKeptBranchID) {
209 for (
auto const& associationBranches : parentThinnedAssociationsHelper.
data()) {
210 auto keep = keepAssociation.find(associationBranches.association());
211 if (
keep != keepAssociation.end() &&
keep->second) {
213 auto iter = droppedBranchIDToKeptBranchID.find(
parent.id());
214 if (iter != droppedBranchIDToKeptBranchID.end()) {
217 BranchID thinned = associationBranches.thinned();
218 iter = droppedBranchIDToKeptBranchID.find(thinned.
id());
219 if (iter != droppedBranchIDToKeptBranchID.end()) {
230 if (associationsFromSecondary.empty())
233 std::vector<std::pair<BranchID, ThinnedAssociationBranches const*> > assocToBranches =
238 assocToBranches.begin(),
239 assocToBranches.end(),
240 std::make_pair(
association, static_cast<ThinnedAssociationBranches const*>(
nullptr)),
241 [](std::pair<BranchID, ThinnedAssociationBranches const*>
const& x,
242 std::pair<BranchID, ThinnedAssociationBranches const*>
const& y) {
return x.first < y.first; });
244 if (branches == assocToBranches.end() || branches->first !=
association) {
246 "ThinnedAssociationHelper::initAssociationsFromSecondary could not find branches "
247 "information, contact Framework developers");