29{
30 void JobConfig ::
31 testInvariant () const
32 {}
33
34
35
36 JobConfig ::
37 JobConfig () noexcept
38 {
40 }
41
42
43
44 JobConfig ::
46 : TObject (that),
47 m_algorithmCount (that.m_algorithmCount),
48 m_algSequenceStartIndices (that.m_algSequenceStartIndices)
49 {
51
52 for (
const auto&
algorithm : that.m_algorithms)
53 {
55 {
56 m_algorithms.push_back (
algorithm->makeClone ());
57 } else
58 {
59 m_algorithms.emplace_back (nullptr);
60 }
61 }
62
64 }
65
66
67
68 JobConfig ::
71 {
72 that.swap (*this);
73
74
75 }
76
77
78
79 JobConfig ::
80 ~JobConfig () noexcept
81 {
83
84
85
86 }
87
88
89
92 {
93
95 return *this;
96 }
97
98
99
102 {
103
104 that.swap (*this);
105 return *this;
106 }
107
108
109
110 void JobConfig ::
112 {
115 std::swap (m_algorithmCount, that.m_algorithmCount);
116 m_algorithms.swap (that.m_algorithms);
117 m_algSequenceStartIndices.swap (that.m_algSequenceStartIndices);
118 }
119
120
121
122 ::StatusCode JobConfig ::
123 addAlgorithm (std::unique_ptr<IAlgorithmWrapper>&& val_algorithm)
124 {
125 using namespace msgEventLoop;
126
129
130 if (getAlgorithm (val_algorithm->getName()) != nullptr)
131 {
132 ANA_MSG_ERROR (
"can't have two algorithms with the same name: " << val_algorithm->getName());
133 return ::StatusCode::FAILURE;
134 }
135
136 m_algorithms.push_back (std::move (val_algorithm));
137 ++ m_algorithmCount;
138 return ::StatusCode::SUCCESS;
139 }
140
141
142
143 const IAlgorithmWrapper *JobConfig ::
144 getAlgorithm (std::string_view name) const noexcept
145 {
147 for (
const auto&
algorithm : m_algorithms)
148 {
151 }
152 return nullptr;
153 }
154
155
156
157 std::vector<Detail::AlgorithmData> JobConfig ::
158 extractAlgorithms ()
159 {
161 if (m_algorithmCount != m_algorithms.size())
162 throw std::runtime_error ("JobConfig::extractAlgorithms: algorithm count missmatch. streaming error?");
163 for (
const auto&
algorithm : m_algorithms)
164 {
166 throw std::runtime_error ("JobConfig::extractAlgorithms: algorithm null. streaming error?");
167 }
168 m_algorithmCount = 0;
169 std::vector<Detail::AlgorithmData>
result;
170 result.reserve (m_algorithms.size());
173 m_algorithms.clear();
174 for (auto sequenceStartIndex : m_algSequenceStartIndices)
175 {
176
177
178
179 if (sequenceStartIndex <
result.size())
180 result[sequenceStartIndex].m_sequenceStart =
true;
181 }
182
183
184
185 m_algSequenceStartIndices.clear();
187 }
188
189
190
191 std::size_t JobConfig ::
192 numberOfAlgorithms ()
const noexcept
193 {
195 return m_algorithms.size();
196 }
197
198
199
200 void
201 JobConfig ::
202 startNewAlgSequence ()
203 {
205 m_algSequenceStartIndices.push_back (m_algorithms.size());
206 }
207}
#define RCU_DESTROY_INVARIANT(x)
#define RCU_CHANGE_INVARIANT(x)
#define RCU_NEW_INVARIANT(x)
#define RCU_READ_INVARIANT(x)
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)