/// <summary>
        /// Creates a deep copy of the collection.
        /// </summary>
        /// <remarks>
        /// Creates a deep copy of the collection.
        /// </remarks>
        public new object MemberwiseClone()
        {
            ExtensionObjectCollection clone = new ExtensionObjectCollection(this.Count);

            foreach (ExtensionObject element in this)
            {
                clone.Add((ExtensionObject)Utils.Clone(element));
            }

            return(clone);
        }
예제 #2
0
        /// <summary>
        /// Creates a deep copy of the collection.
        /// </summary>
        /// <remarks>
        /// Creates a deep copy of the collection.
        /// </remarks>
        public new object MemberwiseClone()
        {
            ExpandedNodeIdCollection clone = new ExpandedNodeIdCollection(this.Count);

            foreach (ExpandedNodeId element in this)
            {
                clone.Add((ExpandedNodeId)Utils.Clone(element));
            }

            return(clone);
        }
예제 #3
0
        /// <summary>
        /// Creates a deep copy of the value.
        /// </summary>
        /// <remarks>
        /// Creates a new instance of the class while copying the contents
        /// of another instance.
        /// </remarks>
        /// <param name="value">The DataValue to copy.</param>
        /// <exception cref="ArgumentNullException">Thrown when the value is null</exception>
        public DataValue(DataValue value)
        {            
            if (value == null) throw new ArgumentNullException("value");

            m_value.Value     = Utils.Clone(value.m_value.Value);
            m_statusCode      = value.m_statusCode;
            m_sourceTimestamp = value.m_sourceTimestamp;
            m_sourcePicoseconds = value.m_sourcePicoseconds;
            m_serverTimestamp = value.m_serverTimestamp;
            m_serverPicoseconds = value.m_serverPicoseconds;
        }
예제 #4
0
        /// <summary>
        /// Creates a deep copy of the collection.
        /// </summary>
        /// <remarks>
        /// Creates a deep copy of the collection.
        /// </remarks>
        public object Clone()
        {
            DataValueCollection clone = new DataValueCollection(this.Count);

            foreach (DataValue element in this)
            {
                clone.Add((DataValue)Utils.Clone(element));
            }

            return clone;
        }
예제 #5
0
        /// <summary>
        /// Creates a deep copy of the collection.
        /// </summary>
        /// <remarks>
        /// Creates a deep copy of the collection.
        /// </remarks>
        public new object MemberwiseClone()
        {
            DiagnosticInfoCollection clone = new DiagnosticInfoCollection(this.Count);

            foreach (DiagnosticInfo element in this)
            {
                clone.Add((DiagnosticInfo)Utils.Clone(element));
            }

            return(clone);
        }
예제 #6
0
        /// <summary>
        /// Reads the value for the value attribute.
        /// </summary>
        protected override ServiceResult ReadValueAttribute(
            ISystemContext context,
            NumericRange indexRange,
            QualifiedName dataEncoding,
            ref object value,
            ref DateTime sourceTimestamp)
        {
            value = m_value;

            ServiceResult result = ServiceResult.Good;

            VariableCopyPolicy copyPolicy = VariableCopyPolicy.CopyOnRead;

            // use default behavoir.
            if (OnSimpleReadValue != null)
            {
                result = OnSimpleReadValue(
                    context,
                    this,
                    ref value);

                if (ServiceResult.IsBad(result))
                {
                    return(result);
                }

                copyPolicy = VariableCopyPolicy.Never;
            }
            else
            {
                // check if a valid value exists.
                if (value == null)
                {
                    return(StatusCodes.BadAttributeIdInvalid);
                }
            }

            // apply the index range and encoding.
            result = BaseVariableState.ApplyIndexRangeAndDataEncoding(context, indexRange, dataEncoding, ref value);

            if (ServiceResult.IsBad(result))
            {
                return(result);
            }

            // copy returned value.
            if (copyPolicy == VariableCopyPolicy.CopyOnRead)
            {
                value = Utils.Clone(value);
            }

            return(result);
        }
예제 #7
0
        /// <summary cref="ICloneable.Clone" />
        public virtual object Clone()
        {
            SupportedProfile clone = (SupportedProfile)this.MemberwiseClone();

            clone.m_organizationUri    = (string)Utils.Clone(this.m_organizationUri);
            clone.m_profileId          = (string)Utils.Clone(this.m_profileId);
            clone.m_complianceTool     = (string)Utils.Clone(this.m_complianceTool);
            clone.m_complianceDate     = (DateTime)Utils.Clone(this.m_complianceDate);
            clone.m_complianceLevel    = (ComplianceLevel)Utils.Clone(this.m_complianceLevel);
            clone.m_unsupportedUnitIds = (StringCollection)Utils.Clone(this.m_unsupportedUnitIds);

            return(clone);
        }
예제 #8
0
        /// <summary cref="ICloneable.Clone" />
        public virtual object Clone()
        {
            SoftwareCertificate clone = (SoftwareCertificate)this.MemberwiseClone();

            clone.m_productName = (string)Utils.Clone(this.m_productName);
            clone.m_productUri  = (string)Utils.Clone(this.m_productUri);
            clone.m_vendorName  = (string)Utils.Clone(this.m_vendorName);
            clone.m_vendorProductCertificate = (byte[])Utils.Clone(this.m_vendorProductCertificate);
            clone.m_softwareVersion          = (string)Utils.Clone(this.m_softwareVersion);
            clone.m_buildNumber       = (string)Utils.Clone(this.m_buildNumber);
            clone.m_buildDate         = (DateTime)Utils.Clone(this.m_buildDate);
            clone.m_issuedBy          = (string)Utils.Clone(this.m_issuedBy);
            clone.m_issueDate         = (DateTime)Utils.Clone(this.m_issueDate);
            clone.m_supportedProfiles = (SupportedProfileCollection)Utils.Clone(this.m_supportedProfiles);

            return(clone);
        }
예제 #9
0
        /// <summary>
        /// Exports a copy of the node to a node table.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="node">The node.</param>
        protected override void Export(ISystemContext context, Node node)
        {
            base.Export(context, node);

            VariableTypeNode variableTypeNode = node as VariableTypeNode;

            if (variableTypeNode != null)
            {
                variableTypeNode.Value           = new Variant(Utils.Clone(this.Value));
                variableTypeNode.DataType        = this.DataType;
                variableTypeNode.ValueRank       = this.ValueRank;
                variableTypeNode.ArrayDimensions = null;

                if (this.ArrayDimensions != null)
                {
                    variableTypeNode.ArrayDimensions = new UInt32Collection(this.ArrayDimensions);
                }
            }
        }
예제 #10
0
        /// <summary>
        /// Initializes the instance from another instance.
        /// </summary>
        protected override void Initialize(ISystemContext context, NodeState source)
        {
            BaseVariableTypeState type = source as BaseVariableTypeState;

            if (type != null)
            {
                m_value           = Utils.Clone(type.m_value);
                m_dataType        = type.m_dataType;
                m_valueRank       = type.m_valueRank;
                m_arrayDimensions = null;

                if (type.m_arrayDimensions != null)
                {
                    m_arrayDimensions = new ReadOnlyList <uint>(type.m_arrayDimensions, true);
                }
            }

            m_value = ExtractValueFromVariant(context, m_value, false);

            base.Initialize(context, source);
        }
예제 #11
0
        /// <summary>
        /// Creates a deep copy of the value.
        /// </summary>
        /// <param name="value">The value to be copied.</param>
        /// <remarks>
        /// Creates a deep copy of the value.
        /// </remarks>
        /// <exception cref="ArgumentNullException">Thrown when the value is null</exception>
        public ExtensionObject(ExtensionObject value) {
            if (value == null) throw new ArgumentNullException("value");

            TypeId = value.TypeId;
            Body = Utils.Clone(value.Body);
        }