diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/EntityList.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EntityList.cs | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityList.cs b/OpenSim/Region/Environment/Scenes/EntityList.cs deleted file mode 100644 index 2488ab3..0000000 --- a/OpenSim/Region/Environment/Scenes/EntityList.cs +++ /dev/null | |||
@@ -1,161 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using OpenMetaverse; | ||
33 | using OpenMetaverse.Packets; | ||
34 | using log4net; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Environment.Types; | ||
37 | using OpenSim.Region.Physics.Manager; | ||
38 | |||
39 | namespace OpenSim.Region.Environment.Scenes | ||
40 | { | ||
41 | public class EntityList | ||
42 | { | ||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
45 | // we are intentionally using non generics here as testing has | ||
46 | // shown synchronized collections are faster than manually | ||
47 | // locked generics. | ||
48 | |||
49 | private Hashtable m_obj_by_uuid; | ||
50 | private Hashtable m_obj_by_local; | ||
51 | |||
52 | private Hashtable m_pres_by_uuid; | ||
53 | |||
54 | public EntityList() | ||
55 | { | ||
56 | m_obj_by_uuid = Hashtable.Synchronized(new Hashtable()); | ||
57 | m_obj_by_local = Hashtable.Synchronized(new Hashtable()); | ||
58 | m_pres_by_uuid = Hashtable.Synchronized(new Hashtable()); | ||
59 | } | ||
60 | |||
61 | // Interface definition | ||
62 | // | ||
63 | // Add(SOG) | ||
64 | // Add(SP) | ||
65 | // RemoveObject(SOG) | ||
66 | // RemovePresence(SP) | ||
67 | // List() | ||
68 | // ListObjects() | ||
69 | // ListPresenes() | ||
70 | // RemoveAll() | ||
71 | // FindObject(UUID) | ||
72 | // FindObject(int) | ||
73 | // FindPresence(UUID) | ||
74 | |||
75 | public void Add(SceneObjectGroup obj) | ||
76 | { | ||
77 | m_obj_by_uuid[obj.UUID] = obj; | ||
78 | m_obj_by_local[obj.LocalId] = obj.UUID; | ||
79 | } | ||
80 | |||
81 | public void Add(ScenePresence pres) | ||
82 | { | ||
83 | m_pres_by_uuid[pres.UUID] = pres; | ||
84 | } | ||
85 | |||
86 | public SceneObjectGroup RemoveObject(UUID uuid) | ||
87 | { | ||
88 | SceneObjectGroup sog = null; | ||
89 | try | ||
90 | { | ||
91 | sog = (SceneObjectGroup)m_obj_by_uuid[uuid]; | ||
92 | m_obj_by_uuid.Remove(uuid); | ||
93 | m_obj_by_local.Remove(sog.LocalId); | ||
94 | } | ||
95 | catch (Exception e) | ||
96 | { | ||
97 | m_log.ErrorFormat("RemoveObject failed for {0}", uuid, e); | ||
98 | sog = null; | ||
99 | } | ||
100 | return sog; | ||
101 | } | ||
102 | |||
103 | public ScenePresence RemovePresence(UUID uuid) | ||
104 | { | ||
105 | ScenePresence sp = null; | ||
106 | try | ||
107 | { | ||
108 | sp = (ScenePresence)m_pres_by_uuid[uuid]; | ||
109 | m_pres_by_uuid.Remove(uuid); | ||
110 | } | ||
111 | catch (Exception e) | ||
112 | { | ||
113 | m_log.ErrorFormat("RemovePresence failed for {0}", uuid, e); | ||
114 | sp = null; | ||
115 | } | ||
116 | return sp; | ||
117 | } | ||
118 | |||
119 | public SceneObjectGroup FindObject(UUID uuid) | ||
120 | { | ||
121 | try | ||
122 | { | ||
123 | SceneObjectGroup sog = (SceneObjectGroup)m_obj_by_uuid[uuid]; | ||
124 | return sog; | ||
125 | } | ||
126 | catch (Exception e) | ||
127 | { | ||
128 | m_log.ErrorFormat("FindObject failed for {0}", uuid, e); | ||
129 | return null; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | public SceneObjectGroup FindObject(uint local) | ||
134 | { | ||
135 | try | ||
136 | { | ||
137 | UUID uuid = (UUID)m_obj_by_local[local]; | ||
138 | SceneObjectGroup sog = (SceneObjectGroup)m_obj_by_uuid[uuid]; | ||
139 | return sog; | ||
140 | } | ||
141 | catch (Exception e) | ||
142 | { | ||
143 | m_log.ErrorFormat("FindObject failed for {0}", local, e); | ||
144 | return null; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | public ScenePresence FindPresense(UUID uuid) | ||
149 | { | ||
150 | try | ||
151 | { | ||
152 | ScenePresence sp = (ScenePresence)m_pres_by_uuid[uuid]; | ||
153 | return sp; | ||
154 | } | ||
155 | catch (Exception) | ||
156 | { | ||
157 | return null; | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | } | ||