summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2010-01-06 12:43:48 +0100
committerBenoit Foucher <benoit@zeroc.com>2010-01-06 12:43:48 +0100
commitbc2e4034079842cde62b6b44c4bdcd6a954f4f46 (patch)
tree0afd6dbfade2a57978227193d5dccdc267e89d7b /cpp
parentbug 4495 - clean up book demos (diff)
downloadice-bc2e4034079842cde62b6b44c4bdcd6a954f4f46.tar.bz2
ice-bc2e4034079842cde62b6b44c4bdcd6a954f4f46.tar.xz
ice-bc2e4034079842cde62b6b44c4bdcd6a954f4f46.zip
Merged Mark's pythonami branch
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Slice/PythonUtil.cpp64
-rw-r--r--cpp/test/Ice/exceptions/AllTests.cpp2
-rw-r--r--cpp/test/Ice/operations/OnewaysNewAMI.cpp4
-rw-r--r--cpp/test/Ice/slicing/objects/Test.ice2
4 files changed, 54 insertions, 18 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp
index c1d8cb26d96..5c92d4bd235 100644
--- a/cpp/src/Slice/PythonUtil.cpp
+++ b/cpp/src/Slice/PythonUtil.cpp
@@ -680,31 +680,76 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
}
}
- _out << sp << nl << "def " << fixedOpName << "(self";
+ comment = (*oli)->comment();
+ if(!comment.empty())
+ {
+ comment = "'''" + editComment(comment) + "'''";
+ }
+
+ _out << sp;
+ if(!comment.empty())
+ {
+ _out << nl << comment;
+ }
+ _out << nl << "def " << fixedOpName << "(self";
if(!inParams.empty())
{
_out << ", " << inParams;
}
_out << ", _ctx=None):";
_out.inc();
+ _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".invoke(self, ((" << inParams;
+ if(!inParams.empty() && inParams.find(',') == string::npos)
+ {
+ _out << ", ";
+ }
+ _out << "), _ctx))";
+ _out.dec();
- comment = (*oli)->comment();
+ //
+ // Async operations.
+ //
+ _out << sp;
if(!comment.empty())
{
- _out << nl << "'''" << editComment(comment) << "'''";
+ _out << nl << comment;
}
-
- _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".invoke(self, ((" << inParams;
+ _out << nl << "def begin_" << (*oli)->name() << "(self";
+ if(!inParams.empty())
+ {
+ _out << ", " << inParams;
+ }
+ _out << ", _response=None, _ex=None, _sent=None, _ctx=None):";
+ _out.inc();
+ _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".begin(self, ((" << inParams;
if(!inParams.empty() && inParams.find(',') == string::npos)
{
_out << ", ";
}
- _out << "), _ctx))";
+ _out << "), _response, _ex, _sent, _ctx))";
+ _out.dec();
+
+ _out << sp;
+ if(!comment.empty())
+ {
+ _out << nl << comment;
+ }
+ _out << nl << "def end_" << (*oli)->name() << "(self, _r):";
+ _out.inc();
+ _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".end(self, _r)";
_out.dec();
+ //
+ // Old AMI operations.
+ //
if(p->hasMetaData("ami") || (*oli)->hasMetaData("ami"))
{
- _out << sp << nl << "def " << fixedOpName << "_async(self, _cb";
+ _out << sp;
+ if(!comment.empty())
+ {
+ _out << nl << comment;
+ }
+ _out << nl << "def " << fixedOpName << "_async(self, _cb";
if(!inParams.empty())
{
_out << ", " << inParams;
@@ -712,11 +757,6 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << ", _ctx=None):";
_out.inc();
- if(!comment.empty())
- {
- _out << nl << "'''" << editComment(comment) << "'''";
- }
-
_out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".invokeAsync(self, (_cb, ("
<< inParams;
if(!inParams.empty() && inParams.find(',') == string::npos)
diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp
index 1e36c4dae0e..32bc0f641c2 100644
--- a/cpp/test/Ice/exceptions/AllTests.cpp
+++ b/cpp/test/Ice/exceptions/AllTests.cpp
@@ -1716,7 +1716,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
cout << "ok" << endl;
- cout << "catching unknown non-Ice exception with AMI... " << flush;
+ cout << "catching unknown non-Ice exception with new AMI mapping... " << flush;
{
CallbackPtr cb = new Callback;
diff --git a/cpp/test/Ice/operations/OnewaysNewAMI.cpp b/cpp/test/Ice/operations/OnewaysNewAMI.cpp
index c8f6517edb6..81c94753bb6 100644
--- a/cpp/test/Ice/operations/OnewaysNewAMI.cpp
+++ b/cpp/test/Ice/operations/OnewaysNewAMI.cpp
@@ -65,10 +65,6 @@ public:
{
}
- void opByte(Ice::Byte b, Ice::Byte b1)
- {
- }
-
void sent(bool)
{
called();
diff --git a/cpp/test/Ice/slicing/objects/Test.ice b/cpp/test/Ice/slicing/objects/Test.ice
index c8e4a27fbba..6397c434802 100644
--- a/cpp/test/Ice/slicing/objects/Test.ice
+++ b/cpp/test/Ice/slicing/objects/Test.ice
@@ -67,7 +67,7 @@ exception DerivedException extends BaseException
D1 pd1;
};
-class Forward; // Forward-declared class defined in another compilation unit
+class Forward; /* Forward-declared class defined in another compilation unit */
["ami"] interface TestIntf
{