aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Grid/Interregion/RemotingObject.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-04-30 21:23:37 +0000
committerAdam Frisby2008-04-30 21:23:37 +0000
commit919aed1058d61cab479c6702f4051ac1f338fc03 (patch)
tree178631e05fee16c2a47d54e27b5a3f18268ecc4f /OpenSim/Region/Environment/Modules/Grid/Interregion/RemotingObject.cs
parent* Commiting more missed files. (diff)
downloadopensim-SC_OLD-919aed1058d61cab479c6702f4051ac1f338fc03.zip
opensim-SC_OLD-919aed1058d61cab479c6702f4051ac1f338fc03.tar.gz
opensim-SC_OLD-919aed1058d61cab479c6702f4051ac1f338fc03.tar.bz2
opensim-SC_OLD-919aed1058d61cab479c6702f4051ac1f338fc03.tar.xz
* And more
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Grid/Interregion/RemotingObject.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Grid/Interregion/RemotingObject.cs50
1 files changed, 50 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Grid/Interregion/RemotingObject.cs b/OpenSim/Region/Environment/Modules/Grid/Interregion/RemotingObject.cs
new file mode 100644
index 0000000..2c72bb9
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/Grid/Interregion/RemotingObject.cs
@@ -0,0 +1,50 @@
1using System;
2using System.Collections.Generic;
3using OpenSim.Framework;
4
5namespace OpenSim.Region.Environment.Modules.Grid.Interregion
6{
7 public class RemotingObject : MarshalByRefObject
8 {
9 private readonly Location[] m_coords;
10 private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>();
11
12 public RemotingObject(Dictionary<Type, Object> myInterfaces, Location[] coords)
13 {
14 m_interfaces = myInterfaces;
15 m_coords = coords;
16 }
17
18 public Location[] GetLocations()
19 {
20 return (Location[]) m_coords.Clone();
21 }
22
23 public string[] GetInterfaces()
24 {
25 string[] interfaces = new string[m_interfaces.Count];
26 int i = 0;
27
28 foreach (KeyValuePair<Type, object> pair in m_interfaces)
29 {
30 interfaces[i++] = pair.Key.FullName;
31 }
32
33 return interfaces;
34 }
35
36 /// <summary>
37 /// Returns a registered interface availible to neighbouring regions.
38 /// </summary>
39 /// <typeparam name="T">The type of interface you wish to request</typeparam>
40 /// <returns>A MarshalByRefObject inherited from this region inheriting the interface requested.</returns>
41 /// <remarks>All registered interfaces <b>MUST</b> inherit from MarshalByRefObject and use only serialisable types.</remarks>
42 public T RequestInterface<T>()
43 {
44 if (m_interfaces.ContainsKey(typeof (T)))
45 return (T) m_interfaces[typeof (T)];
46
47 throw new NotSupportedException("No such interface registered.");
48 }
49 }
50} \ No newline at end of file