summaryrefslogtreecommitdiff
path: root/python/modules/IcePy/ValueFactoryManager.h
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2016-01-19 16:46:11 -0800
committerMark Spruiell <mes@zeroc.com>2016-01-19 16:46:11 -0800
commitd5dd7c866e9e1dc59dc7e127eb39f641530bf823 (patch)
tree61771e4f322a7138b643d5325a6d10acea30fb84 /python/modules/IcePy/ValueFactoryManager.h
parentDeprecate ice_name and add ice_id (diff)
downloadice-d5dd7c866e9e1dc59dc7e127eb39f641530bf823.tar.bz2
ice-d5dd7c866e9e1dc59dc7e127eb39f641530bf823.tar.xz
ice-d5dd7c866e9e1dc59dc7e127eb39f641530bf823.zip
ICE-6861 - removing public stream API
Diffstat (limited to 'python/modules/IcePy/ValueFactoryManager.h')
-rw-r--r--python/modules/IcePy/ValueFactoryManager.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/python/modules/IcePy/ValueFactoryManager.h b/python/modules/IcePy/ValueFactoryManager.h
new file mode 100644
index 00000000000..78f9c804565
--- /dev/null
+++ b/python/modules/IcePy/ValueFactoryManager.h
@@ -0,0 +1,95 @@
+// **********************************************************************
+//
+// 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.
+//
+// **********************************************************************
+
+#ifndef ICEPY_VALUE_FACTORY_MANAGER_H
+#define ICEPY_VALUE_FACTORY_MANAGER_H
+
+#include <Config.h>
+#include <Ice/ValueFactory.h>
+#include <IceUtil/Mutex.h>
+
+namespace IcePy
+{
+
+extern PyTypeObject ValueFactoryManagerType;
+
+bool initValueFactoryManager(PyObject*);
+
+class FactoryWrapper : public Ice::ValueFactory
+{
+public:
+
+ FactoryWrapper(PyObject*, PyObject*);
+ ~FactoryWrapper();
+
+ virtual Ice::ValuePtr create(const std::string&);
+
+ PyObject* getValueFactory() const;
+ PyObject* getObjectFactory() const;
+
+ void destroy();
+
+protected:
+
+ PyObject* _valueFactory;
+ PyObject* _objectFactory;
+};
+typedef IceUtil::Handle<FactoryWrapper> FactoryWrapperPtr;
+
+class DefaultValueFactory : public Ice::ValueFactory
+{
+public:
+
+ virtual Ice::ValuePtr create(const std::string&);
+
+ void setDelegate(const Ice::ValueFactoryPtr&);
+ Ice::ValueFactoryPtr getDelegate() const { return _delegate; }
+
+ PyObject* getValueFactory() const;
+ PyObject* getObjectFactory() const;
+
+ void destroy();
+
+private:
+
+ Ice::ValueFactoryPtr _delegate;
+};
+typedef IceUtil::Handle<DefaultValueFactory> DefaultValueFactoryPtr;
+
+class ValueFactoryManager : public Ice::ValueFactoryManager, public IceUtil::Mutex
+{
+public:
+
+ ValueFactoryManager();
+ ~ValueFactoryManager();
+
+ virtual void add(const Ice::ValueFactoryPtr&, const std::string&);
+ virtual Ice::ValueFactoryPtr find(const std::string&) const;
+
+ virtual void add(PyObject*, PyObject*, const std::string&);
+ PyObject* findValueFactory(const std::string&) const;
+ PyObject* findObjectFactory(const std::string&) const;
+
+ PyObject* getObject() const;
+
+ void destroy();
+
+private:
+
+ typedef std::map<std::string, Ice::ValueFactoryPtr> FactoryMap;
+
+ PyObject* _self;
+ FactoryMap _factories;
+ DefaultValueFactoryPtr _defaultFactory;
+};
+typedef IceUtil::Handle<ValueFactoryManager> ValueFactoryManagerPtr;
+
+}
+
+#endif