private void DoCount(WI_Count req) { var promise = req.Promise; try { Channel?ch = GetChannelOrNull(req.Variable); if (ch == null) { promise.SetResult(0); } else { Timestamp start = req.StartInclusive; Timestamp end = req.EndInclusive; QualityFilter filter = req.Filter; long res; if (start == Timestamp.Empty && end == Timestamp.Max && filter == QualityFilter.ExcludeNone) { res = ch.CountAll(); } else { res = ch.CountData(start, end, Map(filter)); } promise.SetResult(res); } } catch (Exception exp) { promise.SetException(exp); } }
private void DoCount(WI_Count req) { var promise = req.Promise; try { Channel ch = GetChannelOrNull(req.Variable); if (ch == null) { promise.SetResult(0); } else { Timestamp start = req.StartInclusive; Timestamp end = req.EndInclusive; long res; if (start == Timestamp.Empty && end == Timestamp.Max) { res = ch.CountAll(); } else { res = ch.CountData(start, end); } promise.SetResult(res); } } catch (Exception exp) { promise.SetException(exp); } }