public void AddEndpoint(EndpointDispatcher endpoint)
 {
     lock (this.ThisLock)
     {
         MessageFilter endpointFilter = endpoint.EndpointFilter;
         int           filterPriority = endpoint.FilterPriority;
         if (this.filters == null)
         {
             if (this.cachedEndpoints == null)
             {
                 this.cachedEndpoints = new List <EndpointDispatcher>(2);
             }
             if (this.cachedEndpoints.Count < 2)
             {
                 this.cachedEndpoints.Add(endpoint);
             }
             else
             {
                 this.filters = new MessageFilterTable <EndpointDispatcher>();
                 for (int i = 0; i < this.cachedEndpoints.Count; i++)
                 {
                     int           priority = this.cachedEndpoints[i].FilterPriority;
                     MessageFilter filter   = this.cachedEndpoints[i].EndpointFilter;
                     this.filters.Add(filter, this.cachedEndpoints[i], priority);
                 }
                 this.filters.Add(endpointFilter, endpoint, filterPriority);
                 this.cachedEndpoints = null;
             }
         }
         else
         {
             this.filters.Add(endpointFilter, endpoint, filterPriority);
         }
     }
 }
 public bool Equals(MessageFilterTable <TFilterData> .FilterTableEntry x, MessageFilterTable <TFilterData> .FilterTableEntry y)
 {
     if (y.priority.CompareTo(x.priority) != 0)
     {
         return(false);
     }
     return(x.table.GetType().FullName.Equals(y.table.GetType().FullName));
 }
            public int Compare(MessageFilterTable <TFilterData> .FilterTableEntry x, MessageFilterTable <TFilterData> .FilterTableEntry y)
            {
                int num = y.priority.CompareTo(x.priority);

                if (num != 0)
                {
                    return(num);
                }
                return(x.table.GetType().FullName.CompareTo(y.table.GetType().FullName));
            }
Ejemplo n.º 4
0
        public void AddEndpoint(EndpointDispatcher endpoint)
        {
            lock (ThisLock)
            {
                MessageFilter filter   = endpoint.EndpointFilter;
                int           priority = endpoint.FilterPriority;

                if (filters == null)
                {
                    if (this.cachedEndpoints == null)
                    {
                        this.cachedEndpoints = new List <EndpointDispatcher>(optimizationThreshold);
                    }

                    if (this.cachedEndpoints.Count < optimizationThreshold)
                    {
                        this.cachedEndpoints.Add(endpoint);
                    }
                    else
                    {
                        filters = new MessageFilterTable <EndpointDispatcher>();
                        for (int i = 0; i < this.cachedEndpoints.Count; i++)
                        {
                            int           cachedPriority = cachedEndpoints[i].FilterPriority;
                            MessageFilter cachedFilter   = cachedEndpoints[i].EndpointFilter;
                            filters.Add(cachedFilter, cachedEndpoints[i], cachedPriority);
                        }
                        filters.Add(filter, endpoint, priority);
                        this.cachedEndpoints = null;
                    }
                }
                else
                {
                    filters.Add(filter, endpoint, priority);
                }
            }
        }
 public int GetHashCode(MessageFilterTable <TFilterData> .FilterTableEntry table)
 {
     return(table.GetHashCode());
 }
 internal ThreadSafeMessageFilterTable()
 {
     this.table    = new MessageFilterTable <FilterData>();
     this.syncRoot = new object();
 }
Ejemplo n.º 7
0
 public StrictAndMessageFilterTable()
 {
     this.andFilters  = new Dictionary <MessageFilter, TFilterData>();
     this.filterTable = new MessageFilterTable <StrictAndMessageFilter>();
 }
Ejemplo n.º 8
0
 public AndMessageFilterTable()
 {
     this.filters    = new Dictionary <MessageFilter, FilterData>();
     this.filterData = new Dictionary <MessageFilter, FilterDataPair <FilterData> >();
     this.table      = new MessageFilterTable <FilterDataPair <FilterData> >();
 }