Ejemplo n.º 1
0
        /// <summary>
        /// Convert node class
        /// </summary>
        /// <param name="nodeClass"></param>
        /// <returns></returns>
        public static NodeClass?ToServiceType(this UaNodeClass nodeClass)
        {
            switch (nodeClass)
            {
            case UaNodeClass.Object:
                return(NodeClass.Object);

            case UaNodeClass.ObjectType:
                return(NodeClass.ObjectType);

            case UaNodeClass.Variable:
                return(NodeClass.Variable);

            case UaNodeClass.VariableType:
                return(NodeClass.VariableType);

            case UaNodeClass.Method:
                return(NodeClass.Method);

            case UaNodeClass.DataType:
                return(NodeClass.DataType);

            case UaNodeClass.ReferenceType:
                return(NodeClass.ReferenceType);

            case UaNodeClass.View:
                return(NodeClass.View);

            default:
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Convert mask to a list of node classes
        /// </summary>
        /// <param name="nodeClasses"></param>
        /// <returns></returns>
        public static List <NodeClass> ToServiceMask(this UaNodeClass nodeClasses)
        {
            if (nodeClasses == UaNodeClass.Unspecified)
            {
                return(null);
            }
            var result = new List <NodeClass>();
            var mask   = (uint)nodeClasses;

            if (0 != (mask & (uint)UaNodeClass.Object))
            {
                result.Add(NodeClass.Object);
            }
            if (0 != (mask & (uint)UaNodeClass.Variable))
            {
                result.Add(NodeClass.Variable);
            }
            if (0 != (mask & (uint)UaNodeClass.Method))
            {
                result.Add(NodeClass.Method);
            }
            if (0 != (mask & (uint)UaNodeClass.ObjectType))
            {
                result.Add(NodeClass.ObjectType);
            }
            if (0 != (mask & (uint)UaNodeClass.VariableType))
            {
                result.Add(NodeClass.VariableType);
            }
            if (0 != (mask & (uint)UaNodeClass.ReferenceType))
            {
                result.Add(NodeClass.ReferenceType);
            }
            if (0 != (mask & (uint)UaNodeClass.DataType))
            {
                result.Add(NodeClass.DataType);
            }
            if (0 != (mask & (uint)UaNodeClass.View))
            {
                result.Add(NodeClass.View);
            }
            return(result);
        }