27 m_headerResult.resize(IndNumOfFixedBit);
28 m_headerResult[IndHLTResultClassVersion] = m_HLTResultClassVersion;
31 setLvl1Id(0xffffffff);
34 setHLTStatus(HLT::FATAL);
36 setLvlConverterStatus(HLT::FATAL);
38 setPassThrough(
false);
42 setNumOfSatisfiedSigs(0);
44 setErrorCoordinates(0, 0xffffffff);
46 setCreatedOutsideHLT(
true);
48 setHLTResultTruncated(
false);
54 m_chainsResult{rhs.m_chainsResult},
55 m_navigationResult{rhs.m_navigationResult},
56 m_navigationResult_DSonly{rhs.m_navigationResult_DSonly},
57 m_extras{rhs.m_extras},
58 m_id_name{rhs.m_id_name},
59 m_id_name_DSonly{rhs.m_id_name_DSonly},
60 m_modID_id_name{rhs.m_modID_id_name},
61 m_navigationResultCuts{rhs.m_navigationResultCuts},
62 m_navigationResultCuts_DSonly{rhs.m_navigationResultCuts_DSonly},
63 m_extraData{rhs.m_extraData ?
new HLTExtraData{*rhs.m_extraData} :
nullptr}
88 for (std::map<
unsigned int,
std::set<std::pair<CLID, std::string> > >::const_iterator map_it =
m_modID_id_name.begin();
90 mod_ids.push_back((*map_it).first);
95 std::vector<unsigned int> mod_ids;
96 for (std::map<
unsigned int,
std::set<std::pair<CLID, std::string> > >::const_iterator map_it =
m_modID_id_name.begin();
98 mod_ids.push_back((*map_it).first);
138 const std::vector<uint32_t>& indivisible,
139 unsigned int umax_size,
143 auto size_indivisible = indivisible.size();
144 auto size_needed = data_size + size_indivisible + (
first ? 0 : 1);
149 if(truncating && size_needed > umax_size)
153 output[data_size++] = size_indivisible;
158 data_size += size_indivisible;
173 const std::vector<uint32_t>& nav,
174 const std::vector<std::pair<unsigned, unsigned>>& boundaries)
177 for(
const auto& bpair : boundaries)
179 assert(bpair.first < nav.size());
180 assert(bpair.second >= bpair.first);
181 assert(bpair.second <= nav.size());
184 nav_begin + bpair.second,
186 data_size += bpair.second - bpair.first;
195 find_cuts(
const std::set<std::pair<CLID, std::string>>& collections,
196 const std::vector<std::pair<CLID, std::string>>& idname_include,
197 const std::vector<std::pair<CLID, std::string>>& idname_exclude,
198 std::vector<unsigned int>
cuts,
199 std::vector<std::pair<unsigned int, unsigned int>>&
out)
201 for(
const auto& coll : collections)
225 unsigned add_collection_to_size(
unsigned current_size,
226 const std::pair<unsigned, unsigned>& pair)
228 return current_size + pair.second - pair.first;
236 calc_colls_size(
const std::vector<std::pair<unsigned, unsigned>>& boundaries)
239 add_collection_to_size);
246 auto cuts_dsonly =
CutPairs{{0, m_navigationResultCuts_DSonly.at(1)}};
251 auto modid_coll_it = m_modID_id_name.find(mod_id);
252 if(modid_coll_it !=
std::end(m_modID_id_name))
254 const auto& collections = modid_coll_it->second;
255 find_cuts(collections,
258 m_navigationResultCuts_DSonly,
260 find_cuts(collections,
263 m_navigationResultCuts,
267 return std::make_pair(cuts_dsonly, cuts_reg);
273 static constexpr
auto num_size_words = 3
u;
279 unsigned int umax_size,
280 bool truncating)
const
282 auto calc_size_needed = [data_size](
unsigned int nav_size)
283 {
return nav_size + data_size + 1; };
286 auto is_within_size = [umax_size, &calc_size_needed](
unsigned int cut)
287 {
return calc_size_needed(
cut) <= umax_size; };
291 if(
static_cast<unsigned int>(data_size) < umax_size)
294 auto cut_nav_size = tot_nav_size;
297 if(truncating && calc_size_needed(tot_nav_size) > umax_size)
303 endnav -= tot_nav_size - cut_nav_size;
310 output[data_size++] = cut_nav_size;
312 data_size += cut_nav_size;
323 unsigned int umax_size,
324 unsigned int nav_size,
326 bool truncating)
const
328 if(nav_size + data_size < umax_size)
330 output[data_size++] = nav_size;
331 auto index_for_size_in_nav_preamble = data_size + 1;
337 output[index_for_size_in_nav_preamble] = nav_size;
348 if(
static_cast<unsigned int>(data_size) < umax_size)
360 unsigned int estimated_size)
365 auto umax_size =
static_cast<unsigned int>(max_size);
368 truncating = max_size >= 0 && estimated_size > umax_size;
379 unsigned int umax_size,
380 bool truncating)
const
391 unsigned int umax_size,
392 unsigned int nav_size,
394 bool truncating)
const
396 if(
static_cast<unsigned int>(data_size) < umax_size)
401 &&
static_cast<unsigned int>(data_size) < umax_size)
416 bool truncating{
false};
419 max_size, estim_size) &&
421 max_size, truncating);
431 bool truncating{
false};
433 auto navsize = calc_colls_size(dscuts.first) + calc_colls_size(dscuts.second);
448 const unsigned int mod_id)
453 auto ret =
serialize(aux, data_size, -1, mod_id);
454 auto uptr = std::unique_ptr<uint32_t[]>{aux};
456 output.reserve(data_size);
466 const unsigned int mod_id)
488 if (data_size == 0 )
return false;
489 std::vector<uint32_t> rawResult(&
source[0], &
source[data_size]);
507 rawIndNumOfFixedBit = 12;
511 std::cerr <<
"HLTResult::unpackFromStorable has noticed a class version mismatch and does not know how to translate: raw data version " << raw[0] <<
" current class version " <<
m_HLTResultClassVersion << std::endl;
525 if ( raw.size() == rawIndNumOfFixedBit )
534 bool truncation =
false;
536 if ( readEnd > raw.size() ){
537 readEnd = raw.size();
557 uint32_t trueSizeOfNavigation = sizeOfNavigation;
561 readEnd =
offset + sizeOfNavigation;
562 if (readEnd > raw.size()) {
563 readEnd = raw.size();
565 trueSizeOfNavigation = raw.size() -
offset;
583 offset += sizeOfNavigation;
590 readEnd =
offset + sizeOfExtras;
591 if (readEnd > raw.size()) {
592 readEnd = raw.size();
619 std::vector<unsigned int> sizes;