30 constexpr const char* sourceContainerName =
"Container";
34 constexpr const char* linkBaseName =
"Container.linkIndex";
41 const std::string& name,
42 const std::type_info* type,
44 const std::string& offsetName,
47 slot.accessorData = std::make_unique<ColumnAccessorDataArray>
48 (&slot.dataIndex, &slot.accessorData, type, mode);
50 info.offsetName = offsetName;
51 info.isOffset = isOffset;
52 tool.addColumn (name, slot.accessorData.get(), std::move (info));
60 std::string linkOffsetName (
unsigned level,
unsigned depth)
63 return std::string (linkBaseName) +
".offset";
65 return std::string (linkBaseName) + (
level == 0
u ?
".outerOffset" :
".innerOffset");
66 return std::string (linkBaseName) +
".offset" + std::to_string (level);
73 ColumnarLinkTool (
const std::string& name)
79 StatusCode ColumnarLinkTool ::
85 return StatusCode::FAILURE;
96 return StatusCode::FAILURE;
100 slot.sgKey = keyIter->second;
101 slot.accessorData = std::make_unique<ColumnAccessorDataArray>
102 (&slot.dataIndex, &slot.accessorData,
107 info.isOffset =
true;
108 addColumn (name, slot.accessorData.get(), std::move (info));
119 std::string parentOffsetName = sourceContainerName;
120 for (
unsigned i = 0; i <
depth; ++ i)
122 const std::string name = linkOffsetName (i,
depth);
125 parentOffsetName,
true);
126 parentOffsetName = name;
131 const std::string& innerOffsetName = parentOffsetName;
132 const std::string dataSuffix = (
depth == 0u ?
"" :
".data");
135 std::string (
"Container.linkIndex") + dataSuffix,
139 std::string (
"Container.linkSGKey") + dataSuffix,
143 std::string (
"Container.outLink") + dataSuffix,
150 return StatusCode::SUCCESS;
155 void ColumnarLinkTool ::
162 void** dataArea =
event.getDataArea();
163 const std::size_t eventIdx =
event.getIndex();
169 std::size_t flatStart = srcPartOff[eventIdx];
170 std::size_t flatEnd = srcPartOff[eventIdx + 1];
174 (dataArea[off.dataIndex]);
175 flatStart =
a[flatStart];
176 flatEnd =
a[flatEnd];
179 const auto *indexArr =
static_cast<const CM::LinkIndexType*
>
181 const auto *keyArr =
static_cast<const SG::sgkey_t*
>
183 auto *outArr =
static_cast<CM::LinkIndexType*
>
186 for (std::size_t j = flatStart; j < flatEnd; ++ j)
188 const CM::LinkIndexType
index = indexArr[j];
191 if (
index == 0 && key == 0)
193 outArr[j] = CM::invalidLinkValue;
205 throw std::runtime_error
206 (
"ColumnarLinkTool: unknown sgkey " + std::to_string (key));
208 outArr[j] = CM::mergeLinkKeyIndex (0xfe,
index);
214 const CM::LinkIndexType myIndex =
index + targetOffsets[eventIdx];
215 if (myIndex >= targetOffsets[eventIdx + 1])
217 throw std::runtime_error
218 (
"ColumnarLinkTool: link index " + std::to_string (
index)
219 +
" out of range for target "
223 outArr[j] = CM::mergeLinkKeyIndex (t, myIndex);
std::string depth
tag string for intendation
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
@ u
Enums for curvilinear frames.
ObjectRange< EventContextDef > EventContextRange
ObjectId< EventContextDef > EventContextId
const std::unordered_map< std::string, SG::sgkey_t > knownSgKeys
lookup table from container name to its sgkey hash
constexpr std::string_view eventContextCIName
the name for the event context container id
ColumnAccessMode
an enum for the different access modes for a column
std::size_t ColumnarOffsetType
the type used for the size and offsets in the columnar data
a struct that contains meta-information about each column that's needed to interface the column with ...
std::size_t LinkIndexType
the type used for columns that represent element links