29{
30 void JobConfig ::
31 testInvariant () const
32 {
34 }
35
36
37
38 JobConfig ::
39 JobConfig () noexcept
40 {
42 }
43
44
45
46 JobConfig ::
48 : TObject (that),
49 m_algorithmCount (that.m_algorithmCount),
50 m_algSequenceStartIndices (that.m_algSequenceStartIndices)
51 {
53
54 for (
const auto&
algorithm : that.m_algorithms)
55 {
57 {
58 m_algorithms.push_back (
algorithm->makeClone ());
59 } else
60 {
61 m_algorithms.emplace_back (nullptr);
62 }
63 }
64
66 }
67
68
69
70 JobConfig ::
73 {
74 that.swap (*this);
75
76
77 }
78
79
80
81 JobConfig ::
82 ~JobConfig () noexcept
83 {
85
86
87
88 }
89
90
91
94 {
95
97 return *this;
98 }
99
100
101
104 {
105
106 that.swap (*this);
107 return *this;
108 }
109
110
111
112 void JobConfig ::
114 {
117 std::swap (m_algorithmCount, that.m_algorithmCount);
118 m_algorithms.swap (that.m_algorithms);
119 m_algSequenceStartIndices.swap (that.m_algSequenceStartIndices);
120 }
121
122
123
124 ::StatusCode JobConfig ::
125 addAlgorithm (std::unique_ptr<IAlgorithmWrapper>&& val_algorithm)
126 {
127 using namespace msgEventLoop;
128
131
132 if (getAlgorithm (val_algorithm->getName()) != nullptr)
133 {
134 ANA_MSG_ERROR (
"can't have two algorithms with the same name: " << val_algorithm->getName());
135 return ::StatusCode::FAILURE;
136 }
137
138 m_algorithms.push_back (std::move (val_algorithm));
139 ++ m_algorithmCount;
140 return ::StatusCode::SUCCESS;
141 }
142
143
144
145 const IAlgorithmWrapper *JobConfig ::
146 getAlgorithm (std::string_view name) const noexcept
147 {
149 for (
const auto&
algorithm : m_algorithms)
150 {
153 }
154 return nullptr;
155 }
156
157
158
159 std::vector<Detail::AlgorithmData> JobConfig ::
160 extractAlgorithms ()
161 {
163 if (m_algorithmCount != m_algorithms.size())
164 throw std::runtime_error ("JobConfig::extractAlgorithms: algorithm count missmatch. streaming error?");
165 for (
const auto&
algorithm : m_algorithms)
166 {
168 throw std::runtime_error ("JobConfig::extractAlgorithms: algorithm null. streaming error?");
169 }
170 m_algorithmCount = 0;
171 std::vector<Detail::AlgorithmData>
result;
172 result.reserve (m_algorithms.size());
175 m_algorithms.clear();
176 for (auto sequenceStartIndex : m_algSequenceStartIndices)
177 {
178
179
180
181 if (sequenceStartIndex <
result.size())
182 result[sequenceStartIndex].m_sequenceStart =
true;
183 }
185 }
186
187
188
189 std::size_t JobConfig ::
190 numberOfAlgorithms ()
const noexcept
191 {
193 return m_algorithms.size();
194 }
195
196
197
198 void
199 JobConfig ::
200 startNewAlgSequence ()
201 {
203 m_algSequenceStartIndices.push_back (m_algorithms.size());
204 }
205}
#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)