(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / corlib / System.Runtime.Remoting.Messaging / LogicalCallContext.cs
blobf7570e24a82d1e8948b9af2573e3d8dcd802d1ca
1 //
2 // System.Runtime.Remoting.Messaging.LogicalCallContext.cs
3 //
4 // Author:
5 // Dan Lewis (dihlewis@yahoo.co.uk)
6 // Lluis Sanchez Gual (lluis@ximian.com)
7 //
8 // 2002 (C) Copyright. Ximian, Inc.
9 //
12 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
21 //
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
24 //
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 using System.Collections;
35 using System.Runtime.Serialization;
37 namespace System.Runtime.Remoting.Messaging
39 [Serializable]
40 public sealed class LogicalCallContext : ISerializable, ICloneable
42 Hashtable _data;
43 CallContextRemotingData _remotingData = new CallContextRemotingData();
45 internal LogicalCallContext ()
49 internal LogicalCallContext (SerializationInfo info, StreamingContext context)
51 foreach (SerializationEntry entry in info)
53 if (entry.Name == "__RemotingData")
54 _remotingData = (CallContextRemotingData) entry.Value;
55 else
56 SetData (entry.Name, entry.Value);
60 public bool HasInfo
62 get
64 return (_data != null && _data.Count > 0);
68 public void FreeNamedDataSlot (string name)
70 if (_data != null)
71 _data.Remove (name);
74 public object GetData (string name)
76 if (_data != null) return _data [name];
77 else return null;
80 public void GetObjectData (SerializationInfo info, StreamingContext context)
82 info.AddValue ("__RemotingData", _remotingData);
83 if (_data != null)
85 foreach (DictionaryEntry de in _data)
86 info.AddValue ((string)de.Key, de.Value);
90 public void SetData (string name, object data)
92 if (_data == null) _data = new Hashtable ();
93 _data [name] = data;
96 public object Clone ()
98 LogicalCallContext nc = new LogicalCallContext ();
99 nc._remotingData = (CallContextRemotingData) _remotingData.Clone ();
100 if (_data != null)
102 nc._data = new Hashtable ();
103 foreach (DictionaryEntry de in _data)
104 nc._data [de.Key] = de.Value;
106 return nc;
109 internal Hashtable Datastore
111 get { return _data; }
115 [Serializable]
116 internal class CallContextRemotingData : ICloneable
118 string _logicalCallID;
120 public string LogicalCallID
122 get { return _logicalCallID; }
123 set { _logicalCallID = value; }
126 public object Clone ()
128 CallContextRemotingData data = new CallContextRemotingData ();
129 data._logicalCallID = _logicalCallID;
130 return data;