Ejemplo n.º 1
0
        /// <summary>
        /// Gets a read channel from a marker interface.
        /// </summary>
        /// <returns>The requested channel.</returns>
        /// <param name="channel">The marker interface, or a real channel instance.</param>
        /// <typeparam name="T">The channel type.</typeparam>
        public static IReadChannelEnd <T> GetChannel <T>(IReadChannel <T> channel)
        {
            var rt = channel as ReadMarker <T>;

            if (rt == null)
            {
                return(channel.AsReadOnly());
            }

            var scope = ChannelScope.Current;

            if (rt.Attribute.TargetScope == ChannelNameScope.Parent)
            {
                scope = scope.ParentScope;
            }
            else if (rt.Attribute.TargetScope == ChannelNameScope.Global)
            {
                scope = ChannelScope.Root;
            }

            return(GetChannel <T>(rt.Attribute, scope).AsReadOnly());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CoCoL.Network.LatencyHidingReader&lt;T&gt;"/> class.
 /// </summary>
 /// <param name="parent">The channel where requests are made.</param>
 /// <param name="buffersize">The size of the buffer.</param>
 public LatencyHidingReader(IReadChannel <T> parent, int buffersize)
     : this(parent.AsReadOnly(), buffersize)
 {
 }