summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Ice/Outgoing.h2
-rw-r--r--cpp/include/Ice/OutgoingAsync.h6
-rw-r--r--cpp/include/Ice/Proxy.h158
-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
11 files changed, 328 insertions, 164 deletions
diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h
index 4e912b19bb5..c064ef5d5ea 100644
--- a/cpp/include/Ice/Outgoing.h
+++ b/cpp/include/Ice/Outgoing.h
@@ -61,7 +61,7 @@ class ICE_API Outgoing : private IceUtil::noncopyable, public IceUtil::Monitor<I
{
public:
- Outgoing(Ice::ConnectionI*, Reference*, const std::string&, Ice::OperationMode, const Ice::Context&, bool);
+ Outgoing(Ice::ConnectionI*, Reference*, const std::string&, Ice::OperationMode, const Ice::Context*, bool);
bool invoke(); // Returns true if ok, false if user exception.
void abort(const Ice::LocalException&);
diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h
index 6fa3e254be9..7d8bbfde12f 100644
--- a/cpp/include/Ice/OutgoingAsync.h
+++ b/cpp/include/Ice/OutgoingAsync.h
@@ -40,7 +40,7 @@ public:
protected:
- void __prepare(const Ice::ObjectPrx&, const std::string&, Ice::OperationMode, const Ice::Context&);
+ void __prepare(const Ice::ObjectPrx&, const std::string&, Ice::OperationMode, const Ice::Context*);
void __send();
virtual void __response(bool) = 0;
@@ -76,7 +76,7 @@ public:
virtual void ice_exception(const Ice::Exception&) = 0;
void __invoke(const Ice::ObjectPrx&, const std::string& operation, OperationMode,
- const std::vector<Ice::Byte>&, const Context&);
+ const std::vector<Ice::Byte>&, const Context*);
protected:
@@ -91,7 +91,7 @@ public:
virtual void ice_exception(const Ice::Exception&) = 0;
void __invoke(const Ice::ObjectPrx&, const std::string& operation, OperationMode,
- const std::pair<const Byte*, const Byte*>&, const Context&);
+ const std::pair<const Byte*, const Byte*>&, const Context*);
protected:
diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h
index 556f2e3adb0..408858bb89b 100644
--- a/cpp/include/Ice/Proxy.h
+++ b/cpp/include/Ice/Proxy.h
@@ -91,25 +91,76 @@ public:
::std::string ice_toString() const;
- bool ice_isA(const ::std::string&);
- bool ice_isA(const ::std::string&, const ::Ice::Context&);
- void ice_ping();
- void ice_ping(const ::Ice::Context&);
- ::std::vector< ::std::string> ice_ids();
- ::std::vector< ::std::string> ice_ids(const ::Ice::Context&);
- ::std::string ice_id();
- ::std::string ice_id(const ::Ice::Context&);
+ bool ice_isA(const ::std::string& typeId)
+ {
+ return ice_isA(typeId, 0);
+ }
+ bool ice_isA(const ::std::string& typeId, const ::Ice::Context& context)
+ {
+ return ice_isA(typeId, &context);
+ }
+
+ void ice_ping()
+ {
+ ice_ping(0);
+ }
+ void ice_ping(const ::Ice::Context& context)
+ {
+ ice_ping(&context);
+ }
+
+ ::std::vector< ::std::string> ice_ids()
+ {
+ return ice_ids(0);
+ }
+ ::std::vector< ::std::string> ice_ids(const ::Ice::Context& context)
+ {
+ return ice_ids(&context);
+ }
+
+ ::std::string ice_id()
+ {
+ return ice_id(0);
+ }
+ ::std::string ice_id(const ::Ice::Context& context)
+ {
+ return ice_id(&context);
+ }
// Returns true if ok, false if user exception.
- bool ice_invoke(const ::std::string&, ::Ice::OperationMode, const ::std::vector< ::Ice::Byte>&,
- ::std::vector< ::Ice::Byte>&);
- bool ice_invoke(const ::std::string&, ::Ice::OperationMode, const ::std::vector< ::Ice::Byte>&,
- ::std::vector< ::Ice::Byte>&, const ::Ice::Context&);
- bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&, ::std::vector< ::Ice::Byte>&);
- bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&, ::std::vector< ::Ice::Byte>&,
- const ::Ice::Context&);
+ bool ice_invoke(const ::std::string& operation,
+ ::Ice::OperationMode mode,
+ const ::std::vector< ::Ice::Byte>& inParams,
+ ::std::vector< ::Ice::Byte>& outParams)
+ {
+ const ::Ice::Context* context = 0;
+ return ice_invoke(operation, mode, inParams, outParams, context);
+ }
+ bool ice_invoke(const ::std::string& operation,
+ ::Ice::OperationMode mode,
+ const ::std::vector< ::Ice::Byte>& inParams,
+ ::std::vector< ::Ice::Byte>& outParams,
+ const ::Ice::Context& context)
+ {
+ return ice_invoke(operation, mode, inParams, outParams, &context);
+ }
+ bool ice_invoke(const ::std::string& operation,
+ ::Ice::OperationMode mode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
+ ::std::vector< ::Ice::Byte>& outParams)
+ {
+ const ::Ice::Context* context = 0;
+ return ice_invoke(operation, mode, inParams, outParams, context);
+ }
+ bool ice_invoke(const ::std::string& operation,
+ ::Ice::OperationMode mode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
+ ::std::vector< ::Ice::Byte>& outParams,
+ const ::Ice::Context& context)
+ {
+ return ice_invoke(operation, mode, inParams, outParams, &context);
+ }
+
void ice_invoke_async(const ::Ice::AMI_Object_ice_invokePtr&, const ::std::string&, ::Ice::OperationMode,
const ::std::vector< ::Ice::Byte>&);
void ice_invoke_async(const ::Ice::AMI_Object_ice_invokePtr&, const ::std::string&, ::Ice::OperationMode,
@@ -195,10 +246,25 @@ protected:
virtual ::IceInternal::Handle< ::IceDelegateM::Ice::Object> __createDelegateM();
virtual ::IceInternal::Handle< ::IceDelegateD::Ice::Object> __createDelegateD();
- const ::Ice::Context& __defaultContext() const;
-
private:
+ bool ice_isA(const ::std::string&, const ::Ice::Context*);
+ void ice_ping(const ::Ice::Context*);
+ ::std::vector< ::std::string> ice_ids(const ::Ice::Context*);
+ ::std::string ice_id(const ::Ice::Context*);
+
+
+ bool ice_invoke(const ::std::string&,
+ ::Ice::OperationMode,
+ const ::std::vector< ::Ice::Byte>&,
+ ::std::vector< ::Ice::Byte>&,
+ const ::Ice::Context*);
+ bool ice_invoke(const ::std::string&,
+ ::Ice::OperationMode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
+ ::std::vector< ::Ice::Byte>&,
+ const ::Ice::Context*);
+
void setup(const ::IceInternal::ReferencePtr&);
friend class ::IceInternal::ProxyFactory;
@@ -217,13 +283,13 @@ class ICE_API Object : public ::IceUtil::Shared
{
public:
- virtual bool ice_isA(const ::std::string&, const ::Ice::Context&) = 0;
- virtual void ice_ping(const ::Ice::Context&) = 0;
- virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context&) = 0;
- virtual ::std::string ice_id(const ::Ice::Context&) = 0;
+ virtual bool ice_isA(const ::std::string&, const ::Ice::Context*) = 0;
+ virtual void ice_ping(const ::Ice::Context*) = 0;
+ virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context*) = 0;
+ virtual ::std::string ice_id(const ::Ice::Context*) = 0;
virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- ::std::vector< ::Ice::Byte>&, const ::Ice::Context&) = 0;
+ ::std::vector< ::Ice::Byte>&, const ::Ice::Context*) = 0;
virtual ::Ice::ConnectionIPtr __getConnection(bool&) const = 0;
};
@@ -239,13 +305,13 @@ public:
virtual ~Object();
- virtual bool ice_isA(const ::std::string&, const ::Ice::Context&);
- virtual void ice_ping(const ::Ice::Context&);
- virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context&);
- virtual ::std::string ice_id(const ::Ice::Context&);
+ virtual bool ice_isA(const ::std::string&, const ::Ice::Context*);
+ virtual void ice_ping(const ::Ice::Context*);
+ virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context*);
+ virtual ::std::string ice_id(const ::Ice::Context*);
virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- ::std::vector< ::Ice::Byte>&, const ::Ice::Context&);
+ ::std::vector< ::Ice::Byte>&, const ::Ice::Context*);
virtual ::Ice::ConnectionIPtr __getConnection(bool&) const;
@@ -272,13 +338,13 @@ class ICE_API Object : virtual public ::IceDelegate::Ice::Object
{
public:
- virtual bool ice_isA(const ::std::string&, const ::Ice::Context&);
- virtual void ice_ping(const ::Ice::Context&);
- virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context&);
- virtual ::std::string ice_id(const ::Ice::Context&);
+ virtual bool ice_isA(const ::std::string&, const ::Ice::Context*);
+ virtual void ice_ping(const ::Ice::Context*);
+ virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context*);
+ virtual ::std::string ice_id(const ::Ice::Context*);
virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- ::std::vector< ::Ice::Byte>&, const ::Ice::Context&);
+ ::std::vector< ::Ice::Byte>&, const ::Ice::Context*);
virtual ::Ice::ConnectionIPtr __getConnection(bool&) const;
@@ -289,7 +355,7 @@ protected:
::IceInternal::ReferencePtr __reference;
::Ice::ObjectAdapterPtr __adapter;
- void __initCurrent(::Ice::Current&, const ::std::string&, ::Ice::OperationMode, const ::Ice::Context&);
+ void __initCurrent(::Ice::Current&, const ::std::string&, ::Ice::OperationMode, const ::Ice::Context*);
private:
@@ -371,7 +437,7 @@ checkedCastImpl(const ::Ice::ObjectPrx& b)
}
template<typename P> P
-checkedCastImpl(const ::Ice::ObjectPrx& b, const ::Ice::Context& ctx)
+checkedCastImpl(const ::Ice::ObjectPrx& b, const ::Ice::Context& context)
{
P d = 0;
if(b.get())
@@ -379,7 +445,7 @@ checkedCastImpl(const ::Ice::ObjectPrx& b, const ::Ice::Context& ctx)
typedef typename P::element_type T;
d = dynamic_cast<T*>(b.get());
- if(!d && b->ice_isA(T::ice_staticId(), ctx))
+ if(!d && b->ice_isA(T::ice_staticId(), context))
{
d = new T;
d->__copyFrom(b);
@@ -429,9 +495,9 @@ checkedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::string&
}
template<> inline ::Ice::ObjectPrx
-checkedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& ctx)
+checkedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& context)
{
- return checkedCastImpl(b, f, "::Ice::Object", ctx);
+ return checkedCastImpl(b, f, "::Ice::Object", context);
}
template<> inline ::Ice::ObjectPrx
@@ -462,12 +528,12 @@ checkedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f)
}
template<typename P> P
-checkedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& ctx)
+checkedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& context)
{
P d = 0;
typedef typename P::element_type T;
- ::Ice::ObjectPrx bb = checkedCastImpl(b, f, T::ice_staticId(), ctx);
+ ::Ice::ObjectPrx bb = checkedCastImpl(b, f, T::ice_staticId(), context);
if(bb)
{
@@ -509,13 +575,13 @@ checkedCast(const ::IceInternal::ProxyHandle<Y>& b)
}
template<typename P, typename Y> inline P
-checkedCast(const ::IceInternal::ProxyHandle<Y>& b, const ::Ice::Context& ctx)
+checkedCast(const ::IceInternal::ProxyHandle<Y>& b, const ::Ice::Context& context)
{
Y* tag = 0;
#if defined(_MSC_VER) && (_MSC_VER < 1300)
- return ::IceInternal::checkedCastHelper<P::element_type>(b, tag, ctx);
+ return ::IceInternal::checkedCastHelper<P::element_type>(b, tag, context);
#else
- return ::IceInternal::checkedCastHelper<typename P::element_type>(b, tag, ctx);
+ return ::IceInternal::checkedCastHelper<typename P::element_type>(b, tag, context);
#endif
}
@@ -537,9 +603,9 @@ checkedCast(const ::Ice::ObjectPrx& b, const std::string& f)
}
template<typename P> inline P
-checkedCast(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& ctx)
+checkedCast(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& context)
{
- return ::IceInternal::checkedCastImpl<P>(b, f, ctx);
+ return ::IceInternal::checkedCastImpl<P>(b, f, context);
}
template<typename P> inline P
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"))
{