Opc.Ua.ViewTable.Add C# (CSharp) Method

Add() public method

Adds a view to the table.
public Add ( ViewNode view ) : void
view ViewNode The view.
return void
        public void Add(ViewNode view)
        {
            if (view == null) throw new ArgumentNullException("view");

            if (NodeId.IsNull(view.NodeId))
            {
                throw new ServiceResultException(
                    StatusCodes.BadNodeIdInvalid,
                    Utils.Format("A view may not have a null node id."));
            }

            lock (m_lock)
            {
                // check for duplicate id.
                if (m_views.ContainsKey(view.NodeId))
                {
                    throw new ServiceResultException(
                        StatusCodes.BadNodeIdExists,
                        Utils.Format("A view with the node id '{0}' already exists.", view.NodeId));
                }

                // save view.
                m_views.Add(view.NodeId, view);
            }
        }