git-svn-id: svn://db.shs.com.ru/libs@385 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2018-05-23 13:24:41 +00:00
parent d239704cfa
commit b1167a86e7
10 changed files with 255 additions and 28 deletions

View File

@@ -126,11 +126,13 @@ void CDType::readX(PIByteArray & ba) {
case X_Current:
ba >> value_d;
break;
case X_All_Avg:
ba >> history;
case X_All_Avg: {
PIVector<double> ah;
ba >> ah;
history << ah;
if (!history.isEmpty())
value_d = history.back();
break;
} break;
default: break;
}
value_i = value_d;
@@ -146,6 +148,7 @@ void CDType::writeX(PIByteArray & ba) {
break;
case X_All_Avg:
ba << history;
history.clear();
break;
default: break;
}

View File

@@ -64,6 +64,8 @@ public:
void readX(PIByteArray & ba);
void writeX(PIByteArray & ba);
PIVector<double> history;
protected:
bool calculate(PIEvaluator * e, PIVector<const CDType * > stack = PIVector<const CDType * >());
PIVariantTypes::Enum parseEnumComment(PIString c);
@@ -77,7 +79,6 @@ protected:
double value_d;
int value_i;
bool value_b, calculated, x_enabled;
PIVector<double> history;
PIVector<double> avg_h;
int avg_size;
XMode mode_;