-
Notifications
You must be signed in to change notification settings - Fork 499
Expand file tree
/
Copy pathInputRecord.cxx
More file actions
90 lines (81 loc) · 2 KB
/
InputRecord.cxx
File metadata and controls
90 lines (81 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "Framework/InputRecord.h"
#include "Framework/InputSpec.h"
#include <fairmq/FairMQMessage.h>
#include <cassert>
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
#include <arrow/builder.h>
#include <arrow/memory_pool.h>
#include <arrow/record_batch.h>
#include <arrow/table.h>
#include <arrow/type_traits.h>
#include <arrow/status.h>
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
namespace o2::framework
{
InputRecord::InputRecord(std::vector<InputRoute> const& inputsSchema,
InputSpan&& span)
: mInputsSchema{inputsSchema},
mSpan{std::move(span)}
{
}
int InputRecord::getPos(const char* binding) const
{
auto inputIndex = 0;
for (size_t i = 0; i < mInputsSchema.size(); ++i) {
auto& route = mInputsSchema[i];
if (route.timeslice != 0) {
continue;
}
if (route.matcher.binding == binding) {
return inputIndex;
}
++inputIndex;
}
return -1;
}
int InputRecord::getPos(std::string const& binding) const
{
return this->getPos(binding.c_str());
}
bool InputRecord::isValid(char const* s) const
{
DataRef ref = get(s);
if (ref.header == nullptr) {
return false;
}
return true;
}
bool InputRecord::isValid(int s) const
{
if (s >= size()) {
return false;
}
DataRef ref = getByPos(s);
if (ref.header == nullptr) {
return false;
}
return true;
}
size_t InputRecord::countValidInputs() const
{
size_t count = 0;
for (auto&& _ : *this) {
++count;
}
return count;
}
} // namespace o2::framework