![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
8 #include "CoralBase/Attribute.h"
9 #include "CoralBase/AttributeListSpecification.h"
10 #include "CoralBase/AttributeListException.h"
11 #include "CoralBase/Blob.h"
13 #include "TBufferFile.h"
20 const std::string&
name,
21 const IInterface*
parent) :
24 declareInterface<Blob2ToolConstants>(
this);
30 return StatusCode::SUCCESS;
36 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
38 spec->extend(
"clsname",
"string");
39 spec->extend(
"version",
"unsigned int");
40 spec->extend(
"blobVersion",
"unsigned int");
41 spec->extend(
"Constants",
"blob");
44 auto attrList = std::make_unique<coral::AttributeList>(*
spec);
50 (*attrList)[
"clsname"].data<std::string>()=tc->
clsname();
51 (*attrList)[
"version"].data<
unsigned int>()=(
unsigned int)tc->
version();
52 (*attrList)[
"blobVersion"].data<
unsigned int>()=(
unsigned int)0;
57 TClass*
klass = TClass::GetClass (
"std::map<std::string, CaloRec::Arrayrep>");
59 msg( MSG::ERROR) <<
"Can't find TClass std::map<std::string, CaloRec::Arrayrep>" <<
endmsg;
65 TBufferFile buf (TBuffer::kWrite);
67 if (buf.WriteObjectAny (&tc->
map(),
klass) != 1) {
68 msg(MSG::ERROR) <<
"Failed to stream CaloRec::ToolConstants::Maptype " <<
endmsg;
72 blob.resize(buf.Length());
73 void* adr =
blob.startingAddress();
74 memcpy(adr,buf.Buffer(),buf.Length());
75 return attrList.release();
81 std::unique_ptr<T> map;
84 tc.
clsname(attrList[
"clsname"].data<std::string>());
85 tc.
version(attrList[
"version"].data<unsigned int>());
86 const unsigned blobVersion=attrList[
"blobVersion"].data<
unsigned int>();
91 return StatusCode::FAILURE;
94 TClass*
klass = TClass::GetClass (
"std::map<std::string, CaloRec::Arrayrep>");
96 msg(MSG::ERROR) <<
"Can't find TClass std::map<std::string, CaloRec::Arrayrep>" <<
endmsg;
97 return StatusCode::FAILURE;
104 TBufferFile buf (TBuffer::kRead,
blob.size(), blob_start,
false);
105 map.reset( (
T*)buf.ReadObjectAny (
klass) );
106 }
catch (coral::AttributeListException &
e) {
108 return StatusCode::FAILURE;
111 T::const_iterator
it=map->begin();
112 T::const_iterator it_e=map->end();
113 for (;
it!=it_e;++
it) {
116 return StatusCode::SUCCESS;
127 static const InterfaceID IID_Blob2ToolConstants (
"Blob2ToolConstants", 1 , 0);
131 return IID_Blob2ToolConstants;
This class describe the base functionalities of a HypoTool used by the ComboAlg.
::StatusCode StatusCode
StatusCode definition for legacy code.
uint64_t crc64(const CRCTable &table, const char *data, size_t data_len)
Find the CRC-64 of a string,.
std::uint64_t hash64(const void *data, std::size_t size)
Passthrough to XXH3_64bits.
#define ATLAS_THREAD_SAFE
A crc-64 implementation, using pclmul where possible.
Define macros for attributes used to control the static checker.