78 std::vector<o2::test::Polymorphic>
c{{0xaffe}, {0xd00f}};
80 std::deque<int> testDequePayload{10, 20, 30};
86 pc.outputs().snapshot(
Output{
"TST",
"MESSAGEABLE", 0, {meta1, meta2}},
a);
87 pc.outputs().snapshot(
Output{
"TST",
"MSGBLEROOTSRLZ", 0},
91 pc.outputs().snapshot(
Output{
"TST",
"ROOTNONTOBJECT", 0},
b);
93 pc.outputs().snapshot(
Output{
"TST",
"ROOTVECTOR", 0},
c);
95 pc.outputs().snapshot(
Output{
"TST",
"DEQUE", 0}, testDequePayload);
98 pc.outputs().snapshot(
Output{
"TST",
"ROOTSERLZDVEC", 0}, d);
100 auto* cl = TClass::GetClass(
typeid(
decltype(
c)));
103 pc.outputs().snapshot(
Output{
"TST",
"ROOTSERLZDVEC2", 0}, e);
108 for (
auto&
object : multi) {
112 auto freefct = [](
void*
data,
void* hint) {};
113 static std::string teststring =
"adoptchunk";
114 pc.outputs().adoptChunk(
Output{
"TST",
"ADOPTCHUNK", 0}, teststring.data(), teststring.length(), freefct,
nullptr);
116 auto& growchunk = pc.outputs().newChunk(
OutputRef{
"growchunk", 0}, 0);
120 auto& shrinkchunk = pc.outputs().newChunk(
OutputRef{
"shrinkchunk", 0}, 1000000);
124 auto& rootobject = pc.outputs().make<TNamed>(
OutputRef{
"maketobject", 0},
"a_name",
"a_title");
128 auto& rootserlzblvector = pc.outputs().make<std::vector<o2::test::Polymorphic>>(
OutputRef{
"rootserlzblvector", 0});
129 rootserlzblvector.emplace_back(0xacdc);
130 rootserlzblvector.emplace_back(0xbeef);
132 auto& messageablevector = pc.outputs().make<std::vector<o2::test::TriviallyCopyable>>(
OutputRef{
"messageablevector", 0});
134 messageablevector.push_back(
a);
135 messageablevector.emplace_back(10, 20, 0xacdc);
141 pc.outputs().make<
int>(
OutputRef{
"multiparts", 0}) = 10;
142 pc.outputs().make<
int>(
OutputRef{
"multiparts", 1}) = 20;
143 pc.outputs().make<
int>(
OutputRef{
"multiparts", 2}) = 30;
146 Output pmrOutputSpec{
"TST",
"PMRTESTVECTOR", 0};
150 pc.outputs().adoptContainer(pmrOutputSpec, std::move(pmrvec));
153 pc.outputs().make<std::vector<int>>(
OutputRef{
"podvector"}) = {10, 21, 42};
156 pc.outputs().snapshot(
Output{
"TST",
"ROOTSERLZDPTRVEC", 0}, ptrVec);
162 ASSERT_ERROR(pc.outputs().isAllowed({
"TST",
"MESSAGEABLE", 0}) ==
true);
163 ASSERT_ERROR(pc.outputs().isAllowed({
"TST",
"MESSAGEABLE", 1}) ==
false);
164 ASSERT_ERROR(pc.outputs().isAllowed({
"TST",
"NOWAY", 0}) ==
false);
165 for (
auto ptr : ptrVec) {
172 {
OutputSpec{
"TST",
"MESSAGEABLE", 0, Lifetime::Timeframe},
173 OutputSpec{{
"makesingle"},
"TST",
"MAKESINGLE", 0, Lifetime::Timeframe},
174 OutputSpec{{
"makespan"},
"TST",
"MAKESPAN", 0, Lifetime::Timeframe},
175 OutputSpec{{
"growchunk"},
"TST",
"GROWCHUNK", 0, Lifetime::Timeframe},
176 OutputSpec{{
"shrinkchunk"},
"TST",
"SHRINKCHUNK", 0, Lifetime::Timeframe},
177 OutputSpec{{
"maketobject"},
"TST",
"MAKETOBJECT", 0, Lifetime::Timeframe},
178 OutputSpec{{
"makerootserlzblobj"},
"TST",
"ROOTSERLZBLOBJ", 0, Lifetime::Timeframe},
179 OutputSpec{{
"rootserlzblvector"},
"TST",
"ROOTSERLZBLVECT", 0, Lifetime::Timeframe},
180 OutputSpec{{
"messageablevector"},
"TST",
"MSGABLVECTOR", 0, Lifetime::Timeframe},
181 OutputSpec{{
"multiparts"},
"TST",
"MULTIPARTS", 0, Lifetime::Timeframe},
182 OutputSpec{{
"multiparts"},
"TST",
"MULTIPARTS", 1, Lifetime::Timeframe},
183 OutputSpec{{
"multiparts"},
"TST",
"MULTIPARTS", 2, Lifetime::Timeframe},
184 OutputSpec{
"TST",
"ADOPTCHUNK", 0, Lifetime::Timeframe},
185 OutputSpec{
"TST",
"MSGBLEROOTSRLZ", 0, Lifetime::Timeframe},
186 OutputSpec{
"TST",
"ROOTNONTOBJECT", 0, Lifetime::Timeframe},
187 OutputSpec{
"TST",
"ROOTVECTOR", 0, Lifetime::Timeframe},
188 OutputSpec{
"TST",
"DEQUE", 0, Lifetime::Timeframe},
189 OutputSpec{
"TST",
"ROOTSERLZDVEC", 0, Lifetime::Timeframe},
190 OutputSpec{
"TST",
"ROOTSERLZDVEC2", 0, Lifetime::Timeframe},
191 OutputSpec{
"TST",
"PMRTESTVECTOR", 0, Lifetime::Timeframe},
192 OutputSpec{{
"podvector"},
"TST",
"PODVECTOR", 0, Lifetime::Timeframe},
193 OutputSpec{{
"inputPtrVec"},
"TST",
"ROOTSERLZDPTRVEC", 0, Lifetime::Timeframe}},
201 for (
auto iit = pc.inputs().begin(), iend = pc.inputs().end(); iit != iend; ++iit) {
202 auto const& input = *iit;
203 LOG(info) << (*iit).spec->binding <<
" " << (iit.isValid() ?
"is valid" :
"is not valid");
204 if (iit.isValid() ==
false) {
207 auto* dh = DataRefUtils::getHeader<const DataHeader*>(input);
208 LOG(info) <<
"{" << dh->dataOrigin.str <<
":" << dh->dataDescription.str <<
":" << dh->subSpecification <<
"}"
209 <<
" payload size " << dh->payloadSize;
214 if (
h->flagsNextHeader) {
215 auto next =
reinterpret_cast<const std::byte*
>(
h) +
h->size();
222 if ((*iit).spec->binding ==
"inputMP") {
223 LOG(info) <<
"inputMP with " << iit.size() <<
" part(s)";
225 for (
auto const&
ref : iit) {
226 LOG(info) <<
"accessing part " << nPart++ <<
" of input slot 'inputMP':"
227 << pc.inputs().get<
int>(
ref);
234 LOG(info) <<
"extracting o2::test::TriviallyCopyable from input1";
237 LOG(info) <<
"extracting span of o2::test::TriviallyCopyable from input1";
238 auto object1span = pc.inputs().get<gsl::span<o2::test::TriviallyCopyable>>(
"input1");
242 auto* metaHeader1 = DataRefUtils::getHeader<test::MetaHeader*>(pc.inputs().get(
"input1"));
244 auto* metaHeader2 = metaHeader1 ? o2::header::get<test::MetaHeader*>(metaHeader1->next()) :
nullptr;
247 ASSERT_ERROR(metaHeader2 !=
nullptr && metaHeader2->secret == 23);
250 LOG(info) <<
"extracting o2::test::TriviallyCopyable pointer from input2";
256 LOG(info) <<
"extracting o2::test::Polymorphic pointer from input3";
262 LOG(info) <<
"extracting vector of o2::test::Polymorphic from input4";
263 auto object4 = pc.inputs().get<std::vector<o2::test::Polymorphic>>(
"input4");
269 LOG(info) <<
"extracting vector of o2::test::Polymorphic from input5";
270 auto object5 = pc.inputs().get<std::vector<o2::test::Polymorphic>>(
"input5");
276 LOG(info) <<
"extracting vector of o2::test::Polymorphic from input6";
277 auto object6 = pc.inputs().get<std::vector<o2::test::Polymorphic>>(
"input6");
283 LOG(info) <<
"extracting raw char* from input1";
284 auto rawchar = pc.inputs().get<
const char*>(
"input1");
288 LOG(info) <<
"extracting o2::test::TriviallyCopyable from input7";
292 LOG(info) <<
"extracting span of o2::test::TriviallyCopyable from input8";
293 auto objectspan8 = DataRefUtils::as<o2::test::TriviallyCopyable>(pc.inputs().get(
"input8"));
295 for (
auto const& object8 : objectspan8) {
299 LOG(info) <<
"extracting std::string from input9";
300 auto object9 = pc.inputs().get<std::string>(
"input9");
303 LOG(info) <<
"extracting o2::test::TriviallyCopyable from input10";
307 LOG(info) <<
"extracting o2::test::TriviallyCopyable from input11";
311 LOG(info) <<
"extracting the original std::vector<o2::test::TriviallyCopyable> as span from input12";
312 auto object12 = pc.inputs().get<gsl::span<o2::test::TriviallyCopyable>>(
"input12");
317 pc.outputs().snapshot(
Output{
"TST",
"MSGABLVECTORCPY", 0}, object12);
319 LOG(info) <<
"extracting TNamed object from input13";
320 auto object13 = pc.inputs().get<TNamed*>(
"input13");
321 ASSERT_ERROR(strcmp(object13->GetName(),
"a_name") == 0);
322 ASSERT_ERROR(strcmp(object13->GetTitle(),
"a_title") == 0);
324 LOG(info) <<
"extracting Root-serialized Non-TObject from input14";
328 LOG(info) <<
"extracting Root-serialized vector from input15";
329 auto object15 = pc.inputs().
get<std::vector<o2::test::Polymorphic>>(
"input15");
333 LOG(info) <<
"extracting deque to vector from input16";
334 auto object16 = pc.inputs().get<std::vector<int>>(
"input16");
335 LOG(info) <<
"object16.size() = " << object16.size() << std::endl;
337 ASSERT_ERROR(object16[0] == 10 && object16[1] == 20 && object16[2] == 30);
339 LOG(info) <<
"extracting PMR vector";
340 auto pmrspan = pc.inputs().get<gsl::span<o2::test::TriviallyCopyable>>(
"inputPMR");
342 auto dataref = pc.inputs().get<
DataRef>(
"inputPMR");
343 auto header = DataRefUtils::getHeader<const o2::header::DataHeader*>(dataref);
346 LOG(info) <<
"extracting POD vector";
348 decltype(std::declval<InputRecord>().get<std::vector<int>>(
DataRef{
nullptr,
nullptr,
nullptr})) podvector;
349 podvector = pc.inputs().get<std::vector<int>>(
"inputPODvector");
351 ASSERT_ERROR(podvector[0] == 10 && podvector[1] == 21 && podvector[2] == 42);
353 LOG(info) <<
"extracting vector of o2::test::Base* from inputPtrVec";
354 auto ptrVec = pc.inputs().get<std::vector<o2::test::Base*>>(
"inputPtrVec");
369 {
InputSpec{
"input1",
"TST",
"MESSAGEABLE", 0, Lifetime::Timeframe},
370 InputSpec{
"input2",
"TST",
"MSGBLEROOTSRLZ", 0, Lifetime::Timeframe},
371 InputSpec{
"input3",
"TST",
"ROOTNONTOBJECT", 0, Lifetime::Timeframe},
372 InputSpec{
"input4",
"TST",
"ROOTVECTOR", 0, Lifetime::Timeframe},
373 InputSpec{
"input5",
"TST",
"ROOTSERLZDVEC", 0, Lifetime::Timeframe},
374 InputSpec{
"input6",
"TST",
"ROOTSERLZDVEC2", 0, Lifetime::Timeframe},
375 InputSpec{
"input7",
"TST",
"MAKESINGLE", 0, Lifetime::Timeframe},
376 InputSpec{
"input8",
"TST",
"MAKESPAN", 0, Lifetime::Timeframe},
377 InputSpec{
"input9",
"TST",
"ADOPTCHUNK", 0, Lifetime::Timeframe},
378 InputSpec{
"input10",
"TST",
"GROWCHUNK", 0, Lifetime::Timeframe},
379 InputSpec{
"input11",
"TST",
"SHRINKCHUNK", 0, Lifetime::Timeframe},
380 InputSpec{
"input12",
"TST",
"MSGABLVECTOR", 0, Lifetime::Timeframe},
381 InputSpec{
"input13",
"TST",
"MAKETOBJECT", 0, Lifetime::Timeframe},
382 InputSpec{
"input14",
"TST",
"ROOTSERLZBLOBJ", 0, Lifetime::Timeframe},
383 InputSpec{
"input15",
"TST",
"ROOTSERLZBLVECT", 0, Lifetime::Timeframe},
384 InputSpec{
"input16",
"TST",
"DEQUE", 0, Lifetime::Timeframe},
385 InputSpec{
"inputPMR",
"TST",
"PMRTESTVECTOR", 0, Lifetime::Timeframe},
386 InputSpec{
"inputPODvector",
"TST",
"PODVECTOR", 0, Lifetime::Timeframe},
388 InputSpec{
"inputPtrVec",
"TST",
"ROOTSERLZDPTRVEC", 0, Lifetime::Timeframe}},