DataRequest< NamedKeys< Keys... > >
DataRequest< NamedKeys< Keys… > >
Section titled “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); // EquivalentThis additional literal syntax is format-specific. Refer to the relevant docs. The positional constructor is always available.
Template Parameters
Section titled “Template Parameters”Keys...The set of named schema fields. E.g. <“alg”, “field”>
Public Attributes
Section titled “Public Attributes”| 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. |
group_name
Section titled “group_name”FixedName group_nameType: FixedName
Defined in src/lib/sbio/core/request.hh:114
group_type
Section titled “group_type”FixedName group_typeType: FixedName
Defined in src/lib/sbio/core/request.hh:115
segment_number
Section titled “segment_number”hd_std::size_t segment_number { 0 }Defined in src/lib/sbio/core/request.hh:116
field_values
Section titled “field_values”hd_std::array< FixedName<>, sizeof...(Keys)> field_valuesType: hd_std::array< FixedName<>, sizeof…(Keys)>
Defined in src/lib/sbio/core/request.hh:119
Values for each keyword FieldKey.
Public Methods
Section titled “Public Methods”| 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. |
DataRequest
Section titled “DataRequest”SBIO_HD DataRequest() = defaultDefined in src/lib/sbio/core/request.hh:121
Defaulted member function.
DataRequest
Section titled “DataRequest”inline
inline SBIO_HD DataRequest(const char * name, const char * type)Defined in src/lib/sbio/core/request.hh:123
DataRequest
Section titled “DataRequest”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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name |
const char * |
The BrokerGroup name. |
type |
const char * |
The BrokerGroup type. |
DataRequest
Section titled “DataRequest”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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name |
const char * |
The BrokerGroup name. |
type |
const char * |
The BrokerGroup type. |
operator[]
Section titled “operator[]”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"];Returns
Section titled “Returns”The name of the field to retrieve.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
key_name |
const FKey & |
The name of the key to retrieve. |
operator[]
Section titled “operator[]”const inline
template<typename FKey> inline SBIO_HD const FixedName & operator[](const FKey & key_name) constDefined 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"];Returns
Section titled “Returns”The name of the field to retrieve.
Parameters
Section titled “Parameters”| 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() constDefined in src/lib/sbio/core/request.hh:266
Retrieve the value of a named argument.
req.get<"field">();Returns
Section titled “Returns”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");Public Types
Section titled “Public Types”| Name | Description |
|---|---|
FieldKeys |
Keyword names. |
FieldKeys
Section titled “FieldKeys”using FieldKeys = NamedKeys< Keys... >Type: NamedKeys< Keys… >
Defined in src/lib/sbio/core/request.hh:118
Keyword names.