Exemplo n.º 1
0
        //INodeContainer
        /// <summary>
        /// Creates and adds a new node instance of the <see cref="T:UAOOI.SemanticData.InformationModelFactory.INodeFactory" />.
        /// </summary>
        /// <typeparam name="NodeFactory">The type of the node factory must inherit from <see cref="T:UAOOI.SemanticData.InformationModelFactory.INodeFactory" />.</typeparam>
        /// <returns>Returns new object implementing <see cref="T:UAOOI.SemanticData.InformationModelFactory.INodeFactory" />.</returns>
        /// <exception cref="NotImplementedException"></exception>
        public NodeFactory AddNodeFactory <NodeFactory>() where NodeFactory : INodeFactory
        {
            NodeFactoryBase _df = default(NodeFactoryBase);

            if (typeof(NodeFactory) == typeof(IReferenceTypeFactory))
            {
                _df = new ReferenceTypeFactoryBase(TraceEvent);
            }
            else if (typeof(NodeFactory) == typeof(IObjectTypeFactory))
            {
                _df = new ObjectTypeFactoryBase(TraceEvent);
            }
            else if (typeof(NodeFactory) == typeof(IVariableTypeFactory))
            {
                _df = new VariableTypeFactoryBase(TraceEvent);
            }
            else if (typeof(NodeFactory) == typeof(IDataTypeFactory))
            {
                _df = new DataTypeFactoryBase(TraceEvent);
            }
            else if (typeof(NodeFactory) == typeof(IObjectInstanceFactory))
            {
                _df = new ObjectInstanceFactoryBase(TraceEvent);
            }
            else if (typeof(NodeFactory) == typeof(IPropertyInstanceFactory))
            {
                _df = new PropertyInstanceFactoryBase(TraceEvent);
            }
            else if (typeof(NodeFactory) == typeof(IVariableInstanceFactory))
            {
                _df = new VariableInstanceFactoryBase(TraceEvent);
            }
            else if (typeof(NodeFactory) == typeof(IMethodInstanceFactory))
            {
                _df = new MethodInstanceFactoryBase(TraceEvent);
            }
            else if (typeof(NodeFactory) == typeof(IViewInstanceFactory))
            {
                _df = new ViewInstanceFactoryBase(TraceEvent);
            }
            else
            {
                throw new NotImplementedException();
            }
            m_Nodes.Add(_df);
            return((NodeFactory)(INodeFactory)_df);
        }
Exemplo n.º 2
0
        private IEnumerable <Parameter> RemoveArguments(string parameterKind, Func <XmlElement, Parameter[]> getParameters)
        {
            Parameter[]            _parameters            = null;
            List <NodeFactoryBase> _newChildrenCollection = new List <NodeFactoryBase>();

            foreach (NodeFactoryBase _item in m_Nodes)
            {
                if (_item.SymbolicName.Equals(new XmlQualifiedName(parameterKind, Namespaces.OpcUa)))
                {
                    PropertyInstanceFactoryBase _arg = (PropertyInstanceFactoryBase)_item;
                    _parameters = getParameters(_arg.DefaultValue);
                }
                else
                {
                    _newChildrenCollection.Add(_item);
                }
            }
            m_Nodes = _newChildrenCollection;
            return(_parameters == null || _parameters.Length == 0 ? null : _parameters.AsEnumerable <Parameter>());
        }