// copy constructor public Range(HermesMiddleware.DataAcquisitionServiceServer.Range sourceRange) { this.min = sourceRange.min; this.max = sourceRange.max; this.bStrict = sourceRange.strict; this.sVariable = sourceRange.variable; }
HermesMiddleware.DataAcquisitionServiceProxy.Expression ConvertServer2Proxy(HermesMiddleware.DataAcquisitionServiceServer.Expression sourceExpression) { HermesMiddleware.DataAcquisitionServiceProxy.Expression targetExpression = null; HermesMiddleware.DataAcquisitionServiceProxy.Range targetRange = null; HermesMiddleware.DataAcquisitionServiceProxy.Threshold targetThreshold = null; HermesMiddleware.DataAcquisitionServiceProxy.Equals targetEquals = null; HermesMiddleware.DataAcquisitionServiceServer.Range sourceRange = null; HermesMiddleware.DataAcquisitionServiceServer.Threshold sourceThreshold = null; HermesMiddleware.DataAcquisitionServiceServer.Equals sourceEquals = null; switch (sourceExpression.GetType().Name) { case "Range": sourceRange = (HermesMiddleware.DataAcquisitionServiceServer.Range)sourceExpression; targetRange = new HermesMiddleware.DataAcquisitionServiceProxy.Range(); targetRange.max = sourceRange.max; targetRange.min = sourceRange.min; targetRange.strict = sourceRange.strict; targetRange.variable = sourceRange.variable; targetExpression = targetRange; break; case "Threshold": sourceThreshold = (HermesMiddleware.DataAcquisitionServiceServer.Threshold)sourceExpression; targetThreshold = new HermesMiddleware.DataAcquisitionServiceProxy.Threshold(); targetThreshold.value = sourceThreshold.value; targetThreshold.type = (HermesMiddleware.DataAcquisitionServiceProxy.ThresholdType)sourceThreshold.type; targetThreshold.strict = sourceThreshold.strict; targetThreshold.variable = sourceThreshold.variable; targetExpression = targetThreshold; break; case "Equals": sourceEquals = (HermesMiddleware.DataAcquisitionServiceServer.Equals)sourceExpression; targetEquals = new HermesMiddleware.DataAcquisitionServiceProxy.Equals(); targetEquals.value = sourceEquals.value; targetEquals.type = (HermesMiddleware.DataAcquisitionServiceProxy.EqualsType)sourceEquals.type; targetEquals.variable = sourceEquals.variable; targetExpression = targetEquals; break; } return(targetExpression); }
// initialize public void Initialize(HermesMiddleware.DataAcquisitionServiceServer.Subscription subscription) { // copy simple data sVariable = subscription.variable; sName = subscription.name; sGUID = subscription.GUID; foreach (HermesMiddleware.DataAcquisitionServiceServer.Expression expression in subscription.Items) { // we use just range everywhere HermesMiddleware.DataAcquisitionServiceServer.Range rangeSource = (HermesMiddleware.DataAcquisitionServiceServer.Range)expression; // create new range Range rangeTarget = new Range(rangeSource); // add it to the elements conditions.Add(rangeTarget); } }