private ApplyRange ( object &value ) : Opc.Ua.StatusCode | ||
value | object | |
리턴 | Opc.Ua.StatusCode |
/// <summary> /// Returns the value of the attribute for the specified child. /// </summary> /// <param name="context">The context to use when evaluating the operand.</param> /// <param name="typeDefinitionId">The type of the instance.</param> /// <param name="relativePath">The path from the instance to the node which defines the attribute.</param> /// <param name="attributeId">The attribute to return.</param> /// <param name="indexRange">The sub-set of an array value to return.</param> /// <returns> /// The attribute value. Returns null if the attribute does not exist. /// </returns> public object GetAttributeValue( FilterContext context, NodeId typeDefinitionId, IList <QualifiedName> relativePath, uint attributeId, NumericRange indexRange) { if (!NodeId.IsNull(typeDefinitionId)) { if (!context.TypeTree.IsTypeOf(m_typeDefinitionId, typeDefinitionId)) { return(null); } } object value = GetAttributeValue( m_snapshot, relativePath, 0, attributeId); if (indexRange != NumericRange.Empty) { StatusCode error = indexRange.ApplyRange(ref value); if (StatusCode.IsBad(error)) { value = null; } } return(value); }
/// <summary cref="IFilterTarget.GetAttributeValue" /> public virtual object GetAttributeValue( FilterContext context, NodeId typeDefinitionId, IList <QualifiedName> relativePath, uint attributeId, NumericRange indexRange) { // check the type definition. if (!NodeId.IsNull(typeDefinitionId) && typeDefinitionId != ObjectTypes.BaseEventType) { if (!context.TypeTree.IsTypeOf(TypeDefinitionId, typeDefinitionId)) { return(null); } } // read the child attribute. DataValue dataValue = new DataValue(); ServiceResult result = ReadChildAttribute( null, relativePath, 0, attributeId, dataValue); if (ServiceResult.IsBad(result)) { return(null); } // apply any index range. object value = dataValue.Value; if (value != null) { result = indexRange.ApplyRange(ref value); if (ServiceResult.IsBad(result)) { return(null); } } // return the result. return(value); }
/// <summary cref="IFilterTarget.GetAttributeValue" /> public virtual object GetAttributeValue( FilterContext context, NodeId typeDefinitionId, IList<QualifiedName> relativePath, uint attributeId, NumericRange indexRange) { // check the type definition. if (!NodeId.IsNull(typeDefinitionId) && typeDefinitionId != ObjectTypes.BaseEventType) { if (!context.TypeTree.IsTypeOf(TypeDefinitionId, typeDefinitionId)) { return null; } } // read the child attribute. DataValue dataValue = new DataValue(); ServiceResult result = ReadChildAttribute( null, relativePath, 0, attributeId, dataValue); if (ServiceResult.IsBad(result)) { return null; } // apply any index range. object value = dataValue.Value; if (value != null) { result = indexRange.ApplyRange(ref value); if (ServiceResult.IsBad(result)) { return null; } } // return the result. return value; }
/// <summary> /// Adds a DataValue to a list of values to return. /// </summary> private void AddValue( TimestampsToReturn timestampsToReturn, NumericRange indexRange, QualifiedName dataEncoding, DataValueCollection values, DataValue value) { // ignore invalid case. if (value == null) { return; } // save the last timestamp returned. m_lastTime = value.ServerTimestamp; // check if the index range or data encoding can be applied. if (StatusCode.IsGood(value.StatusCode)) { object valueToReturn = value.Value; // apply the index range. if (indexRange != NumericRange.Empty) { StatusCode error = indexRange.ApplyRange(ref valueToReturn); if (StatusCode.IsBad(error)) { value.Value = null; value.StatusCode = error; } else { value.Value = valueToReturn; } } // apply the data encoding. if (!QualifiedName.IsNull(dataEncoding)) { value.Value = null; value.StatusCode = StatusCodes.BadDataEncodingUnsupported; } } // apply the timestamps filter. if (timestampsToReturn == TimestampsToReturn.Neither || timestampsToReturn == TimestampsToReturn.Server) { value.SourceTimestamp = DateTime.MinValue; } if (timestampsToReturn == TimestampsToReturn.Neither || timestampsToReturn == TimestampsToReturn.Source) { value.ServerTimestamp = DateTime.MinValue; } // add result. values.Add(value); }
/// <summary> /// Returns the value of the attribute for the specified child. /// </summary> /// <param name="context">The context to use when evaluating the operand.</param> /// <param name="typeDefinitionId">The type of the instance.</param> /// <param name="relativePath">The path from the instance to the node which defines the attribute.</param> /// <param name="attributeId">The attribute to return.</param> /// <param name="indexRange">The sub-set of an array value to return.</param> /// <returns> /// The attribute value. Returns null if the attribute does not exist. /// </returns> public object GetAttributeValue( FilterContext context, NodeId typeDefinitionId, IList<QualifiedName> relativePath, uint attributeId, NumericRange indexRange) { if (!NodeId.IsNull(typeDefinitionId)) { if (!context.TypeTree.IsTypeOf(m_typeDefinitionId, typeDefinitionId)) { return null; } } object value = GetAttributeValue( m_snapshot, relativePath, 0, attributeId); if (indexRange != NumericRange.Empty) { StatusCode error = indexRange.ApplyRange(ref value); if (StatusCode.IsBad(error)) { value = null; } } return value; }