diff options
author | Bernard Normier <bernard@zeroc.com> | 2014-09-08 16:26:55 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2014-09-08 16:26:55 +0000 |
commit | dca3056b1e44b0dd5b106f1df86ab8cd5a334b1a (patch) | |
tree | a04160d5f64fd555401f533d4ef7e8658518fa19 /py/modules/IcePy/ObjectAdapter.cpp | |
parent | Fixed ICE-5667: Added Communicator::createAdmin in C++, Java, C# and Python (diff) | |
download | ice-dca3056b1e44b0dd5b106f1df86ab8cd5a334b1a.tar.bz2 ice-dca3056b1e44b0dd5b106f1df86ab8cd5a334b1a.tar.xz ice-dca3056b1e44b0dd5b106f1df86ab8cd5a334b1a.zip |
Added missing implementation for ObjectAdapter::getLocator in Python
Diffstat (limited to 'py/modules/IcePy/ObjectAdapter.cpp')
-rw-r--r-- | py/modules/IcePy/ObjectAdapter.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/py/modules/IcePy/ObjectAdapter.cpp b/py/modules/IcePy/ObjectAdapter.cpp index b82c500a8aa..34d53605182 100644 --- a/py/modules/IcePy/ObjectAdapter.cpp +++ b/py/modules/IcePy/ObjectAdapter.cpp @@ -1513,6 +1513,37 @@ adapterSetLocator(ObjectAdapterObject* self, PyObject* args) return Py_None; } + +#ifdef WIN32 +extern "C" +#endif +static PyObject* +adapterGetLocator(ObjectAdapterObject* self) +{ + assert(self->adapter); + Ice::LocatorPrx locator; + try + { + locator = (*self->adapter)->getLocator(); + } + catch(const Ice::Exception& ex) + { + setPythonException(ex); + return 0; + } + + if(!locator) + { + Py_INCREF(Py_None); + return Py_None; + } + + PyObject* locatorProxyType = lookupType("Ice.LocatorPrx"); + assert(locatorProxyType); + return createProxy(locator, (*self->adapter)->getCommunicator(), locatorProxyType); +} + + #ifdef WIN32 extern "C" #endif @@ -1667,6 +1698,8 @@ static PyMethodDef AdapterMethods[] = PyDoc_STR(STRCAST("createIndirectProxy(identity) -> Ice.ObjectPrx")) }, { STRCAST("setLocator"), reinterpret_cast<PyCFunction>(adapterSetLocator), METH_VARARGS, PyDoc_STR(STRCAST("setLocator(proxy) -> None")) }, + { STRCAST("getLocator"), reinterpret_cast<PyCFunction>(adapterGetLocator), METH_NOARGS, + PyDoc_STR(STRCAST("getLocator() -> Ice.LocatorPrx")) }, { STRCAST("refreshPublishedEndpoints"), reinterpret_cast<PyCFunction>(adapterRefreshPublishedEndpoints), METH_NOARGS, PyDoc_STR(STRCAST("refreshPublishedEndpoints() -> None")) }, { STRCAST("getEndpoints"), reinterpret_cast<PyCFunction>(adapterGetEndpoints), METH_NOARGS, |