예제 #1
0
 /// <summary>
 /// Constructs a descriptor instance.
 /// </summary>
 /// <param name="dir">data-flow direction of the port</param>
 /// <param name="usage">usage hint</param>
 /// <param name="domain">optional argument for future use</param>
 /// <param name="elementType">type descriptor of exchanged data</param>
 public PortBuilder(EFlowDirection dir, EPortUsage usage, string domain, TypeDescriptor elementType)
 {
     _dir         = dir;
     _usage       = usage;
     _domain      = domain;
     _elementType = elementType;
 }
예제 #2
0
 internal SignalArgumentDescriptor(TypeDescriptor argumentType, EFlowDirection direction,
                                   TypeDescriptor elementType, EFlowDirection access) :
     base(argumentType, direction)
 {
     _elementType = elementType;
     _access      = access;
 }
예제 #3
0
        public ISignalOrPortDescriptor GetSignal(EBinderFlags flags, EPortUsage portUsage, string name, string domainID, object initialValue)
        {
            if (portUsage == EPortUsage.Clock)
            {
                return(FindClock(domainID).Descriptor);
            }
            else if (portUsage == EPortUsage.State)
            {
                throw new NotSupportedException("State signal is not supported by default auto-binder");
            }
            else
            {
                if (flags.HasFlag(EBinderFlags.ExistingSignal))
                {
                    var result = _host.Descriptor.FindSignal(name);
                    if (result != null)
                    {
                        return(null);
                    }
                }

                if (flags.HasFlag(EBinderFlags.CreateNewPort))
                {
                    EFlowDirection dir = EFlowDirection.In;
                    if (flags.HasFlag(EBinderFlags.In))
                    {
                        dir = EFlowDirection.In;
                    }
                    if (flags.HasFlag(EBinderFlags.Out))
                    {
                        dir = EFlowDirection.Out;
                    }
                    if (flags.HasFlag(EBinderFlags.InOut))
                    {
                        dir = EFlowDirection.InOut;
                    }
                    int id   = _id++;
                    var port = _host.Descriptor.CreatePort("agp" + id + "_" + name, dir,
                                                           TypeDescriptor.GetTypeOf(initialValue));
                    return(port);
                }

                if (flags.HasFlag(EBinderFlags.CreateNewSignal))
                {
                    int id     = _id++;
                    var signal = _host.Descriptor.CreateSignalInstance("ags" + id + "_" + name,
                                                                       TypeDescriptor.GetTypeOf(initialValue));
                    return(signal);
                }

                return(null);
            }
        }
예제 #4
0
 /// <summary>
 /// Creates and adds a new port.
 /// </summary>
 /// <param name="me">component descriptor to host the new port</param>
 /// <param name="name">name of new port</param>
 /// <param name="dir">data-flow direction</param>
 /// <param name="dataType">type descriptor of exchanged data</param>
 /// <returns>the descriptor of the newly created port</returns>
 public static PortBuilder CreatePort(this IComponentDescriptor me, string name, EFlowDirection dir, TypeDescriptor dataType)
 {
     return(CreatePort(me, name, dir, EPortUsage.Default, dataType));
 }
예제 #5
0
        /// <summary>
        /// Creates and adds a new port.
        /// </summary>
        /// <param name="me">component descriptor to host the new port</param>
        /// <param name="name">name of new port</param>
        /// <param name="dir">data-flow direction</param>
        /// <param name="usage">usage hint</param>
        /// <param name="dataType">type descriptor of exchanged data</param>
        /// <returns>the descriptor of the newly created port</returns>
        public static PortBuilder CreatePort(this IComponentDescriptor me, string name, EFlowDirection dir, EPortUsage usage, TypeDescriptor dataType)
        {
            Contract.Requires <ArgumentNullException>(me != null);
            Contract.Requires <ArgumentNullException>(name != null);
            Contract.Requires <ArgumentNullException>(dataType != null);

            PortBuilder result = new PortBuilder(dir, usage, null, dataType);

            me.AddChild(result, name);
            return(result);
        }
예제 #6
0
 internal ArgumentDescriptor(TypeDescriptor argumentType, EFlowDirection direction)
 {
     _argumentType = argumentType;
     _direction    = direction;
 }
예제 #7
0
        public ISignalArgumentDescriptor AddNewSignalArgument(string name, int index, TypeDescriptor elementType, EFlowDirection access)
        {
            var arg = new SignalArgumentDescriptor(typeof(SignalBase), EFlowDirection.In, elementType, access);

            arg.Nest(this, new IndexSpec(index));
            return(arg);
        }
예제 #8
0
        public IArgumentDescriptor AddNewArgument(string name, int index, TypeDescriptor argumentType, EFlowDirection direction)
        {
            var arg = new ArgumentDescriptor(argumentType, direction);

            arg.Nest(this, new IndexSpec(index));
            return(arg);
        }
예제 #9
0
 public ScrollBox(Element owner, EFlowDirection block_Flow_Direction, EFlowDirection inline_Base_Direction) : this(block_Flow_Direction, inline_Base_Direction)
 {
     Owner = owner;
 }
예제 #10
0
 public ScrollBox(IViewport owner, EFlowDirection block_Flow_Direction, EFlowDirection inline_Base_Direction) : this(block_Flow_Direction, inline_Base_Direction)
 {
     View = owner;
 }
예제 #11
0
 private ScrollBox(EFlowDirection block_Flow_Direction, EFlowDirection inline_Base_Direction)
 {
     Block  = block_Flow_Direction;
     Inline = inline_Base_Direction;
 }
예제 #12
0
 /// <summary>
 /// Creates and adds a new port.
 /// </summary>
 /// <param name="me">component descriptor to host the new port</param>
 /// <param name="name">name of new port</param>
 /// <param name="dir">data-flow direction</param>
 /// <param name="dataType">type descriptor of exchanged data</param>
 /// <returns>the descriptor of the newly created port</returns>
 public static PortBuilder CreatePort(this IComponentDescriptor me, string name, EFlowDirection dir, TypeDescriptor dataType)
 {
     return CreatePort(me, name, dir, EPortUsage.Default, dataType);
 }
예제 #13
0
        /// <summary>
        /// Creates and adds a new port.
        /// </summary>
        /// <param name="me">component descriptor to host the new port</param>
        /// <param name="name">name of new port</param>
        /// <param name="dir">data-flow direction</param>
        /// <param name="usage">usage hint</param>
        /// <param name="dataType">type descriptor of exchanged data</param>
        /// <returns>the descriptor of the newly created port</returns>
        public static PortBuilder CreatePort(this IComponentDescriptor me, string name, EFlowDirection dir, EPortUsage usage, TypeDescriptor dataType)
        {
            Contract.Requires<ArgumentNullException>(me != null);
            Contract.Requires<ArgumentNullException>(name != null);
            Contract.Requires<ArgumentNullException>(dataType != null);

            PortBuilder result = new PortBuilder(dir, usage, null, dataType);
            me.AddChild(result, name);
            return result;
        }
예제 #14
0
 /// <summary>
 /// Constructs a descriptor instance.
 /// </summary>
 /// <param name="dir">data-flow direction of the port</param>
 /// <param name="usage">usage hint</param>
 /// <param name="domain">optional argument for future use</param>
 /// <param name="elementType">type descriptor of exchanged data</param>
 public PortBuilder(EFlowDirection dir, EPortUsage usage, string domain, TypeDescriptor elementType)
 {
     _dir = dir;
     _usage = usage;
     _domain = domain;
     _elementType = elementType;
 }
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="direction">data direction</param>
 public MapToPort(EFlowDirection direction)
 {
     Direction = direction;
 }
예제 #16
0
 private string PortDirectionToString(EFlowDirection dir)
 {
     switch (dir)
     {
         case EFlowDirection.In: return "in";
         case EFlowDirection.Out: return "out";
         case EFlowDirection.InOut: return "inout";
         default: throw new NotImplementedException();
     }
 }