diff options
author | Michi Henning <michi@zeroc.com> | 2002-09-04 05:39:57 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2002-09-04 05:39:57 +0000 |
commit | a5da64185ba234ae8dfdec11764e1821bbc67a57 (patch) | |
tree | 4aa60640dbb0b01960e8aa644ef9179594e28b6d /cpp/src/slice2java/Gen.cpp | |
parent | fix (diff) | |
download | ice-a5da64185ba234ae8dfdec11764e1821bbc67a57.tar.bz2 ice-a5da64185ba234ae8dfdec11764e1821bbc67a57.tar.xz ice-a5da64185ba234ae8dfdec11764e1821bbc67a57.zip |
Changed Current.ice to use enum OperationMode to distinguish between
Normal, Nonmutating, and Idempotent operations. Fixed bug introduced
into Freeze with previous changes for saving object state. (State
wasn't saved for idempotent operations.) Retested everything. I'm
getting a failure in the Yellow (C++) tests, and another failure in the
IceBox (Java) tests, but I don't think these are related to these
changes.
Diffstat (limited to 'cpp/src/slice2java/Gen.cpp')
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index b84e18029a8..5f9ebb27a48 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -16,6 +16,39 @@ using namespace std; using namespace Slice; using namespace IceUtil; +namespace // anonymous +{ + +string +sliceModeToIceMode(const OperationPtr& op) +{ + string mode; + switch(op->mode()) + { + case Operation::Normal: + { + mode = "Ice.OperationMode.Normal"; + break; + } + case Operation::Nonmutating: + { + mode = "Ice.OperationMode.Nonmutating"; + break; + } + case Operation::Idempotent: + { + mode = "Ice.OperationMode.Idempotent"; + break; + } + default: + { + assert("Impossible operation mode!"); + break; + } + } + return mode; +} + Slice::JavaVisitor::JavaVisitor(const string& dir, const string& package) : JavaGenerator(dir, package) { @@ -2067,7 +2100,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << eb; out << nl << "catch(IceInternal.NonRepeatable __ex)"; out << sb; - if(op->idempotent()) + if(op->mode() == Operation::Idempotent || op->mode() == Operation::Nonmutating) { out << nl << "__cnt = __handleException(__ex.get(), __cnt);"; } @@ -3005,7 +3038,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; list<string> metaData = op->getMetaData(); out << nl << "IceInternal.Outgoing __out = getOutgoing(\"" << op->name() << "\", " - << (op->idempotent() ? "true" : "false") << ", __context);"; + << sliceModeToIceMode(op) << ", __context);"; out << nl << "try"; out << sb; if(!inParams.empty()) @@ -3109,6 +3142,8 @@ Slice::Gen::DelegateDVisitor::DelegateDVisitor(const string& dir, const string& { } +} + bool Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) { @@ -3170,8 +3205,8 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; list<string> metaData = op->getMetaData(); out << nl << "Ice.Current __current = new Ice.Current();"; - out << nl << "__initCurrent(__current, \"" << op->name() << "\", " << (op->idempotent() ? "true" : "false") - << ", __context);"; + out << nl << "__initCurrent(__current, \"" << op->name() << "\", " + << sliceModeToIceMode(op) << ", __context);"; out << nl << "while(true)"; out << sb; out << nl << "IceInternal.Direct __direct = new IceInternal.Direct(__adapter, __current);"; |