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:
@@ -12,6 +12,18 @@
|
||||
namespace smo {
|
||||
namespace device {
|
||||
|
||||
/* Carrier used by the DAP spec parser to pass one parenthesized segment
|
||||
* (e.g. postrin(interest-pc=85) or pcloudAmbience(...)) up the reduction
|
||||
* stack; the spec_body reduction classifies segments and populates the
|
||||
* DeviceAttachmentSpec. Defined here so both the parser header and consumers
|
||||
* of the generated header see the type.
|
||||
*/
|
||||
struct DapSegment
|
||||
{
|
||||
std::string name;
|
||||
std::vector<std::pair<std::string, std::string>> params;
|
||||
};
|
||||
|
||||
class DeviceAttachmentSpec
|
||||
{
|
||||
public:
|
||||
@@ -26,6 +38,8 @@ public:
|
||||
{
|
||||
return deviceIdentifier == other.deviceIdentifier &&
|
||||
sensorType == other.sensorType &&
|
||||
postrin == other.postrin &&
|
||||
negtrin == other.negtrin &&
|
||||
qualeIfaceApi == other.qualeIfaceApi &&
|
||||
stimBuffApi == other.stimBuffApi &&
|
||||
provider == other.provider &&
|
||||
@@ -35,6 +49,15 @@ public:
|
||||
public:
|
||||
std::string deviceIdentifier;
|
||||
char sensorType;
|
||||
/* postrin/negtrin hold the literal segment name ("postrin" /
|
||||
* "negtrin") when present, empty string when the DAP spec omits the
|
||||
* corresponding intrin specifier. Params vectors carry the params from
|
||||
* within the postrin(...)/negtrin(...) segment.
|
||||
*/
|
||||
std::string postrin;
|
||||
std::vector<std::pair<std::string,std::string>> postrinParams;
|
||||
std::string negtrin;
|
||||
std::vector<std::pair<std::string,std::string>> negtrinParams;
|
||||
std::string qualeIfaceApi;
|
||||
std::vector<std::pair<std::string,std::string>> qualeIfaceApiParams;
|
||||
std::string stimBuffApi;
|
||||
@@ -43,12 +66,40 @@ public:
|
||||
std::vector<std::pair<std::string,std::string>> providerParams;
|
||||
std::string deviceSelector;
|
||||
|
||||
static void stringifyParams(
|
||||
std::ostream& os,
|
||||
const std::vector<std::pair<std::string,std::string>>& params)
|
||||
{
|
||||
for (const auto& param : params)
|
||||
{
|
||||
os << param.first;
|
||||
if (!param.second.empty()) {
|
||||
os << "=" << param.second;
|
||||
}
|
||||
os << " ";
|
||||
}
|
||||
}
|
||||
|
||||
std::string stringify() const
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "Device Identifier: " << deviceIdentifier
|
||||
<< ", Sensor Type: " << sensorType
|
||||
<< ", QualeIface API: " << qualeIfaceApi << ", QualeIface API Params: (";
|
||||
<< ", Sensor Type: " << sensorType;
|
||||
|
||||
if (!postrin.empty())
|
||||
{
|
||||
os << ", Postrin Params: (";
|
||||
stringifyParams(os, postrinParams);
|
||||
os << ")";
|
||||
}
|
||||
if (!negtrin.empty())
|
||||
{
|
||||
os << ", Negtrin Params: (";
|
||||
stringifyParams(os, negtrinParams);
|
||||
os << ")";
|
||||
}
|
||||
|
||||
os << ", QualeIface API: " << qualeIfaceApi << ", QualeIface API Params: (";
|
||||
for (const auto& param : qualeIfaceApiParams)
|
||||
{
|
||||
os << param.first;
|
||||
|
||||
Reference in New Issue
Block a user