![]() |
Project
|
The input API of the Data Processing Layer This class holds the inputs which are valid for processing. The user can get an instance for it via the ProcessingContext and can use it to retrieve the inputs, either by name or by index. A few utility methods are provided to automatically cast the (deserialized) inputs to known types. More...
#include <InputRecord.h>
Classes | |
| class | Deleter |
| struct | InputPos |
| class | InputRecordIterator |
| class | Iterator |
| struct | PartRange |
| A range over the parts of a single slot that sets ref.spec on each DataRef. More... | |
Public Types | |
| using | DataHeader = o2::header::DataHeader |
| using | iterator = InputRecordIterator< DataRef > |
| using | const_iterator = InputRecordIterator< const DataRef > |
Public Member Functions | |
| InputRecord (std::vector< InputRoute > const &inputs, InputSpan &span, ServiceRegistryRef) | |
| int | getPos (const char *name) const |
| int | getPos (ConcreteDataMatcher matcher) const |
| int | getPos (const std::string &name) const |
| DataRef | getByPos (int pos, int part=0) const |
| DataRef | getFirstValid (bool throwOnFailure=false) const |
| Get the ref of the first valid input. If requested, throw an error if none is found. | |
| size_t | getNofParts (int pos) const |
| DataRef | getAtIndices (int pos, DataRefIndices indices) const |
| O(1) access to the part described by indices in slot pos. | |
| fair::mq::Message * | getPayloadAtIndices (size_t slotIdx, DataRefIndices indices) const |
| Return the payload as fair::mq::Message* for the part described by indices in slot slotIdx. | |
| DataRefIndices | nextIndices (int pos, DataRefIndices current) const |
| O(1) advance from current to the next part's indices in slot pos. | |
| DataRef | getDataRefByString (const char *bindingName, int part=0) const |
| template<typename R > requires std::is_convertible_v<R, char const*> | |
| DataRef | getRef (R binding, int part=0) const |
| template<typename R > requires requires(R r) { r.c_str(); } | |
| DataRef | getRef (R binding, int part=0) const |
| template<typename R > requires std::is_convertible_v<R, DataRef> | |
| DataRef | getRef (R ref, int part=0) const |
| template<typename T = DataRef, typename R > | |
| decltype(auto) | get (R binding, int part=0) const |
| template<typename T = DataRef, typename R > requires std::same_as<T, CCDBMetadataExtractor> | |
| std::map< std::string, std::string > & | get (R binding, int part=0) const |
| template<typename T = DataRef, typename R > requires std::same_as<T, CCDBBlob> | |
| std::span< const char > | get (R binding, int part=0) const |
| template<typename T > requires (std::same_as<T, DataRef>) | |
| decltype(auto) | get (ConcreteDataMatcher matcher, int part=0) |
| template<typename T > requires (std::same_as<T, TableConsumer>) | |
| decltype(auto) | get (ConcreteDataMatcher matcher, int part=0) |
| bool | isValid (std::string const &s) const |
| Helper method to be used to check if a given part of the InputRecord is present. | |
| bool | isValid (char const *s) const |
| Helper method to be used to check if a given part of the InputRecord is present. | |
| bool | isValid (int pos) const |
| size_t | size () const |
| size_t | countValidInputs () const |
| const_iterator | begin () const |
| const_iterator | end () const |
| PartRange | parts (size_t pos) const |
| Return an iterable range over all parts in slot pos (DataRef objects have spec set). | |
| InputSpan & | span () |
Static Public Member Functions | |
| static InputPos | getPos (std::vector< InputRoute > const &routes, ConcreteDataMatcher matcher) |
| static DataRef | getByPos (std::vector< InputRoute > const &routes, InputSpan const &span, int pos, int part=0) |
The input API of the Data Processing Layer This class holds the inputs which are valid for processing. The user can get an instance for it via the ProcessingContext and can use it to retrieve the inputs, either by name or by index. A few utility methods are provided to automatically cast the (deserialized) inputs to known types.
auto& v1 = get<int>("input1");
auto v2 = get<vector<int>>("input2");
auto v3 = get<TList*>("input3");
auto v4 = get<vector<TParticle>>("input4");
Iterator functionality is implemented to iterate over the list of DataRef objects, including begin() and end() methods.
for (auto const& ref : inputs) {
// do something with DataRef object ref
}
Definition at line 109 of file InputRecord.h.
| using o2::framework::InputRecord::const_iterator = InputRecordIterator<const DataRef> |
Definition at line 731 of file InputRecord.h.
Definition at line 112 of file InputRecord.h.
Definition at line 730 of file InputRecord.h.
| o2::framework::InputRecord::InputRecord | ( | std::vector< InputRoute > const & | inputs, |
| InputSpan & | span, | ||
| ServiceRegistryRef | registry | ||
| ) |
Definition at line 36 of file InputRecord.cxx.
|
inline |
Definition at line 733 of file InputRecord.h.
| size_t o2::framework::InputRecord::countValidInputs | ( | ) | const |
Definition at line 183 of file InputRecord.cxx.
|
inline |
Definition at line 738 of file InputRecord.h.
|
inline |
Definition at line 545 of file InputRecord.h.
|
inline |
Definition at line 557 of file InputRecord.h.
|
inline |
Get the object of specified type T for the binding R. If R is a string like object, we look up by name the InputSpec and return the data associated to the given label. If R is a DataRef, we extract the result object from the Payload, following the information provided by the Header. The actual operation and cast depends on the target data type and the serialization type of the incoming data. By default we return a DataRef, which is the pair of pointers to the header and payload of the O2 Message. See Inputrecord class description for supported types.
| ref | DataRef with pointers to input spec, header, and payload |
substitution for container of non-messageable objects with ROOT dictionary Notice that this will return a copy of the actual contents of the buffer, because the buffer is actually serialised. The extracted container is swaped to local, container, C++11 and beyond will implicitly apply return value optimization.
Definition at line 269 of file InputRecord.h.
|
inline |
Definition at line 491 of file InputRecord.h.
Definition at line 532 of file InputRecord.h.
| DataRef o2::framework::InputRecord::getAtIndices | ( | int | pos, |
| DataRefIndices | indices | ||
| ) | const |
O(1) access to the part described by indices in slot pos.
Definition at line 143 of file InputRecord.cxx.
Definition at line 86 of file InputRecord.cxx.
|
static |
Definition at line 91 of file InputRecord.cxx.
|
inline |
Definition at line 226 of file InputRecord.h.
| DataRef o2::framework::InputRecord::getFirstValid | ( | bool | throwOnFailure = false | ) | const |
Get the ref of the first valid input. If requested, throw an error if none is found.
Definition at line 120 of file InputRecord.cxx.
| size_t o2::framework::InputRecord::getNofParts | ( | int | pos | ) | const |
Definition at line 135 of file InputRecord.cxx.
| fair::mq::Message * o2::framework::InputRecord::getPayloadAtIndices | ( | size_t | slotIdx, |
| DataRefIndices | indices | ||
| ) | const |
Return the payload as fair::mq::Message* for the part described by indices in slot slotIdx.
Definition at line 152 of file InputRecord.cxx.
| int o2::framework::InputRecord::getPos | ( | ConcreteDataMatcher | matcher | ) | const |
Definition at line 61 of file InputRecord.cxx.
Definition at line 45 of file InputRecord.cxx.
| int o2::framework::InputRecord::getPos | ( | const std::string & | name | ) | const |
Definition at line 81 of file InputRecord.cxx.
|
static |
Definition at line 66 of file InputRecord.cxx.
Definition at line 238 of file InputRecord.h.
Definition at line 245 of file InputRecord.h.
Definition at line 252 of file InputRecord.h.
| bool o2::framework::InputRecord::isValid | ( | char const * | s | ) | const |
Helper method to be used to check if a given part of the InputRecord is present.
Definition at line 162 of file InputRecord.cxx.
| bool o2::framework::InputRecord::isValid | ( | int | pos | ) | const |
Definition at line 171 of file InputRecord.cxx.
|
inline |
Helper method to be used to check if a given part of the InputRecord is present.
Definition at line 565 of file InputRecord.h.
|
inline |
O(1) advance from current to the next part's indices in slot pos.
Definition at line 220 of file InputRecord.h.
|
inline |
Return an iterable range over all parts in slot pos (DataRef objects have spec set).
Definition at line 760 of file InputRecord.h.
| size_t o2::framework::InputRecord::size | ( | ) | const |
Definition at line 157 of file InputRecord.cxx.
|
inline |
Definition at line 762 of file InputRecord.h.