Receive dynamic aux store variables from streaming tool.
39 {
40 TClass* holderTC =
cl->GetBaseClass(
"SG::IAuxStoreHolder");
41 if (holderTC == nullptr) {
42 return(StatusCode::FAILURE);
43 }
44 SG::IAuxStoreHolder* storeHolder =
reinterpret_cast<SG::IAuxStoreHolder*
>((
char*)obj +
cl->GetBaseClassOffset(holderTC));
45 if (storeHolder == nullptr) {
46 return(StatusCode::FAILURE);
47 }
49 std::unique_ptr<AthenaPoolAuxStore> storeInt = std::make_unique<AthenaPoolAuxStore>(standalone);
50
51 void* nameData = nullptr;
52
53 size_t nbytes = 0;
54 while (
m_ipcTool->getObject(&nameData, nbytes, num).isSuccess() && nbytes > 0) {
55 const char* del1 = static_cast<const char*>(std::memchr(nameData, '\n', nbytes));
56 if (del1 == nullptr) continue;
57 const char* del2 = static_cast<const char*>(std::memchr(del1 + 1, '\n', nbytes - (del1 - static_cast<const char*>(nameData) + 1)));
58 if (del2 == nullptr) continue;
59 const std::string dataStr(static_cast<const char*>(nameData));
60 const std::string&
attrName = dataStr.substr(0, del1 -
static_cast<const char*
>(nameData));
61 const std::string&
typeName = dataStr.substr(del1 -
static_cast<const char*
>(nameData) + 1, del2 - del1 - 1);
62 const std::string& elemName = dataStr.substr(del2 - static_cast<const char*>(nameData) + 1, nbytes - (del2 - static_cast<const char*>(nameData) + 1));
64 if (
m_ipcTool->getObject(&buffer, nbytes, num).isSuccess()) {
68 try {
69 RootUtils::Type elemType(elemName);
70 const std::type_info* eti = elemType.getTypeInfo();
71 if (eti != nullptr) {
73 }
74 } catch (const std::runtime_error&) {
76 }
77 }
80 void* dynAttr = nullptr;
81 if (
type.IsFundamental()) {
82 dynAttr = new char[nbytes];
83 std::memcpy(dynAttr, buffer, nbytes);
buffer =
nullptr;
84 } else {
85 dynAttr =
m_serSvc->deserialize(buffer, nbytes, type);
buffer =
nullptr;
86 }
87 if (storeInt->standalone()) {
88 (void)storeInt->getData(auxid, 1, 1);
90 SG::AuxVectorInterface(*storeInt), 0,
91 SG::AuxVectorInterface(auxid, 1, const_cast<const void*>(dynAttr)), 0, 1);
92 if (
type.IsFundamental()) {
93 delete [] (char*)dynAttr; dynAttr = nullptr;
94 } else {
95 type.Destruct(dynAttr); dynAttr =
nullptr;
96 }
97 } else {
98
99 std::unique_ptr<SG::IAuxTypeVector>
vec(registry.
makeVectorFromData(auxid, dynAttr,
nullptr,
false,
true));
100 storeInt->addVector(std::move(
vec),
false);
101 }
102 }
103 }
104 }
105 storeHolder->
setStore(storeInt.release());
106 return(StatusCode::SUCCESS);
107}
std::vector< size_t > vec
SG::auxid_t findAuxID(const std::string &name, const std::string &clsname="") const
Look up a name -> auxid_t mapping.
std::unique_ptr< IAuxTypeVector > makeVectorFromData(SG::auxid_t auxid, void *data, IAuxTypeVector *linkedVector, bool isPacked, bool ownFlag) const
Construct an IAuxTypeVector object from a vector.
void copy(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const
Copy elements between vectors.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
@ AST_ObjectStore
The store describes a single object.
virtual AuxStoreType getStoreType() const =0
Return the type of the store object.
virtual void setStore(IAuxStore *store)=0
Give an auxiliary store object to the holder object.
static const auxid_t null_auxid
To signal no aux data item.
SG::auxid_t auxid() const
Return the aux id for this variable.
SG::auxid_t getDynamicAuxID(const std::type_info &ti, const std::string &name, const std::string &elementTypeName, const std::string &branch_type_name, bool standalone, SG::auxid_t linked_auxid)
Find the auxid for a dynamic branch.
size_t auxid_t
Identifier for a particular aux data item.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]