summaryrefslogtreecommitdiff
path: root/py/modules/IcePy/Operation.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2006-08-09 22:56:27 +0000
committerMark Spruiell <mes@zeroc.com>2006-08-09 22:56:27 +0000
commit672a123736533ef62ba958bf9ccee8d59a3b79fc (patch)
tree528f1025b3a6e5ed47af2df5813ef0e85057bb44 /py/modules/IcePy/Operation.cpp
parentfixing bug in IceSSL.VerifyPeer description (diff)
downloadice-672a123736533ef62ba958bf9ccee8d59a3b79fc.tar.bz2
ice-672a123736533ef62ba958bf9ccee8d59a3b79fc.tar.xz
ice-672a123736533ef62ba958bf9ccee8d59a3b79fc.zip
bug 1257: deprecate nonmutating
Diffstat (limited to 'py/modules/IcePy/Operation.cpp')
-rw-r--r--py/modules/IcePy/Operation.cpp36
1 files changed, 26 insertions, 10 deletions
diff --git a/py/modules/IcePy/Operation.cpp b/py/modules/IcePy/Operation.cpp
index a32cea2dd96..177d3e25557 100644
--- a/py/modules/IcePy/Operation.cpp
+++ b/py/modules/IcePy/Operation.cpp
@@ -47,11 +47,12 @@ class OperationI : public Operation
{
public:
- OperationI(const char*, PyObject*, int, PyObject*, PyObject*, PyObject*, PyObject*);
+ OperationI(const char*, PyObject*, PyObject*, int, PyObject*, PyObject*, PyObject*, PyObject*);
virtual PyObject* invoke(const Ice::ObjectPrx&, PyObject*, PyObject*);
virtual PyObject* invokeAsync(const Ice::ObjectPrx&, PyObject*, PyObject*, PyObject*);
virtual void deprecate(const string&);
+ virtual Ice::OperationMode mode() const;
virtual void dispatch(PyObject*, const Ice::AMD_Object_ice_invokePtr&, const vector<Ice::Byte>&,
const Ice::Current&);
@@ -66,6 +67,7 @@ private:
string _name;
Ice::OperationMode _mode;
+ Ice::OperationMode _sendMode;
bool _amd;
ParamInfoList _inParams;
ParamInfoList _outParams;
@@ -145,18 +147,19 @@ operationInit(OperationObject* self, PyObject* args, PyObject* /*kwds*/)
PyObject* modeType = lookupType("Ice.OperationMode");
assert(modeType != NULL);
PyObject* mode;
+ PyObject* sendMode;
int amd;
PyObject* inParams;
PyObject* outParams;
PyObject* returnType;
PyObject* exceptions;
- if(!PyArg_ParseTuple(args, STRCAST("sO!iO!O!OO!"), &name, modeType, &mode, &amd, &PyTuple_Type, &inParams,
- &PyTuple_Type, &outParams, &returnType, &PyTuple_Type, &exceptions))
+ if(!PyArg_ParseTuple(args, STRCAST("sO!O!iO!O!OO!"), &name, modeType, &mode, modeType, &sendMode, &amd,
+ &PyTuple_Type, &inParams, &PyTuple_Type, &outParams, &returnType, &PyTuple_Type, &exceptions))
{
return -1;
}
- OperationIPtr op = new OperationI(name, mode, amd, inParams, outParams, returnType, exceptions);
+ OperationIPtr op = new OperationI(name, mode, sendMode, amd, inParams, outParams, returnType, exceptions);
self->op = new OperationPtr(op);
return 0;
@@ -391,8 +394,8 @@ IcePy::AMICallback::ice_exception(const Ice::Exception& ex)
//
// OperationI implementation.
//
-IcePy::OperationI::OperationI(const char* name, PyObject* mode, int amd, PyObject* inParams, PyObject* outParams,
- PyObject* returnType, PyObject* exceptions)
+IcePy::OperationI::OperationI(const char* name, PyObject* mode, PyObject* sendMode, int amd, PyObject* inParams,
+ PyObject* outParams, PyObject* returnType, PyObject* exceptions)
{
_name = name;
_amd = amd ? true : false;
@@ -412,6 +415,13 @@ IcePy::OperationI::OperationI(const char* name, PyObject* mode, int amd, PyObjec
assert(PyInt_Check(modeValue.get()));
_mode = (Ice::OperationMode)static_cast<int>(PyInt_AS_LONG(modeValue.get()));
+ //
+ // sendMode
+ //
+ PyObjectHandle sendModeValue = PyObject_GetAttrString(sendMode, STRCAST("value"));
+ assert(PyInt_Check(sendModeValue.get()));
+ _sendMode = (Ice::OperationMode)static_cast<int>(PyInt_AS_LONG(sendModeValue.get()));
+
int i, sz;
//
@@ -515,12 +525,12 @@ IcePy::OperationI::invoke(const Ice::ObjectPrx& proxy, PyObject* args, PyObject*
}
AllowThreads allowThreads; // Release Python's global interpreter lock during remote invocations.
- status = proxy->ice_invoke(_name, _mode, params, result, ctx);
+ status = proxy->ice_invoke(_name, _sendMode, params, result, ctx);
}
else
{
AllowThreads allowThreads; // Release Python's global interpreter lock during remote invocations.
- status = proxy->ice_invoke(_name, _mode, params, result);
+ status = proxy->ice_invoke(_name, _sendMode, params, result);
}
}
@@ -629,12 +639,12 @@ IcePy::OperationI::invokeAsync(const Ice::ObjectPrx& proxy, PyObject* callback,
}
AllowThreads allowThreads; // Release Python's global interpreter lock during remote invocations.
- proxy->ice_invoke_async(cb, _name, _mode, params, ctx);
+ proxy->ice_invoke_async(cb, _name, _sendMode, params, ctx);
}
else
{
AllowThreads allowThreads; // Release Python's global interpreter lock during remote invocations.
- proxy->ice_invoke_async(cb, _name, _mode, params);
+ proxy->ice_invoke_async(cb, _name, _sendMode, params);
}
}
catch(const Ice::Exception& ex)
@@ -659,6 +669,12 @@ IcePy::OperationI::deprecate(const string& msg)
}
}
+Ice::OperationMode
+IcePy::OperationI::mode() const
+{
+ return _mode;
+}
+
void
IcePy::OperationI::dispatch(PyObject* servant, const Ice::AMD_Object_ice_invokePtr& cb,
const vector<Ice::Byte>& inBytes, const Ice::Current& current)