ATLAS Offline Software
Loading...
Searching...
No Matches
BaseHolder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include <iostream>
8using namespace HLT;
9
11
12bool BaseHolder::enquireSerialized(std::vector<uint32_t>::const_iterator& fromHere,
13 const std::vector<uint32_t>::const_iterator& end,
14 class_id_type& c, std::string& label,
15 sub_index_type& subtypeIndex ) {
16 using namespace std;
17 if ( fromHere == end ) return false;
18
19 c = *fromHere++;
20 if ( fromHere == end ) return false;
21
22 subtypeIndex = *fromHere++;
23 if ( fromHere == end ) return false;
24
25 unsigned labelSize = *fromHere++;
26 if ( fromHere == end ) return false;
27 if ( fromHere+labelSize > end ) return false;
28
29 std::vector<uint32_t>::const_iterator stringEnd = fromHere+labelSize;
30 HLT::StringSerializer::deserialize(fromHere, stringEnd, label);
31
32 //advance iterator to end of label
33 std::advance(fromHere,labelSize);
34
35 return true;
36}
37
38bool BaseHolder::serialize(std::vector<uint32_t>& output) const {
39 output.push_back( typeClid() );
40 output.push_back( subTypeIndex() );
41
42 const size_t labelSizeIndex = output.size();
43 output.push_back( 0 );
44 const size_t beforeSS = output.size();
46 output[labelSizeIndex] = output.size() - beforeSS;
47 return true;
48}
virtual class_id_type typeClid() const =0
virtual sub_index_type subTypeIndex() const =0
virtual bool serialize(std::vector< uint32_t > &data) const
virtual const std::string & label() const =0
static bool enquireSerialized(std::vector< uint32_t >::const_iterator &fromHere, const std::vector< uint32_t >::const_iterator &end, class_id_type &c, std::string &label, sub_index_type &subtypeIndex)
virtual ~BaseHolder()
std::size_t deserialize(std::vector< uint32_t >::const_iterator first, std::vector< uint32_t >::const_iterator last, std::vector< std::string > &strings)
void serialize(const std::vector< std::string > &strings, std::vector< uint32_t > &storage)
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
STL namespace.