DAP: Add intrin DAPSpecs

We now specify intrins as separate DAPS lines. This syntax is much
nicer and well-grouped than the previous negtrin-*/postrin-* param
names.

Alas, we're about to replace it in the next few commits already though.
This commit is contained in:
2026-04-12 04:06:47 -04:00
parent c696316a1e
commit fc1fcae0b0
14 changed files with 595 additions and 284 deletions
@@ -5,11 +5,34 @@
#include <memory>
#include <optional>
#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,
@@ -21,14 +44,14 @@ struct ParamComparator
ParamComparatorOp op;
uint32_t value;
bool operator()(float ambienceVal) const
bool operator()(float passbandMetricVal) const
{
switch (op)
{
case OP_CMP_GT:
return ambienceVal > static_cast<float>(value);
return passbandMetricVal > static_cast<float>(value);
case OP_CMP_LT:
return ambienceVal < static_cast<float>(value);
return passbandMetricVal < static_cast<float>(value);
}
throw std::runtime_error("Unsupported ParamComparatorOp");
@@ -41,15 +64,15 @@ inline std::optional<ParamComparator> parseOptionalPcloudAmbienceParamComparator
const auto& params = deviceAttachmentSpec->qualeIfaceApiParams;
constexpr int kParamNotSpecified = -1;
const int gtVal = device::DeviceAttachmentSpec::parseOptionalParamAsInt(
params, "ambience-count-gt-val", kParamNotSpecified);
params, "passband-count-gt-val", kParamNotSpecified);
const int ltVal = device::DeviceAttachmentSpec::parseOptionalParamAsInt(
params, "ambience-count-lt-val", kParamNotSpecified);
params, "passband-count-lt-val", kParamNotSpecified);
if (gtVal != kParamNotSpecified && ltVal != kParamNotSpecified)
{
throw std::runtime_error(
"Only one of 'ambience-count-gt-val' or 'ambience-count-lt-val' "
"may be specified for a pcloudAmbience stim buff instance");
"Only one of 'passband-count-gt-val' or 'passband-count-lt-val' "
"may be specified for a PcloudAmbience intrinsic pipeline");
}
if (gtVal != kParamNotSpecified)