Skip to content

DataRequest< NamedKeys< Keys... > >

#include <sbio/core/request.hh>
template<FixedName... Keys>
struct DataRequest< NamedKeys< Keys... > >

Defined in src/lib/sbio/core/request.hh:113

Container used to specify retrieval of a specific piece of data.

The DataRequest is used by BrokerGroups to pull data of a specific type. At minimum, the request always contains a group_name and group_type. Depending on the specific data-format, the request may be made up of additional parameters that uniquely determine the data requested. E.g., a format may require a single additional parameter (like a field name). Some other format may require two (e.g. XTC2 uses an alg and a field).

The additional format-specific fields are stored using FixedName structs, which are simple device-safe, and constexpr, string like objects. The set of [NamedKeys](api-sbio-NamedKeys.md#namedkeys) can be accessed with compile-time template mechanisms, or fully at runtime using familiar bracket access, as with a map.

The additional request fields can be filled at compile using the set<NAME> routine. The group_name and group_type are also FixedName objects and can be set using simple assignment. (req.group_name = “MyGroupNameOfInterest”).

The additional fields can be retrieved using the get<NAME> syntax.

Additionally, a final affordance allows a request to be constructed using arguments converted into a [NamedArg](api-sbio-NamedArg.md#namedarg). The recommendation is that a format provide a literal operator overload that allows attaching a keyword to a string literal, which then allows them to be passed to a constructor positionally in any order. This emulates the behaviour of keyword arguments.

For example, the XTC2 format uses _alg and _field literals. These can be passed in any order to the DataRequest constructor. By proxy, this means the variadic getters for the BrokerGroup also work this way.

DataRequest("raw"_alg, "raw"_field);
DataRequest("raw"_field, "raw"_alg); // Equivalent
// This means the BrokerGroup variadic get_data routines work this way as well:
// grp.get_data(step, "raw"_alg, "raw"_field);
// grp.get_data(step, "raw"_field, "raw"_alg); // Equivalent

This additional literal syntax is format-specific. Refer to the relevant docs. The positional constructor is always available.

  • Keys... The set of named schema fields. E.g. <“alg”, “field”>
Return Name Description
FixedName group_name
FixedName group_type
hd_std::size_t segment_number
hd_std::array< FixedName<>, sizeof…(Keys)> field_values Values for each keyword FieldKey.

FixedName group_name

Type: FixedName

Defined in src/lib/sbio/core/request.hh:114


FixedName group_type

Type: FixedName

Defined in src/lib/sbio/core/request.hh:115


hd_std::size_t segment_number { 0 }

Defined in src/lib/sbio/core/request.hh:116


hd_std::array< FixedName<>, sizeof...(Keys)> field_values

Type: hd_std::array< FixedName<>, sizeof…(Keys)>

Defined in src/lib/sbio/core/request.hh:119

Values for each keyword FieldKey.

Return Name Description
SBIO_HD DataRequest Defaulted member function.
SBIO_HD DataRequest inline
SBIO_HD DataRequest inline requires ValidPositionalArgs<sizeof...(Keys), Args...> Construct a request with name, type and positional FixedNames.
SBIO_HD DataRequest inline requires ValidNamedArgs<sizeof...(Keys), NamedArgs...> Construct a request with name, type and NamedArg instances.
SBIO_HDFixedName & operator[] inline Retrieve the value of a named argument - segment number cannot be accessed.
SBIO_HD const FixedName & operator[] const inline Retrieve the value of a named argument - segment number cannot be accessed.
SBIO_HD const FixedName & get const inline Retrieve the value of a named argument.
SBIO_HD void set inline Set the value of a named argument.

SBIO_HD DataRequest() = default

Defined in src/lib/sbio/core/request.hh:121

Defaulted member function.


inline

inline SBIO_HD DataRequest(const char * name, const char * type)

Defined in src/lib/sbio/core/request.hh:123


inline requires ValidPositionalArgs<sizeof...(Keys), Args...>

template<typename... Args> inline SBIO_HD DataRequest(const char * name, const char * type, Args... args) requires ValidPositionalArgs<sizeof...(Keys), Args...>

Defined in src/lib/sbio/core/request.hh:145

Construct a request with name, type and positional FixedNames.

The FixedName arguments must be passed in the appropriate order to match the way the fields were defined by the format. E.g., a format that provided <“alg”, “field”> will then expect that the alg value come before the field value in construction of the request.

For use of a “keyword” argument like syntax, see the NamedArgs constructor.

Parameter Type Description
name const char * The BrokerGroup name.
type const char * The BrokerGroup type.

inline requires ValidNamedArgs<sizeof...(Keys), NamedArgs...>

template<typename... NamedArgs> inline SBIO_HD DataRequest(const char * name, const char * type, NamedArgs... args) requires ValidNamedArgs<sizeof...(Keys), NamedArgs...>

Defined in src/lib/sbio/core/request.hh:170

Construct a request with name, type and NamedArg instances.

By convention, NamedArgs can be created from literals where a literal operator overload has been provided.

Parameter Type Description
name const char * The BrokerGroup name.
type const char * The BrokerGroup type.

inline

template<typename FKey> inline SBIO_HDFixedName & operator[](const FKey & key_name)

Defined in src/lib/sbio/core/request.hh:204

Retrieve the value of a named argument - segment number cannot be accessed.

The value of key_name may be “group_name”, “group_type” or any of the format-specific values that are provided. The segment number cannot be retrieved from this function.

req["field"];

The name of the field to retrieve.

Parameter Type Description
key_name const FKey & The name of the key to retrieve.

const inline

template<typename FKey> inline SBIO_HD const FixedName & operator[](const FKey & key_name) const

Defined in src/lib/sbio/core/request.hh:239

Retrieve the value of a named argument - segment number cannot be accessed.

The value of key_name may be “group_name”, “group_type” or any of the format-specific values that are provided. The segment number cannot be retrieved from this function.

req["field"];

The name of the field to retrieve.

Parameter Type Description
key_name const FKey & The name of the key to retrieve.

const inline

template<FixedName Key> inline SBIO_HD const FixedName & get() const

Defined in src/lib/sbio/core/request.hh:266

Retrieve the value of a named argument.

req.get<"field">();

The value of the named argument.


inline

template<FixedName Key> inline SBIO_HD void set(const char * val)

Defined in src/lib/sbio/core/request.hh:292

Set the value of a named argument.

req.set<"field">("raw");
Name Description
FieldKeys Keyword names.

using FieldKeys = NamedKeys< Keys... >

Type: NamedKeys< Keys… >

Defined in src/lib/sbio/core/request.hh:118

Keyword names.