summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/PythonUtil.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2004-09-09 23:55:10 +0000
committerMark Spruiell <mes@zeroc.com>2004-09-09 23:55:10 +0000
commita4a36a6efef6b7e41efd679c263dbd64d84afa8b (patch)
tree318716db29e4cdd341464afc051023ab89b1534e /cpp/src/Slice/PythonUtil.cpp
parentdisable use of tabs in Python output (diff)
downloadice-a4a36a6efef6b7e41efd679c263dbd64d84afa8b.tar.bz2
ice-a4a36a6efef6b7e41efd679c263dbd64d84afa8b.tar.xz
ice-a4a36a6efef6b7e41efd679c263dbd64d84afa8b.zip
support for new operation definition
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r--cpp/src/Slice/PythonUtil.cpp39
1 files changed, 15 insertions, 24 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp
index 0a6b97a83dc..3a1330eeb74 100644
--- a/cpp/src/Slice/PythonUtil.cpp
+++ b/cpp/src/Slice/PythonUtil.cpp
@@ -301,7 +301,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
}
_out << ", ctx=None):";
_out.inc();
- _out << nl << "return self.ice_operation('" << (*oli)->name() << "', '" << scoped << "', (" << inParams;
+ _out << nl << "return _M_" << fixedScoped << "._op_" << (*oli)->name() << ".invoke(self, (" << inParams;
if(!inParams.empty())
{
_out << ", ";
@@ -458,7 +458,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
{
DataMemberList members = p->dataMembers();
_out << sp << nl << "IcePy.defineClass('" << scoped << "', " << fixedName << ", ";
- _out << (p->isInterface() ? "True" : "False") << ", '" << baseScoped << "', (";
+ _out << (p->isAbstract() ? "True" : "False") << ", '" << baseScoped << "', (";
//
// InterfaceIds
//
@@ -513,40 +513,37 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out.dec();
_out << nl;
}
- _out << "), {";
- //
- // OperationDict
+ _out << "))";
+
//
- // Each operation in OperationDict is described as follows:
+ // Define each operation. The arguments to the IcePy.Operation constructor are:
//
- // 'opName': (Mode, (InParams), (OutParams), ReturnType, (Exceptions))
+ // 'opName', Mode, (InParams), (OutParams), ReturnType, (Exceptions)
//
// where InParams and OutParams are tuples of type descriptions, and Exceptions
- // is a tuple of Python exception types.
+ // is a tuple of exception type ids.
//
- _out.inc();
+ if(!ops.empty())
+ {
+ _out << sp;
+ }
for(OperationList::iterator s = ops.begin(); s != ops.end(); ++s)
{
ParamDeclList params = (*s)->parameters();
ParamDeclList::iterator t;
int count;
- if(s != ops.begin())
- {
- _out << ',';
- }
-
- _out << nl << "'" << (*s)->name() << "': (";
+ _out << nl << fixedName << "._op_" << (*s)->name() << " = IcePy.Operation('" << (*s)->name() << "', ";
switch((*s)->mode())
{
case Operation::Normal:
- _out << "IcePy.OP_NORMAL";
+ _out << "Ice.OperationMode.Normal";
break;
case Operation::Nonmutating:
- _out << "IcePy.OP_NONMUTATING";
+ _out << "Ice.OperationMode.Nonmutating";
break;
case Operation::Idempotent:
- _out << "IcePy.OP_IDEMPOTENT";
+ _out << "Ice.OperationMode.Idempotent";
break;
}
_out << ", (";
@@ -609,12 +606,6 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
}
_out << "))";
}
- _out.dec();
- if(!ops.empty())
- {
- _out << nl;
- }
- _out << "})";
}
registerName(fixedName);