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