summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2006-10-23 18:33:30 +0000
committerBernard Normier <bernard@zeroc.com>2006-10-23 18:33:30 +0000
commit5f9595c9ed69ddb8e10c848656db9d76b2b32b52 (patch)
tree9924a667b4c38de117dc9dfcb55d4bd640715354 /cpp/src
parentminor edits (diff)
downloadice-5f9595c9ed69ddb8e10c848656db9d76b2b32b52.tar.bz2
ice-5f9595c9ed69ddb8e10c848656db9d76b2b32b52.tar.xz
ice-5f9595c9ed69ddb8e10c848656db9d76b2b32b52.zip
More implicit context; changed proxy generated code
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/ImplicitContextI.cpp58
-rw-r--r--cpp/src/Ice/ImplicitContextI.h10
-rw-r--r--cpp/src/Ice/Outgoing.cpp32
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp36
-rw-r--r--cpp/src/Ice/PropertyNames.cpp3
-rw-r--r--cpp/src/Ice/PropertyNames.h2
-rw-r--r--cpp/src/Ice/Proxy.cpp140
-rw-r--r--cpp/src/slice2cpp/Gen.cpp45
8 files changed, 212 insertions, 114 deletions
diff --git a/cpp/src/Ice/ImplicitContextI.cpp b/cpp/src/Ice/ImplicitContextI.cpp
index e5d82c62bf0..ab57af890d9 100644
--- a/cpp/src/Ice/ImplicitContextI.cpp
+++ b/cpp/src/Ice/ImplicitContextI.cpp
@@ -29,8 +29,10 @@ public:
virtual void remove(const string&);
virtual void write(const Context&, ::IceInternal::BasicStream*) const;
+ virtual void write(const Context&, Context&) const;
protected:
+
Context _context;
};
@@ -47,8 +49,10 @@ public:
virtual void remove(const string&);
virtual void write(const Context&, ::IceInternal::BasicStream*) const;
+ virtual void write(const Context&, Context&) const;
private:
+
IceUtil::Mutex _mutex;
};
@@ -68,6 +72,7 @@ public:
virtual void remove(const string&);
virtual void write(const Context&, ::IceInternal::BasicStream*) const;
+ virtual void write(const Context&, Context&) const;
static void threadDestructor(void*);
@@ -204,6 +209,24 @@ SharedImplicitContextWithoutLocking::write(const Context& proxyCtx, ::IceInterna
}
}
+void
+SharedImplicitContextWithoutLocking::write(const Context& proxyCtx, Context& ctx) const
+{
+ if(proxyCtx.size() == 0)
+ {
+ ctx = _context;
+ }
+ else if(_context.size() == 0)
+ {
+ ctx = proxyCtx;
+ }
+ else
+ {
+ ctx = proxyCtx;
+ ctx.insert(_context.begin(), _context.end());
+ }
+
+}
//
// SharedImplicitContext implementation
@@ -273,6 +296,13 @@ SharedImplicitContext::write(const Context& proxyCtx, ::IceInternal::BasicStream
}
}
+void
+SharedImplicitContext::write(const Context& proxyCtx, Context& ctx) const
+{
+ IceUtil::Mutex::Lock lock(_mutex);
+ SharedImplicitContextWithoutLocking::write(proxyCtx, ctx);
+}
+
//
// PerThreadImplicitContext implementation
//
@@ -496,20 +526,40 @@ PerThreadImplicitContext::remove(const string& k)
void
PerThreadImplicitContext::write(const Context& proxyCtx, ::IceInternal::BasicStream* s) const
{
- Context* ctx = getThreadContext(false);
+ Context* threadCtx = getThreadContext(false);
- if(ctx == 0 || ctx->size() == 0)
+ if(threadCtx == 0 || threadCtx->size() == 0)
{
__write(s, proxyCtx, __U__Context());
}
else if(proxyCtx.size() == 0)
{
- __write(s, *ctx, __U__Context());
+ __write(s, *threadCtx, __U__Context());
}
else
{
Context combined = proxyCtx;
- combined.insert(ctx->begin(), ctx->end());
+ combined.insert(threadCtx->begin(), threadCtx->end());
__write(s, combined, __U__Context());
}
}
+
+void
+PerThreadImplicitContext::write(const Context& proxyCtx, Context& ctx) const
+{
+ Context* threadCtx = getThreadContext(false);
+
+ if(threadCtx == 0 || threadCtx->size() == 0)
+ {
+ ctx = proxyCtx;
+ }
+ else if(proxyCtx.size() == 0)
+ {
+ ctx = *threadCtx;
+ }
+ else
+ {
+ ctx = proxyCtx;
+ ctx.insert(threadCtx->begin(), threadCtx->end());
+ }
+}
diff --git a/cpp/src/Ice/ImplicitContextI.h b/cpp/src/Ice/ImplicitContextI.h
index 5583b377d2c..8f20828eb19 100644
--- a/cpp/src/Ice/ImplicitContextI.h
+++ b/cpp/src/Ice/ImplicitContextI.h
@@ -9,7 +9,6 @@
#ifndef ICE_IMPLICIT_CONTEXT_I_H
#define ICE_IMPLICIT_CONTEXT_I_H
-#endif
#include <Ice/ImplicitContext.h>
@@ -36,8 +35,17 @@ public:
// the underlying context)
//
virtual void write(const Context&, ::IceInternal::BasicStream*) const = 0;
+
+ //
+ // Writes the underlying context plus the given context
+ // (entries in the given context overwrite entries in
+ // the underlying context)
+ //
+ virtual void write(const Context&, Context&) const = 0;
+
};
typedef IceInternal::Handle<ImplicitContextI> ImplicitContextIPtr;
}
+#endif
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index f14425f5a21..3f90b1a9668 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -14,6 +14,7 @@
#include <Ice/Endpoint.h>
#include <Ice/LocalException.h>
#include <Ice/Protocol.h>
+#include <Ice/Instance.h>
using namespace std;
using namespace Ice;
@@ -45,7 +46,7 @@ IceInternal::LocalExceptionWrapper::retry() const
}
IceInternal::Outgoing::Outgoing(ConnectionI* connection, Reference* ref, const string& operation,
- OperationMode mode, const Context& context, bool compress) :
+ OperationMode mode, const Context* context, bool compress) :
_connection(connection),
_reference(ref),
_state(StateUnsent),
@@ -92,12 +93,31 @@ IceInternal::Outgoing::Outgoing(ConnectionI* connection, Reference* ref, const s
_os.write(static_cast<Byte>(mode));
- _os.writeSize(Int(context.size()));
- Context::const_iterator p;
- for(p = context.begin(); p != context.end(); ++p)
+ if(context != 0)
{
- _os.write(p->first);
- _os.write(p->second);
+ //
+ // Explicit context
+ //
+ __write(&_os, *context, __U__Context());
+ }
+ else
+ {
+ //
+ // Implicit context
+ //
+ const ImplicitContextIPtr& implicitContext =
+ _reference->getInstance()->getImplicitContext();
+
+ const Context& prxContext = _reference->getContext()->getValue();
+
+ if(implicitContext == 0)
+ {
+ __write(&_os, prxContext, __U__Context());
+ }
+ else
+ {
+ implicitContext->write(prxContext, &_os);
+ }
}
//
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index 2798bf41cb7..103cd6ac864 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -20,6 +20,7 @@
#include <Ice/RouterInfo.h>
#include <Ice/Outgoing.h> // For LocalExceptionWrapper.
#include <Ice/Protocol.h>
+#include <Ice/ImplicitContextI.h>
using namespace std;
using namespace Ice;
@@ -258,7 +259,7 @@ IceInternal::OutgoingAsync::__finished(const LocalException& exc)
void
IceInternal::OutgoingAsync::__prepare(const ObjectPrx& prx, const string& operation, OperationMode mode,
- const Context& context)
+ const Context* context)
{
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(_monitor);
@@ -308,12 +309,31 @@ IceInternal::OutgoingAsync::__prepare(const ObjectPrx& prx, const string& operat
__os->write(static_cast<Byte>(_mode));
- __os->writeSize(Int(context.size()));
- Context::const_iterator p;
- for(p = context.begin(); p != context.end(); ++p)
+ if(context != 0)
{
- __os->write(p->first);
- __os->write(p->second);
+ //
+ // Explicit context
+ //
+ __write(__os, *context, __U__Context());
+ }
+ else
+ {
+ //
+ // Implicit context
+ //
+ const ImplicitContextIPtr& implicitContext =
+ ref->getInstance()->getImplicitContext();
+
+ const Context& prxContext = ref->getContext()->getValue();
+
+ if(implicitContext == 0)
+ {
+ __write(__os, prxContext, __U__Context());
+ }
+ else
+ {
+ implicitContext->write(prxContext, __os);
+ }
}
__os->startWriteEncaps();
@@ -423,7 +443,7 @@ IceInternal::OutgoingAsync::cleanup()
void
Ice::AMI_Object_ice_invoke::__invoke(const ObjectPrx& prx, const string& operation, OperationMode mode,
- const vector<Byte>& inParams, const Context& context)
+ const vector<Byte>& inParams, const Context* context)
{
try
{
@@ -458,7 +478,7 @@ Ice::AMI_Object_ice_invoke::__response(bool ok) // ok == true means no user exce
void
Ice::AMI_Array_Object_ice_invoke::__invoke(const ObjectPrx& prx, const string& operation, OperationMode mode,
- const pair<const Byte*, const Byte*>& inParams, const Context& context)
+ const pair<const Byte*, const Byte*>& inParams, const Context* context)
{
try
{
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp
index 3cca38b66be..8ca00ea2c46 100644
--- a/cpp/src/Ice/PropertyNames.cpp
+++ b/cpp/src/Ice/PropertyNames.cpp
@@ -7,7 +7,7 @@
//
// **********************************************************************
-// Generated by makeprops.py from file `../config/PropertyNames.def', Fri Sep 15 17:25:44 2006
+// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Oct 23 14:26:48 2006
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -28,6 +28,7 @@ const char* IceInternal::PropertyNames::IceProps[] =
"Ice.Default.Protocol",
"Ice.Default.Router",
"Ice.GC.Interval",
+ "Ice.ImplicitContext",
"Ice.InitPlugins",
"Ice.Logger.Timestamp",
"Ice.MemoryPool",
diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h
index ce3737d12f1..d840d362c93 100644
--- a/cpp/src/Ice/PropertyNames.h
+++ b/cpp/src/Ice/PropertyNames.h
@@ -7,7 +7,7 @@
//
// **********************************************************************
-// Generated by makeprops.py from file `../config/PropertyNames.def', Fri Sep 15 17:25:44 2006
+// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Oct 23 14:26:48 2006
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index 9e80995c9b9..f0cc77ca80e 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -24,6 +24,7 @@
#include <Ice/LocalException.h>
#include <Ice/ConnectionI.h> // To convert from ConnectionIPtr to ConnectionPtr in ice_connection().
#include <Ice/Stream.h>
+#include <Ice/ImplicitContextI.h>
using namespace std;
using namespace Ice;
@@ -77,7 +78,7 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string&
}
::Ice::ObjectPrx
-IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string& typeId, const Context& ctx)
+IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string& typeId, const Context& context)
{
//
// COMPILERBUG: Without this work-around, release VC7.0 build crash
@@ -92,7 +93,7 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string&
ObjectPrx bb = b->ice_facet(f);
try
{
- if(bb->ice_isA(typeId, ctx))
+ if(bb->ice_isA(typeId, context))
{
return bb;
}
@@ -158,14 +159,9 @@ IceProxy::Ice::Object::ice_toString() const
return _reference->toString();
}
-bool
-IceProxy::Ice::Object::ice_isA(const string& __id)
-{
- return ice_isA(__id, _reference->getContext()->getValue());
-}
bool
-IceProxy::Ice::Object::ice_isA(const string& __id, const Context& __context)
+IceProxy::Ice::Object::ice_isA(const string& typeId, const Context* context)
{
int __cnt = 0;
while(true)
@@ -174,7 +170,7 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context& __context)
{
__checkTwowayOnly("ice_isA");
Handle< ::IceDelegate::Ice::Object> __del = __getDelegate();
- return __del->ice_isA(__id, __context);
+ return __del->ice_isA(typeId, context);
}
catch(const LocalExceptionWrapper& __ex)
{
@@ -188,13 +184,7 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context& __context)
}
void
-IceProxy::Ice::Object::ice_ping()
-{
- ice_ping(_reference->getContext()->getValue());
-}
-
-void
-IceProxy::Ice::Object::ice_ping(const Context& __context)
+IceProxy::Ice::Object::ice_ping(const Context* context)
{
int __cnt = 0;
while(true)
@@ -202,7 +192,7 @@ IceProxy::Ice::Object::ice_ping(const Context& __context)
try
{
Handle< ::IceDelegate::Ice::Object> __del = __getDelegate();
- __del->ice_ping(__context);
+ __del->ice_ping(context);
return;
}
catch(const LocalExceptionWrapper& __ex)
@@ -217,13 +207,7 @@ IceProxy::Ice::Object::ice_ping(const Context& __context)
}
vector<string>
-IceProxy::Ice::Object::ice_ids()
-{
- return ice_ids(_reference->getContext()->getValue());
-}
-
-vector<string>
-IceProxy::Ice::Object::ice_ids(const Context& __context)
+IceProxy::Ice::Object::ice_ids(const Context* context)
{
int __cnt = 0;
while(true)
@@ -232,7 +216,7 @@ IceProxy::Ice::Object::ice_ids(const Context& __context)
{
__checkTwowayOnly("ice_ids");
Handle< ::IceDelegate::Ice::Object> __del = __getDelegate();
- return __del->ice_ids(__context);
+ return __del->ice_ids(context);
}
catch(const LocalExceptionWrapper& __ex)
{
@@ -246,13 +230,7 @@ IceProxy::Ice::Object::ice_ids(const Context& __context)
}
string
-IceProxy::Ice::Object::ice_id()
-{
- return ice_id(_reference->getContext()->getValue());
-}
-
-string
-IceProxy::Ice::Object::ice_id(const Context& __context)
+IceProxy::Ice::Object::ice_id(const Context* context)
{
int __cnt = 0;
while(true)
@@ -261,7 +239,7 @@ IceProxy::Ice::Object::ice_id(const Context& __context)
{
__checkTwowayOnly("ice_id");
Handle< ::IceDelegate::Ice::Object> __del = __getDelegate();
- return __del->ice_id(__context);
+ return __del->ice_id(context);
}
catch(const LocalExceptionWrapper& __ex)
{
@@ -274,21 +252,13 @@ IceProxy::Ice::Object::ice_id(const Context& __context)
}
}
-bool
-IceProxy::Ice::Object::ice_invoke(const string& operation,
- OperationMode mode,
- const vector<Byte>& inParams,
- vector<Byte>& outParams)
-{
- return ice_invoke(operation, mode, inParams, outParams, _reference->getContext()->getValue());
-}
bool
IceProxy::Ice::Object::ice_invoke(const string& operation,
OperationMode mode,
const vector<Byte>& inParams,
vector<Byte>& outParams,
- const Context& context)
+ const Context* context)
{
pair<const Byte*, const Byte*> inPair;
if(inParams.size() == 0)
@@ -303,21 +273,13 @@ IceProxy::Ice::Object::ice_invoke(const string& operation,
return ice_invoke(operation, mode, inPair, outParams, context);
}
-bool
-IceProxy::Ice::Object::ice_invoke(const string& operation,
- OperationMode mode,
- const pair<const Byte*, const Byte*>& inParams,
- vector<Byte>& outParams)
-{
- return ice_invoke(operation, mode, inParams, outParams, _reference->getContext()->getValue());
-}
bool
IceProxy::Ice::Object::ice_invoke(const string& operation,
OperationMode mode,
const pair<const Byte*, const Byte*>& inParams,
vector<Byte>& outParams,
- const Context& context)
+ const Context* context)
{
int __cnt = 0;
while(true)
@@ -352,7 +314,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb,
OperationMode mode,
const vector<Byte>& inParams)
{
- ice_invoke_async(cb, operation, mode, inParams, _reference->getContext()->getValue());
+ cb->__invoke(this, operation, mode, inParams, 0);
}
void
@@ -362,7 +324,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb,
const vector<Byte>& inParams,
const Context& context)
{
- cb->__invoke(this, operation, mode, inParams, context);
+ cb->__invoke(this, operation, mode, inParams, &context);
}
void
@@ -371,7 +333,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Array_Object_ice_invokePtr& cb
OperationMode mode,
const pair<const Byte*, const Byte*>& inParams)
{
- ice_invoke_async(cb, operation, mode, inParams, _reference->getContext()->getValue());
+ cb->__invoke(this, operation, mode, inParams, 0);
}
void
@@ -381,7 +343,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Array_Object_ice_invokePtr& cb
const pair<const Byte*, const Byte*>& inParams,
const Context& context)
{
- cb->__invoke(this, operation, mode, inParams, context);
+ cb->__invoke(this, operation, mode, inParams, &context);
}
Identity
@@ -1087,12 +1049,6 @@ IceProxy::Ice::Object::__createDelegateD()
return Handle< ::IceDelegateD::Ice::Object>(new ::IceDelegateD::Ice::Object);
}
-const Context&
-IceProxy::Ice::Object::__defaultContext() const
-{
- return _reference->getContext()->getValue();
-}
-
void
IceProxy::Ice::Object::setup(const ReferencePtr& ref)
{
@@ -1112,10 +1068,10 @@ IceDelegateM::Ice::Object::~Object()
}
bool
-IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context)
+IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context* context)
{
static const string __operation("ice_isA");
- Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context, __compress);
+ Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, context, __compress);
try
{
BasicStream* __os = __og.os();
@@ -1151,10 +1107,10 @@ IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context)
}
void
-IceDelegateM::Ice::Object::ice_ping(const Context& __context)
+IceDelegateM::Ice::Object::ice_ping(const Context* context)
{
static const string __operation("ice_ping");
- Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context, __compress);
+ Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, context, __compress);
bool __ok = __og.invoke();
try
{
@@ -1178,10 +1134,10 @@ IceDelegateM::Ice::Object::ice_ping(const Context& __context)
}
vector<string>
-IceDelegateM::Ice::Object::ice_ids(const Context& __context)
+IceDelegateM::Ice::Object::ice_ids(const Context* context)
{
static const string __operation("ice_ids");
- Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context, __compress);
+ Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, context, __compress);
vector<string> __ret;
bool __ok = __og.invoke();
try
@@ -1208,10 +1164,10 @@ IceDelegateM::Ice::Object::ice_ids(const Context& __context)
}
string
-IceDelegateM::Ice::Object::ice_id(const Context& __context)
+IceDelegateM::Ice::Object::ice_id(const Context* context)
{
static const string __operation("ice_id");
- Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context, __compress);
+ Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, context, __compress);
string __ret;
bool __ok = __og.invoke();
try
@@ -1242,7 +1198,7 @@ IceDelegateM::Ice::Object::ice_invoke(const string& operation,
OperationMode mode,
const pair<const Byte*, const Byte*>& inParams,
vector<Byte>& outParams,
- const Context& context)
+ const Context* context)
{
Outgoing __og(__connection.get(), __reference.get(), operation, mode, context, __compress);
try
@@ -1315,10 +1271,10 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& ref)
}
bool
-IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context& __context)
+IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context* context)
{
Current __current;
- __initCurrent(__current, "ice_isA", ::Ice::Nonmutating, __context);
+ __initCurrent(__current, "ice_isA", ::Ice::Nonmutating, context);
while(true)
{
Direct __direct(__current);
@@ -1328,10 +1284,10 @@ IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context& __context)
}
void
-IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context& __context)
+IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context* context)
{
Current __current;
- __initCurrent(__current, "ice_ping", ::Ice::Nonmutating, __context);
+ __initCurrent(__current, "ice_ping", ::Ice::Nonmutating, context);
while(true)
{
Direct __direct(__current);
@@ -1341,10 +1297,10 @@ IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context& __context)
}
vector<string>
-IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context& __context)
+IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context* context)
{
Current __current;
- __initCurrent(__current, "ice_ids", ::Ice::Nonmutating, __context);
+ __initCurrent(__current, "ice_ids", ::Ice::Nonmutating, context);
while(true)
{
Direct __direct(__current);
@@ -1354,10 +1310,10 @@ IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context& __context)
}
string
-IceDelegateD::Ice::Object::ice_id(const ::Ice::Context& __context)
+IceDelegateD::Ice::Object::ice_id(const ::Ice::Context* context)
{
Current __current;
- __initCurrent(__current, "ice_id", ::Ice::Nonmutating, __context);
+ __initCurrent(__current, "ice_id", ::Ice::Nonmutating, context);
while(true)
{
Direct __direct(__current);
@@ -1371,7 +1327,7 @@ IceDelegateD::Ice::Object::ice_invoke(const string&,
OperationMode,
const pair<const Byte*, const Byte*>& inParams,
vector<Byte>&,
- const Context&)
+ const Context*)
{
throw CollocationOptimizationException(__FILE__, __LINE__);
return false;
@@ -1406,14 +1362,36 @@ IceDelegateD::Ice::Object::__copyFrom(const ::IceInternal::Handle< ::IceDelegate
void
IceDelegateD::Ice::Object::__initCurrent(Current& current, const string& op, OperationMode mode,
- const Context& context)
+ const Context* context)
{
current.adapter = __adapter;
current.id = __reference->getIdentity();
current.facet = __reference->getFacet();
current.operation = op;
current.mode = mode;
- current.ctx = context;
+ if(context == 0)
+ {
+ //
+ // Implicit context
+ //
+ const ImplicitContextIPtr& implicitContext =
+ __reference->getInstance()->getImplicitContext();
+
+ const Context& prxContext = __reference->getContext()->getValue();
+
+ if(implicitContext == 0)
+ {
+ current.ctx = prxContext;
+ }
+ else
+ {
+ implicitContext->write(prxContext, current.ctx);
+ }
+ }
+ else
+ {
+ current.ctx = *context;
+ }
current.requestId = -1;
}
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index d554a2e8307..8919a5e9d69 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1850,11 +1850,29 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
H << "return ";
}
- H << fixKwd(name) << spar << args << "__defaultContext()" << epar << ';';
+ H << fixKwd(name) << spar << args << "0" << epar << ';';
H << eb;
- H << nl << retS << ' ' << fixKwd(name) << spar << params << "const ::Ice::Context&" << epar << ';';
+ H << nl << deprecateSymbol << retS << ' ' << fixKwd(name) << spar << paramsDecl << "const ::Ice::Context& __ctx" << epar;
+ H << sb;
+ H << nl;
+ if(ret)
+ {
+ H << "return ";
+ }
+ H << fixKwd(name) << spar << args << "&__ctx" << epar << ';';
+ H << eb;
+
+ H << nl;
+ H.dec();
+ H << nl << "private:";
+ H.inc();
+ H << sp << nl << retS << ' ' << fixKwd(name) << spar << params << "const ::Ice::Context*" << epar << ';';
+ H << nl;
+ H.dec();
+ H << nl << "public:";
+ H.inc();
- C << sp << nl << retS << nl << "IceProxy" << scoped << spar << paramsDecl << "const ::Ice::Context& __ctx" << epar;
+ C << sp << nl << retS << nl << "IceProxy" << scoped << spar << paramsDecl << "const ::Ice::Context* __ctx" << epar;
C << sb;
C << nl << "int __cnt = 0;";
C << nl << "while(true)";
@@ -1911,16 +1929,19 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
C << sp << nl << "void" << nl << "IceProxy" << scope << name << "_async" << spar
<< ("const " + classScopedAMI + '_' + name + "Ptr& __cb") << paramsDeclAMI << epar;
C << sb;
- C << nl << name << "_async" << spar << "__cb" << argsAMI << "__defaultContext()" << epar << ';';
+ C << nl << "__cb->__invoke" << spar << "this" << argsAMI << "0" << epar << ';';
C << eb;
C << sp << nl << "void" << nl << "IceProxy" << scope << name << "_async" << spar
<< ("const " + classScopedAMI + '_' + name + "Ptr& __cb") << paramsDeclAMI << "const ::Ice::Context& __ctx"
<< epar;
C << sb;
- C << nl << "__cb->__invoke" << spar << "this" << argsAMI << "__ctx" << epar << ';';
+ C << nl << "__cb->__invoke" << spar << "this" << argsAMI << "&__ctx" << epar << ';';
C << eb;
}
+
+
+
}
Slice::Gen::DelegateVisitor::DelegateVisitor(Output& h, Output& c, const string& dllExport) :
@@ -2055,7 +2076,7 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p)
params.push_back(typeString);
}
- params.push_back("const ::Ice::Context&");
+ params.push_back("const ::Ice::Context*");
H << sp << nl << "virtual " << retS << ' ' << name << spar << params << epar << " = 0;";
}
@@ -2196,8 +2217,8 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
paramsDecl.push_back(typeString + ' ' + paramName);
}
- params.push_back("const ::Ice::Context&");
- paramsDecl.push_back("const ::Ice::Context& __context");
+ params.push_back("const ::Ice::Context*");
+ paramsDecl.push_back("const ::Ice::Context* __context");
string flatName = p->flattenedScope() + p->name() + "_name";
@@ -2436,8 +2457,8 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
args.push_back(paramName);
}
- params.push_back("const ::Ice::Context&");
- paramsDecl.push_back("const ::Ice::Context& __context");
+ params.push_back("const ::Ice::Context*");
+ paramsDecl.push_back("const ::Ice::Context* __context");
args.push_back("__current");
ContainerPtr container = p->container();
@@ -4703,8 +4724,8 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
}
}
- paramsInvoke.push_back("const ::Ice::Context&");
- paramsDeclInvoke.push_back("const ::Ice::Context& __ctx");
+ paramsInvoke.push_back("const ::Ice::Context*");
+ paramsDeclInvoke.push_back("const ::Ice::Context* __ctx");
if(cl->hasMetaData("ami") || p->hasMetaData("ami"))
{