blob: a80cf9d43e939c34aaae45363634aaed406e1c64 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
// **********************************************************************
//
// Copyright (c) 2003-present 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 ICE_NOEXCEPT;
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
|