ioc: actually require +putorder to PUT

This commit is contained in:
Michael Davidsaver
2023-09-19 18:31:29 -07:00
parent 9ccd7b50ab
commit c06d4bb69a
8 changed files with 43 additions and 35 deletions
+3 -1
View File
@@ -12,6 +12,7 @@
#include <string>
#include <map>
#include <limits>
#include <dbChannel.h>
@@ -33,6 +34,8 @@ struct MappingInfo {
static
const char *name(type_t t);
int64_t putOrder = std::numeric_limits<int64_t>::min();
uint32_t nsecMask = 0u;
Value cval;
@@ -48,7 +51,6 @@ class FieldConfig {
public:
std::string channel, trigger, structureId;
MappingInfo info;
int64_t putOrder = 0;
};
} // pvxs
+1 -3
View File
@@ -33,9 +33,7 @@ public:
FieldDefinition(const FieldConfig& fieldConfig, const std::string& fieldName);
bool operator<(const FieldDefinition& o) const {
return putOrder < o.putOrder;
}
bool operator<(const FieldDefinition& o) const = delete;
};
} // pvxs
+5 -1
View File
@@ -250,7 +250,11 @@ void GroupConfigProcessor::defineFields(GroupDefinition& groupDefinition, const
void GroupConfigProcessor::defineFieldSortOrder() {
for (auto&& groupDefinitionMapEntry: groupDefinitionMap) {
auto& groupDefinition = groupDefinitionMapEntry.second;
std::sort(groupDefinition.fields.begin(), groupDefinition.fields.end());
std::stable_sort(groupDefinition.fields.begin(), groupDefinition.fields.end(),
[](const FieldDefinition& l, const FieldDefinition& r) -> bool
{
return l.info.putOrder < r.info.putOrder;
});
groupDefinition.fieldMap.clear();
auto groupFieldIndex = 0;
+4 -1
View File
@@ -73,7 +73,10 @@ void GroupProcessorContext::assign(const Value& value) {
groupField.trigger = value.as<std::string>();
} else if (key == "+putorder") {
groupField.putOrder = value.as<int64_t>();
auto po(value.as<int64_t>());
if(po==std::numeric_limits<int64_t>::min())
po += 1;
groupField.info.putOrder = po;
} else if (key == "+const") {
groupField.info.cval = value;
+1 -1
View File
@@ -491,7 +491,7 @@ void putGroupField(const Value& value,
const GroupSecurityCache& groupSecurityCache) {
// find the leaf node that the field refers to in the given value
auto leafNode = field.findIn(value);
bool marked = leafNode.isMarked() && field.value;
bool marked = leafNode.isMarked() && field.value && field.info.putOrder!=std::numeric_limits<int64_t>::min();
// If the field references a valid part of the given value then we can send it to the database
if (marked) {
+1
View File
@@ -41,6 +41,7 @@ record(waveform, "$(N):ArrayData") {
+id:"epics:nt/NTNDArray:1.0",
"value":{+type:"any",
+channel:"VAL",
+putorder:0,
+trigger:"*"},
"":{+type:"meta", +channel:"SEVR"},
"x":{+type:"meta", +channel:"SEVR"}
+1 -1
View File
@@ -7,7 +7,7 @@ record(longout, "$(P):ENUM:INDEX") {
"$(P):ENUM":{
+id:"epics:nt/NTEnum:1.0",
"value":{+type:"structure", +id:"enum_t"},
"value.index":{+type:"plain", +channel:"VAL"},
"value.index":{+type:"plain", +channel:"VAL", +putorder:0},
"":{+type:"meta", +channel:"VAL"}
}
})
+27 -27
View File
@@ -279,15 +279,6 @@ void testImage()
" } timeStamp\n"
" }\n"
" ]\n"
" struct[] dimension = {2}[\n"
" struct {\n"
" int32_t size = 100\n"
" }\n"
" struct {\n"
" int32_t size = 100\n"
" }\n"
" ]\n"
" any value uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, ...]\n"
" struct {\n"
" struct \"alarm_t\" {\n"
" int32_t severity = 0\n"
@@ -300,6 +291,15 @@ void testImage()
" int32_t userTag = 0\n"
" } timeStamp\n"
" } x\n"
" struct[] dimension = {2}[\n"
" struct {\n"
" int32_t size = 100\n"
" }\n"
" struct {\n"
" int32_t size = 100\n"
" }\n"
" ]\n"
" any value uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, ...]\n"
"}\n");
testStrEq(std::string(SB()<<val.format().delta().arrayLimit(5u)),
"record._options.atomic bool = true\n"
@@ -329,18 +329,18 @@ void testImage()
"attribute[1].timeStamp.secondsPastEpoch int64_t = 631152000\n"
"attribute[1].timeStamp.nanoseconds int32_t = 0\n"
"attribute[1].timeStamp.userTag int32_t = 0\n"
"x.alarm.severity int32_t = 0\n"
"x.alarm.status int32_t = 0\n"
"x.alarm.message string = \"\"\n"
"x.timeStamp.secondsPastEpoch int64_t = 643497678\n"
"x.timeStamp.nanoseconds int32_t = 102030\n"
"dimension struct[]\n"
"dimension[0] struct\n"
"dimension[0].size int32_t = 100\n"
"dimension[1] struct\n"
"dimension[1].size int32_t = 100\n"
"value any\n"
"value-> uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, ...]\n"
"x.alarm.severity int32_t = 0\n"
"x.alarm.status int32_t = 0\n"
"x.alarm.message string = \"\"\n"
"x.timeStamp.secondsPastEpoch int64_t = 643497678\n"
"x.timeStamp.nanoseconds int32_t = 102030\n");
"value-> uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, ...]\n");
TestSubscription sub(ctxt.monitor("img:Array2"));
val = sub.waitForUpdate();
@@ -375,18 +375,18 @@ void testImage()
"attribute[1].timeStamp.secondsPastEpoch int64_t = 631152000\n"
"attribute[1].timeStamp.nanoseconds int32_t = 0\n"
"attribute[1].timeStamp.userTag int32_t = 0\n"
"dimension struct[]\n"
"dimension[0] struct\n"
"dimension[0].size int32_t = 100\n"
"dimension[1] struct\n"
"dimension[1].size int32_t = 100\n"
"value any\n"
"value-> uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, ...]\n"
"x.alarm.severity int32_t = 0\n"
"x.alarm.status int32_t = 0\n"
"x.alarm.message string = \"\"\n"
"x.timeStamp.secondsPastEpoch int64_t = 643497678\n"
"x.timeStamp.nanoseconds int32_t = 102030\n");
"x.timeStamp.nanoseconds int32_t = 102030\n"
"dimension struct[]\n"
"dimension[0] struct\n"
"dimension[0].size int32_t = 100\n"
"dimension[1] struct\n"
"dimension[1].size int32_t = 100\n");
testTimeSec++;
testdbPutFieldOk("img:ArrayData_.PROC", DBR_LONG, 0);
@@ -421,18 +421,18 @@ void testImage()
"attribute[1].timeStamp.secondsPastEpoch int64_t = 631152000\n"
"attribute[1].timeStamp.nanoseconds int32_t = 0\n"
"attribute[1].timeStamp.userTag int32_t = 0\n"
"dimension struct[]\n"
"dimension[0] struct\n"
"dimension[0].size int32_t = 100\n"
"dimension[1] struct\n"
"dimension[1].size int32_t = 100\n"
"value any\n"
"value-> uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, ...]\n"
"x.alarm.severity int32_t = 0\n"
"x.alarm.status int32_t = 0\n"
"x.alarm.message string = \"\"\n"
"x.timeStamp.secondsPastEpoch int64_t = 643497681\n"
"x.timeStamp.nanoseconds int32_t = 102030\n");
"x.timeStamp.nanoseconds int32_t = 102030\n"
"dimension struct[]\n"
"dimension[0] struct\n"
"dimension[0].size int32_t = 100\n"
"dimension[1] struct\n"
"dimension[1].size int32_t = 100\n");
sub.testEmpty();