diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-07-01 17:42:04 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-07-01 17:42:04 +0200 |
commit | 344a7fd6e0d716f81dc27495e97a7ad9c2ab07b8 (patch) | |
tree | bd06f4919e5a5827f60e2a536e43e47a4fbed6d2 /py/modules/IcePy/Proxy.cpp | |
parent | Fixed ICE-5569: IceStorm IceMX debug iterator assert (diff) | |
download | ice-344a7fd6e0d716f81dc27495e97a7ad9c2ab07b8.tar.bz2 ice-344a7fd6e0d716f81dc27495e97a7ad9c2ab07b8.tar.xz ice-344a7fd6e0d716f81dc27495e97a7ad9c2ab07b8.zip |
IceMX and Python support for the new collocation optimization
Diffstat (limited to 'py/modules/IcePy/Proxy.cpp')
-rw-r--r-- | py/modules/IcePy/Proxy.cpp | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/py/modules/IcePy/Proxy.cpp b/py/modules/IcePy/Proxy.cpp index 1143d6d1fad..6d6b8fe7cba 100644 --- a/py/modules/IcePy/Proxy.cpp +++ b/py/modules/IcePy/Proxy.cpp @@ -1595,7 +1595,62 @@ proxyIceTimeout(ProxyObject* self, PyObject* args) return createProxy(newProxy, *self->communicator, reinterpret_cast<PyObject*>(Py_TYPE(self))); } -// NOTE: ice_collocationOptimized is not currently supported. +#ifdef WIN32 +extern "C" +#endif +static PyObject* +proxyIceIsCollocationOptimized(ProxyObject* self) +{ + assert(self->proxy); + + PyObject* b; + try + { + b = (*self->proxy)->ice_isCollocationOptimized() ? getTrue() : getFalse(); + } + catch(const Ice::Exception& ex) + { + setPythonException(ex); + return 0; + } + + Py_INCREF(b); + return b; +} + +#ifdef WIN32 +extern "C" +#endif +static PyObject* +proxyIceCollocationOptimized(ProxyObject* self, PyObject* args) +{ + PyObject* flag; + if(!PyArg_ParseTuple(args, STRCAST("O"), &flag)) + { + return 0; + } + + int n = PyObject_IsTrue(flag); + if(n < 0) + { + return 0; + } + + assert(self->proxy); + + Ice::ObjectPrx newProxy; + try + { + newProxy = (*self->proxy)->ice_collocationOptimized(n == 1); + } + catch(const Ice::Exception& ex) + { + setPythonException(ex); + return 0; + } + + return createProxy(newProxy, *self->communicator, reinterpret_cast<PyObject*>(Py_TYPE(self))); +} #ifdef WIN32 extern "C" @@ -2295,6 +2350,10 @@ static PyMethodDef ProxyMethods[] = METH_NOARGS, PyDoc_STR(STRCAST("ice_getInvocationTimeout() -> int")) }, { STRCAST("ice_getConnectionId"), reinterpret_cast<PyCFunction>(proxyIceGetConnectionId), METH_NOARGS, PyDoc_STR(STRCAST("ice_getConnectionId() -> string")) }, + { STRCAST("ice_isCollocationOptimized"), reinterpret_cast<PyCFunction>(proxyIceIsCollocationOptimized), METH_NOARGS, + PyDoc_STR(STRCAST("ice_isCollocationOptimized() -> bool")) }, + { STRCAST("ice_collocationOptimized"), reinterpret_cast<PyCFunction>(proxyIceCollocationOptimized), METH_VARARGS, + PyDoc_STR(STRCAST("ice_collocationOptimized(bool) -> Ice.ObjectPrx")) }, { STRCAST("ice_locatorCacheTimeout"), reinterpret_cast<PyCFunction>(proxyIceLocatorCacheTimeout), METH_VARARGS, PyDoc_STR(STRCAST("ice_locatorCacheTimeout(int) -> Ice.ObjectPrx")) }, { STRCAST("ice_invocationTimeout"), reinterpret_cast<PyCFunction>(proxyIceInvocationTimeout), METH_VARARGS, |