DAPS: Add intrin specs to nontrin specs
We no longer do intrin specs as a separate stimbuff; rather now we do them as a specifier segment within the pipeline spec of a normal nontrin spec.
This commit is contained in:
@@ -7,32 +7,10 @@
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <user/deviceAttachmentSpec.h>
|
||||
#include <vector>
|
||||
|
||||
namespace smo {
|
||||
namespace stim_buff {
|
||||
|
||||
inline std::string parseRequiredFromStimbuffQualeIfaceName(
|
||||
const std::vector<std::pair<std::string, std::string>>& params)
|
||||
{
|
||||
for (auto it = params.rbegin(); it != params.rend(); ++it)
|
||||
{
|
||||
if (it->first != "from-stimbuff")
|
||||
{ continue; }
|
||||
|
||||
if (it->second.empty())
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"'from-stimbuff' must name a non-empty sensory qualeIfaceApi");
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
throw std::runtime_error(
|
||||
"internal: 'from-stimbuff' missing after intrin policy validation");
|
||||
}
|
||||
|
||||
enum ParamComparatorOp
|
||||
{
|
||||
OP_CMP_GT,
|
||||
@@ -58,7 +36,19 @@ struct ParamComparator
|
||||
}
|
||||
};
|
||||
|
||||
inline std::optional<ParamComparator> parseOptionalPcloudAmbienceParamComparator(
|
||||
struct PcloudAmbiencePassbandComparators
|
||||
{
|
||||
std::optional<ParamComparator> lt;
|
||||
std::optional<ParamComparator> gt;
|
||||
};
|
||||
|
||||
/* Both `passband-count-lt-val` and `passband-count-gt-val` are permitted
|
||||
* simultaneously on a pcloudAmbience qualeIfaceApi: the lt comparator
|
||||
* typically feeds a postrin(...) segment (triggering on unusually low
|
||||
* counts), and the gt comparator typically feeds a negtrin(...) segment
|
||||
* (triggering on unusually high counts).
|
||||
*/
|
||||
inline PcloudAmbiencePassbandComparators parsePcloudAmbiencePassbandComparators(
|
||||
const std::shared_ptr<device::DeviceAttachmentSpec>& deviceAttachmentSpec)
|
||||
{
|
||||
const auto& params = deviceAttachmentSpec->qualeIfaceApiParams;
|
||||
@@ -68,30 +58,23 @@ inline std::optional<ParamComparator> parseOptionalPcloudAmbienceParamComparator
|
||||
const int ltVal = device::DeviceAttachmentSpec::parseOptionalParamAsInt(
|
||||
params, "passband-count-lt-val", kParamNotSpecified);
|
||||
|
||||
if (gtVal != kParamNotSpecified && ltVal != kParamNotSpecified)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"Only one of 'passband-count-gt-val' or 'passband-count-lt-val' "
|
||||
"may be specified for a PcloudAmbience intrinsic pipeline");
|
||||
}
|
||||
|
||||
PcloudAmbiencePassbandComparators out;
|
||||
if (gtVal != kParamNotSpecified)
|
||||
{
|
||||
return std::optional<ParamComparator>(ParamComparator{
|
||||
out.gt = ParamComparator{
|
||||
.op = OP_CMP_GT,
|
||||
.value = static_cast<uint32_t>(gtVal),
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
if (ltVal != kParamNotSpecified)
|
||||
{
|
||||
return std::optional<ParamComparator>(ParamComparator{
|
||||
out.lt = ParamComparator{
|
||||
.op = OP_CMP_LT,
|
||||
.value = static_cast<uint32_t>(ltVal),
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace stim_buff
|
||||
|
||||
Reference in New Issue
Block a user