-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
Provenance.cc
59 lines (47 loc) · 1.55 KB
/
Provenance.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "DataFormats/Provenance/interface/Provenance.h"
#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h"
#include "DataFormats/Provenance/interface/ProcessConfiguration.h"
#include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/Registry.h"
#include <algorithm>
#include <cassert>
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
namespace edm {
Provenance::Provenance() : Provenance{StableProvenance()} {
}
Provenance::Provenance(std::shared_ptr<BranchDescription const> const& p, ProductID const& pid) :
stableProvenance_(p, pid),
store_() {
}
Provenance::Provenance(StableProvenance const& stable) :
stableProvenance_(stable),
store_() {
}
ProductProvenance const*
Provenance::productProvenance() const {
if(!store_) {
return nullptr;
}
return store_->branchIDToProvenance(branchID());
}
void
Provenance::write(std::ostream& os) const {
// This is grossly inadequate, but it is not critical for the
// first pass.
stable().write(os);
auto pp = productProvenance();
if (pp != nullptr) {
pp->write(os);
}
}
bool operator==(Provenance const& a, Provenance const& b) {
return a.stable() == b.stable();
}
void
Provenance::swap(Provenance& iOther) {
stableProvenance_.swap(iOther.stableProvenance_);
std::swap(store_,iOther.store_);
}
}