diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-11-09 16:22:47 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-11-09 16:22:47 -0800 |
commit | 493caea19fd83663eb03b4eeaf7714f99ac07b97 (patch) | |
tree | 39f8b7dc983394288cb25961a0907ebe0b0f5847 /py/modules/IcePy/Operation.cpp | |
parent | ICE-4914 - Update Database/Oracle demos (diff) | |
download | ice-493caea19fd83663eb03b4eeaf7714f99ac07b97.tar.bz2 ice-493caea19fd83663eb03b4eeaf7714f99ac07b97.tar.xz ice-493caea19fd83663eb03b4eeaf7714f99ac07b97.zip |
ICE-4930 - fixes for scripting languages
Diffstat (limited to 'py/modules/IcePy/Operation.cpp')
-rw-r--r-- | py/modules/IcePy/Operation.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/py/modules/IcePy/Operation.cpp b/py/modules/IcePy/Operation.cpp index 0cbbee3b77a..ea9bffcc263 100644 --- a/py/modules/IcePy/Operation.cpp +++ b/py/modules/IcePy/Operation.cpp @@ -77,13 +77,15 @@ public: ParamInfoPtr returnType; ExceptionInfoList exceptions; string dispatchName; + bool sendsClasses; + bool returnsClasses; bool pseudoOp; private: string _deprecateMessage; - static void convertParams(PyObject*, ParamInfoList&, int); + static void convertParams(PyObject*, ParamInfoList&, int, bool&); static ParamInfoPtr convertParam(PyObject*, int); }; typedef IceUtil::Handle<Operation> OperationPtr; @@ -1074,20 +1076,26 @@ IcePy::Operation::Operation(const char* n, PyObject* m, PyObject* sm, int amdFla // // returnType // + returnsClasses = false; if(ret != Py_None) { returnType = convertParam(ret, 0); + if(!returnType->optional) + { + returnsClasses = returnType->type->usesClasses(); + } } // // inParams // - convertParams(in, inParams, 0); + sendsClasses = false; + convertParams(in, inParams, 0, sendsClasses); // // outParams // - convertParams(out, outParams, returnType ? 1 : 0); + convertParams(out, outParams, returnType ? 1 : 0, returnsClasses); class SortFn { @@ -1153,7 +1161,7 @@ IcePy::Operation::deprecate(const string& msg) } void -IcePy::Operation::convertParams(PyObject* p, ParamInfoList& params, int posOffset) +IcePy::Operation::convertParams(PyObject* p, ParamInfoList& params, int posOffset, bool& usesClasses) { int sz = static_cast<int>(PyTuple_GET_SIZE(p)); for(int i = 0; i < sz; ++i) @@ -1161,6 +1169,10 @@ IcePy::Operation::convertParams(PyObject* p, ParamInfoList& params, int posOffse PyObject* item = PyTuple_GET_ITEM(p, i); ParamInfoPtr param = convertParam(item, i + posOffset); params.push_back(param); + if(!param->optional && !usesClasses) + { + usesClasses = param->type->usesClasses(); + } } } @@ -1555,6 +1567,11 @@ IcePy::TypedInvocation::prepareRequest(PyObject* args, MappingType mapping, vect } } + if(_op->sendsClasses) + { + os->writePendingObjects(); + } + os->endEncapsulation(); os->finished(bytes); } @@ -1643,6 +1660,11 @@ IcePy::TypedInvocation::unmarshalResults(const pair<const Ice::Byte*, const Ice: } } + if(_op->returnsClasses) + { + is->readPendingObjects(); + } + is->endEncapsulation(); util.update(); @@ -3255,6 +3277,11 @@ IcePy::TypedUpcall::dispatch(PyObject* servant, const pair<const Ice::Byte*, con } } + if(_op->sendsClasses) + { + is->readPendingObjects(); + } + is->endEncapsulation(); util.update(); @@ -3458,6 +3485,11 @@ IcePy::TypedUpcall::response(PyObject* args, const Ice::EncodingVersion& encodin } } + if(_op->returnsClasses) + { + os->writePendingObjects(); + } + os->endEncapsulation(); Ice::ByteSeq bytes; |