summaryrefslogtreecommitdiff
path: root/python/modules
diff options
context:
space:
mode:
Diffstat (limited to 'python/modules')
-rw-r--r--python/modules/IcePy/Communicator.cpp49
-rw-r--r--python/modules/IcePy/Communicator.h3
-rw-r--r--python/modules/IcePy/Init.cpp4
3 files changed, 56 insertions, 0 deletions
diff --git a/python/modules/IcePy/Communicator.cpp b/python/modules/IcePy/Communicator.cpp
index 3f2d56e4c32..c98f1f1c8f0 100644
--- a/python/modules/IcePy/Communicator.cpp
+++ b/python/modules/IcePy/Communicator.cpp
@@ -1737,3 +1737,52 @@ IcePy::getCommunicatorWrapper(const Ice::CommunicatorPtr& communicator)
Py_INCREF(obj->wrapper);
return obj->wrapper;
}
+
+extern "C"
+PyObject*
+IcePy_identityToString(PyObject* /*self*/, PyObject* obj)
+{
+ Ice::Identity id;
+ if(!getIdentity(obj, id))
+ {
+ return 0;
+ }
+
+ string str;
+
+ try
+ {
+ str = Ice::identityToString(id);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ setPythonException(ex);
+ return 0;
+ }
+
+ return createString(str);
+}
+
+extern "C"
+PyObject*
+IcePy_stringToIdentity(PyObject* /*self*/, PyObject* obj)
+{
+ string str;
+ if(!getStringArg(obj, "str", str))
+ {
+ return 0;
+ }
+
+ Ice::Identity id;
+ try
+ {
+ id = Ice::stringToIdentity(str);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ setPythonException(ex);
+ return 0;
+ }
+
+ return createIdentity(id);
+}
diff --git a/python/modules/IcePy/Communicator.h b/python/modules/IcePy/Communicator.h
index 3f2ac0452c3..c83c2898aae 100644
--- a/python/modules/IcePy/Communicator.h
+++ b/python/modules/IcePy/Communicator.h
@@ -32,4 +32,7 @@ extern "C" PyObject* IcePy_initializeWithProperties(PyObject*, PyObject*);
extern "C" PyObject* IcePy_initializeWithLogger(PyObject*, PyObject*);
extern "C" PyObject* IcePy_initializeWithPropertiesAndLogger(PyObject*, PyObject*);
+extern "C" PyObject* IcePy_identityToString(PyObject*, PyObject*);
+extern "C" PyObject* IcePy_stringToIdentity(PyObject*, PyObject*);
+
#endif
diff --git a/python/modules/IcePy/Init.cpp b/python/modules/IcePy/Init.cpp
index 337298eed97..ea98eed6b89 100644
--- a/python/modules/IcePy/Init.cpp
+++ b/python/modules/IcePy/Init.cpp
@@ -58,6 +58,10 @@ static PyMethodDef methods[] =
PyDoc_STR(STRCAST("generateUUID() -> string")) },
{ STRCAST("createProperties"), reinterpret_cast<PyCFunction>(IcePy_createProperties), METH_VARARGS,
PyDoc_STR(STRCAST("createProperties([args]) -> Ice.Properties")) },
+ { STRCAST("stringToIdentity"), reinterpret_cast<PyCFunction>(IcePy_stringToIdentity), METH_O,
+ PyDoc_STR(STRCAST("stringToIdentity(string) -> Ice.Identity")) },
+ { STRCAST("identityToString"), reinterpret_cast<PyCFunction>(IcePy_identityToString), METH_O,
+ PyDoc_STR(STRCAST("identityToString(Ice.Identity) -> string")) },
{ STRCAST("getProcessLogger"), reinterpret_cast<PyCFunction>(IcePy_getProcessLogger), METH_NOARGS,
PyDoc_STR(STRCAST("getProcessLogger() -> Ice.Logger")) },
{ STRCAST("setProcessLogger"), reinterpret_cast<PyCFunction>(IcePy_setProcessLogger), METH_VARARGS,