diff options
author | Joe George <joe@zeroc.com> | 2015-12-08 11:33:42 -0500 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2015-12-08 16:09:24 -0500 |
commit | 6a43686ce26de5d2d5edf4a485ecff3a242c26b6 (patch) | |
tree | d31e4f16dc9ed6e28056a7224e045a4638955f5e /csharp/src/Ice/ObjectFactoryManager.cs | |
parent | C++11 mapping IceDiscovery plug-in (diff) | |
download | ice-6a43686ce26de5d2d5edf4a485ecff3a242c26b6.tar.bz2 ice-6a43686ce26de5d2d5edf4a485ecff3a242c26b6.tar.xz ice-6a43686ce26de5d2d5edf4a485ecff3a242c26b6.zip |
ICE-6908 - Add ValueFactory
ValueFactory is a replacement for ObjectFactory (which is still
available if needed). It is an interface with only one operation
and can has the "delegate" metadata.
Diffstat (limited to 'csharp/src/Ice/ObjectFactoryManager.cs')
-rw-r--r-- | csharp/src/Ice/ObjectFactoryManager.cs | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/csharp/src/Ice/ObjectFactoryManager.cs b/csharp/src/Ice/ObjectFactoryManager.cs deleted file mode 100644 index e211713ed55..00000000000 --- a/csharp/src/Ice/ObjectFactoryManager.cs +++ /dev/null @@ -1,86 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -namespace IceInternal -{ - - using System.Collections.Generic; - - public sealed class ObjectFactoryManager - { - public void add(Ice.ObjectFactory factory, string id) - { - lock(this) - { - if(_factoryMap.ContainsKey(id)) - { - Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException(); - ex.id = id; - ex.kindOfObject = "object factory"; - throw ex; - } - _factoryMap[id] = factory; - } - } - - public void remove(string id) - { - object o = null; - lock(this) - { - if(!_factoryMap.ContainsKey(id)) - { - Ice.NotRegisteredException ex = new Ice.NotRegisteredException(); - ex.id = id; - ex.kindOfObject = "object factory"; - throw ex; - } - _factoryMap.Remove(id); - } - ((Ice.ObjectFactory)o).destroy(); - } - - public Ice.ObjectFactory find(string id) - { - lock(this) - { - Ice.ObjectFactory factory = null; - _factoryMap.TryGetValue(id, out factory); - return factory; - } - } - - // - // Only for use by Instance - // - internal ObjectFactoryManager() - { - _factoryMap = new Dictionary<string, Ice.ObjectFactory>(); - } - - internal void destroy() - { - Dictionary<string, Ice.ObjectFactory> oldMap = null; - - lock(this) - { - oldMap = _factoryMap; - _factoryMap = new Dictionary<string, Ice.ObjectFactory>(); - } - - foreach(Ice.ObjectFactory factory in oldMap.Values) - { - factory.destroy(); - } - } - - private Dictionary<string, Ice.ObjectFactory> _factoryMap; - } - -} |