Example #1
0
        public static IEnumOut CreateEnumOutput(this IPluginHost host, OutputAttribute attribute, Type type)
        {
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                var entries  = Enum.GetNames(type);
                var defEntry = !string.IsNullOrEmpty(attribute.DefaultEnumEntry) ? attribute.DefaultEnumEntry : entries[0];
                host.UpdateEnum(type.FullName, defEntry, entries);
            }

            IEnumOut result = null;

            host.CreateEnumOutput(attribute.Name, (TSliceMode)attribute.SliceMode, (TPinVisibility)attribute.Visibility, out result);
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                result.SetSubType(type.FullName);
            }
            else
            {
                result.SetSubType(attribute.EnumName);
            }
            result.Order = attribute.Order;
            return(result);
        }
Example #2
0
        public static IEnumOut CreateEnumOutput(this IPluginHost host, OutputAttribute attribute, Type type)
        {
            //this creates and sets the default for a .NET enum
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                var entries = Enum.GetNames(type);
                host.UpdateEnum(type.FullName, entries[0], entries);
            }

            IEnumOut result = null;

            host.CreateEnumOutput(attribute.Name, (TSliceMode)attribute.SliceMode, (TPinVisibility)attribute.Visibility, out result);
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                result.SetSubType(type.FullName);
            }
            else
            {
                result.SetSubType(attribute.EnumName);
            }

            SetOutputProperties(result, attribute);
            return(result);
        }
        public static INodeOut CreateNodeOutput(this IPluginHost host, OutputAttribute attribute, Type type)
        {
            INodeOut result = null;

            host.CreateNodeOutput(attribute.Name, (TSliceMode)attribute.SliceMode, (TPinVisibility)attribute.Visibility, out result);

            if (type != null)
            {
                // Register all implemented interfaces and inherited classes of T
                // to support the assignment of ISpread<Apple> output to ISpread<Fruit> input.
                var guids = new List <Guid>();

                RegisterID(host, guids, type);

                foreach (var interf in type.GetInterfaces())
                {
                    RegisterID(host, guids, interf);
                }

                var t = type.BaseType;
                while (t != null)
                {
                    RegisterID(host, guids, t);
                    t = t.BaseType;
                }

                result.SetSubType2(type, guids.ToArray(), type.GetCSharpName());
            }
            else
            {
                result.SetSubType(new Guid[] { }, "Variant");
            }

            SetOutputProperties(result, attribute);
            return(result);
        }
Example #4
0
 private static void SetOutputProperties(IPluginOut output, OutputAttribute attribute)
 {
     SetIOProperties(output, attribute);
     output.AllowFeedback = attribute.AllowFeedback;
 }
Example #5
0
        public static ISpread <ISpread <T> > CreateBinSizeSpread <T>(this IIOContainer <IOutStream <int> > binSizePin, OutputAttribute attribute, bool subscribe = true)
        {
            var factory = binSizePin.Factory;
            var context = IOBuildContext.Create(typeof(ISpread <ISpread <T> >), attribute, subscribe);

            context.BinSizeIOContainer = binSizePin;
            return(factory.CreateIO(context) as ISpread <ISpread <T> >);
        }
Example #6
0
 public static IIOContainer <IOutStream <int> > CreateBinSizeOutput(this IIOFactory factory, OutputAttribute attribute)
 {
     return(factory.CreateIOContainer <IOutStream <int> >(attribute, false));
 }
Example #7
0
 public static IOBuildContext <OutputAttribute> Create <TAttribute>(Type ioType, Type dataType, OutputAttribute ioAttribute, bool subscribe = true)
 {
     return(Create(ioType, dataType, ioAttribute, subscribe));
 }