pdb: simplify group trigger mapping

This commit is contained in:
Michael Davidsaver
2017-09-14 15:13:03 -05:00
parent 2e0fe07135
commit 2f9f760748
2 changed files with 18 additions and 40 deletions

View File

@ -20,7 +20,7 @@ record(calc, "$(N)Phase:I") {
field(PREC, "3")
field(FLNK, "$(N)Phase:Q")
info(Q:group, {
"$(N)iq":{"phas.i": {+type:"plain", +channel:"VAL"}}
"$(N)iq":{"phas.i": {+type:"plain", +channel:"VAL"}}
})
#field(TPRO, "1")
}
@ -33,7 +33,7 @@ record(calc, "$(N)Phase:Q") {
field(PREC, "3")
field(FLNK, "$(N)I")
info(Q:group, {
"$(N)iq":{"phas.q": {+type:"plain", +channel:"VAL"}}
"$(N)iq":{"phas.q": {+type:"plain", +channel:"VAL"}}
})
}
@ -44,7 +44,7 @@ record(waveform, "$(N)I") {
field(NELM, "500")
field(FLNK, "$(N)Q")
info(Q:group, {
"$(N)iq":{"I": {+channel:"VAL"}}
"$(N)iq":{"I": {+channel:"VAL"}}
})
}
@ -55,7 +55,7 @@ record(waveform, "$(N)Q") {
field(NELM, "500")
field(FLNK, "$(N)dly_")
info(Q:group, {
"$(N)iq":{"Q": {+channel:"VAL", +trigger:"Q>*"}}
"$(N)iq":{"Q": {+channel:"VAL", +trigger:"*"}}
})
}

View File

@ -78,41 +78,6 @@ struct PDBProcessor
std::string recbase;
GroupInfo *curgroup;
// process "pdbTrigger" to create/extend PDB to PVA monitor trigger mappings
void addTriggers(const char *value)
{
Splitter tok(value, '|');
std::string trigent;
while(tok.snip(trigent))
{
size_t eq = trigent.find_first_of('>');
if(eq==trigent.npos) {
std::ostringstream strm;
strm<<"Expected '>' in \""<<value<<"\"";
throw std::runtime_error(strm.str());
}
std::string pvf(trigent.substr(0, eq)),
trigs(trigent.substr(eq+1));
GroupInfo::triggers_t::iterator it = curgroup->triggers.find(pvf);
if(it==curgroup->triggers.end()) {
std::pair<GroupInfo::triggers_t::iterator, bool> ins(curgroup->triggers.insert(
std::make_pair(pvf, GroupInfo::triggers_set_t())));
it = ins.first;
}
Splitter sep(trigs.c_str(), ',');
std::string target;
while(sep.snip(target)) {
curgroup->hastriggers = true;
it->second.insert(target);
}
}
}
// validate trigger mappings and process into bit map form
void resolveTriggers()
{
@ -238,7 +203,20 @@ struct PDBProcessor
}
if(!fld.trigger.empty()) {
addTriggers(fld.trigger.c_str());
GroupInfo::triggers_t::iterator it = curgroup->triggers.find(fldname);
if(it==curgroup->triggers.end()) {
std::pair<GroupInfo::triggers_t::iterator, bool> ins(curgroup->triggers.insert(
std::make_pair(fldname, GroupInfo::triggers_set_t())));
it = ins.first;
}
Splitter sep(fld.trigger.c_str(), ',');
std::string target;
while(sep.snip(target)) {
curgroup->hastriggers = true;
it->second.insert(target);
}
}
}