2 // EndpointAddressMessageFilterTable.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2006 Novell, Inc. http://www.novell.com
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.Collections;
30 using System.Collections.Generic;
31 using System.Reflection;
32 using System.ServiceModel;
33 using System.ServiceModel.Channels;
35 namespace System.ServiceModel.Dispatcher
37 internal class EndpointAddressMessageFilterTable<TFilterData>
38 : IDictionary<MessageFilter,TFilterData>,
39 IMessageFilterTable<TFilterData>,
41 ICollection<KeyValuePair<MessageFilter,TFilterData>>,
42 IEnumerable<KeyValuePair<MessageFilter,TFilterData>>
44 Dictionary<MessageFilter,TFilterData> dict
45 = new Dictionary<MessageFilter,TFilterData> ();
47 public EndpointAddressMessageFilterTable ()
51 public TFilterData this [MessageFilter key] {
52 get { return dict [key]; }
53 set { dict [key] = value; }
57 get { return dict.Count; }
60 public bool IsReadOnly {
64 public ICollection<MessageFilter> Keys {
65 get { return dict.Keys; }
68 public ICollection<TFilterData> Values {
69 get { return dict.Values; }
72 public void Add (KeyValuePair<MessageFilter,TFilterData> item)
74 dict.Add (item.Key, item.Value);
78 public void Add (EndpointAddressMessageFilter filter, TFilterData data)
80 throw new NotImplementedException ();
83 public void Add (MessageFilter filter, TFilterData data)
85 dict.Add (filter, data);
93 public bool Contains (KeyValuePair<MessageFilter,TFilterData> item)
95 return dict.ContainsKey (item.Key) &&
96 dict [item.Key].Equals (item.Value);
99 public bool ContainsKey (MessageFilter key)
101 return dict.ContainsKey (key);
104 public void CopyTo (KeyValuePair<MessageFilter,TFilterData> [] array, int index)
106 if (index < 0 || dict.Count >= array.Length - index)
107 throw new ArgumentOutOfRangeException ("index");
108 foreach (KeyValuePair<MessageFilter,TFilterData> item in dict)
109 array [index++] = item;
112 public IEnumerator<KeyValuePair<MessageFilter,TFilterData>> GetEnumerator ()
114 return dict.GetEnumerator ();
117 IEnumerator IEnumerable.GetEnumerator ()
119 return GetEnumerator ();
122 public bool GetMatchingFilter (Message message, out MessageFilter result)
124 throw new NotImplementedException ();
127 public bool GetMatchingFilter (MessageBuffer buffer, out MessageFilter result)
129 throw new NotImplementedException ();
132 public bool GetMatchingFilters (Message message, ICollection<MessageFilter> results)
134 throw new NotImplementedException ();
137 public bool GetMatchingFilters (MessageBuffer buffer, ICollection<MessageFilter> results)
139 throw new NotImplementedException ();
142 public bool GetMatchingValue (Message message, out TFilterData data)
144 throw new NotImplementedException ();
147 public bool GetMatchingValue (MessageBuffer buffer, out TFilterData data)
149 throw new NotImplementedException ();
152 public bool GetMatchingValues (Message message, ICollection<TFilterData> results)
154 throw new NotImplementedException ();
157 public bool GetMatchingValues (MessageBuffer buffer, ICollection<TFilterData> results)
159 throw new NotImplementedException ();
162 public bool Remove (KeyValuePair<MessageFilter,TFilterData> item)
164 if (dict.ContainsKey (item.Key) && dict [item.Key].Equals (item.Value)) {
165 dict.Remove (item.Key);
171 public bool Remove (EndpointAddressMessageFilter filter)
173 throw new NotImplementedException ();
176 public bool Remove (MessageFilter filter)
178 return dict.Remove (filter);
181 public bool TryGetValue (MessageFilter filter, out TFilterData filterData)
183 if (dict.ContainsKey (filter)) {
184 filterData = dict [filter];
187 filterData = default (TFilterData);