ATLAS Offline Software
Loading...
Searching...
No Matches
JobConfig.cxx File Reference
Include dependency graph for JobConfig.cxx:

Go to the source code of this file.

Functions

 ClassImp (EL::JobConfig) namespace EL

Function Documentation

◆ ClassImp()

ClassImp ( EL::JobConfig )
Author
Nils Krumnack

Definition at line 24 of file JobConfig.cxx.

27{
28 void JobConfig ::
29 testInvariant () const
30 {
31 RCU_INVARIANT (this != nullptr);
32 }
33
34
35
36 JobConfig ::
37 JobConfig () noexcept
38 {
39 RCU_NEW_INVARIANT (this);
40 }
41
42
43
44 JobConfig ::
45 JobConfig (const JobConfig& that)
46 : TObject (that),
47 m_algorithmCount (that.m_algorithmCount)
48 {
49 RCU_READ_INVARIANT (&that);
50
51 for (const auto& algorithm : that.m_algorithms)
52 {
53 if (algorithm != nullptr)
54 {
55 m_algorithms.push_back (algorithm->makeClone ());
56 } else
57 {
58 m_algorithms.emplace_back (nullptr);
59 }
60 }
61
62 RCU_NEW_INVARIANT (this);
63 }
64
65
66
67 JobConfig ::
68 JobConfig (JobConfig&& that) noexcept
69 : JobConfig ()
70 {
71 that.swap (*this);
72
73 // no invariant used
74 }
75
76
77
78 JobConfig ::
79 ~JobConfig () noexcept
80 {
82
83 // not actually doing anything here, but have to make the
84 // destructor explicit to break include dependencies.
85 }
86
87
88
89 JobConfig& JobConfig ::
90 operator = (const JobConfig& that)
91 {
92 // no invariant used
93 JobConfig (that).swap (*this);
94 return *this;
95 }
96
97
98
99 JobConfig& JobConfig ::
100 operator = (JobConfig&& that) noexcept
101 {
102 // no invariant used
103 that.swap (*this);
104 return *this;
105 }
106
107
108
109 void JobConfig ::
110 swap (JobConfig& that) noexcept
111 {
113 RCU_CHANGE_INVARIANT (&that);
114 std::swap (m_algorithmCount, that.m_algorithmCount);
115 m_algorithms.swap (that.m_algorithms);
116 }
117
118
119
120 ::StatusCode JobConfig ::
121 addAlgorithm (std::unique_ptr<IAlgorithmWrapper>&& val_algorithm)
122 {
123 using namespace msgEventLoop;
124
126 RCU_REQUIRE (val_algorithm != nullptr);
127
128 if (getAlgorithm (val_algorithm->getName()) != nullptr)
129 {
130 ANA_MSG_ERROR ("can't have two algorithms with the same name: " << val_algorithm->getName());
131 return ::StatusCode::FAILURE;
132 }
133
134 m_algorithms.push_back (std::move (val_algorithm));
135 ++ m_algorithmCount;
136 return ::StatusCode::SUCCESS;
137 }
138
139
140
141 const IAlgorithmWrapper *JobConfig ::
142 getAlgorithm (std::string_view name) const noexcept
143 {
144 RCU_READ_INVARIANT (this);
145 for (const auto& algorithm : m_algorithms)
146 {
147 if (algorithm != nullptr && algorithm->getName() == name)
148 return algorithm.get();
149 }
150 return nullptr;
151 }
152
153
154
155 std::vector<std::unique_ptr<EL::IAlgorithmWrapper>> JobConfig ::
156 extractAlgorithms ()
157 {
159 if (m_algorithmCount != m_algorithms.size())
160 RCU_THROW_MSG ("algorithm count missmatch. streaming error?");
161 for (const auto& algorithm : m_algorithms)
162 {
163 if (algorithm == nullptr)
164 RCU_THROW_MSG ("algorithm null. streaming error?");
165 }
166 m_algorithmCount = 0;
167 return std::move (m_algorithms);
168 }
169
170
171
172 std::size_t JobConfig ::
173 numberOfAlgorithms () const noexcept
174 {
175 RCU_READ_INVARIANT (this);
176 return m_algorithms.size();
177 }
178}
#define RCU_INVARIANT(x)
Definition Assert.h:201
#define RCU_DESTROY_INVARIANT(x)
Definition Assert.h:235
#define RCU_CHANGE_INVARIANT(x)
Definition Assert.h:231
#define RCU_NEW_INVARIANT(x)
Definition Assert.h:233
#define RCU_REQUIRE(x)
Definition Assert.h:208
#define RCU_READ_INVARIANT(x)
Definition Assert.h:229
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define RCU_THROW_MSG(message)
Definition PrintMsg.h:58
std::string algorithm
Definition hcg.cxx:85
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)