summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-12-01 18:31:27 +0000
committerMarc Laukien <marc@zeroc.com>2001-12-01 18:31:27 +0000
commitf579108c1ebffc9b6f720cbdb01712e17c0c1e36 (patch)
treef3a46b2f79e5b3273bb8442245074a7ed424d3f4 /cpp/src
parentbug fix (diff)
downloadice-f579108c1ebffc9b6f720cbdb01712e17c0c1e36.tar.bz2
ice-f579108c1ebffc9b6f720cbdb01712e17c0c1e36.tar.xz
ice-f579108c1ebffc9b6f720cbdb01712e17c0c1e36.zip
nonmutating on the wire
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Freeze/EvictorI.cpp2
-rw-r--r--cpp/src/Ice/Incoming.cpp3
-rw-r--r--cpp/src/Ice/Object.cpp10
-rw-r--r--cpp/src/Ice/Outgoing.cpp6
-rw-r--r--cpp/src/Ice/Proxy.cpp19
-rw-r--r--cpp/src/IceStorm/Subscriber.cpp3
-rw-r--r--cpp/src/IceStorm/Subscriber.h2
-rw-r--r--cpp/src/IceStorm/TopicI.cpp6
-rw-r--r--cpp/src/slice2cpp/Gen.cpp52
9 files changed, 26 insertions, 77 deletions
diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp
index 48e7365e577..c6eed0a0db1 100644
--- a/cpp/src/Freeze/EvictorI.cpp
+++ b/cpp/src/Freeze/EvictorI.cpp
@@ -287,7 +287,7 @@ Freeze::EvictorI::finished(const ObjectAdapterPtr&, const Current& current,
//
if (_persistenceMode == SaveAfterMutatingOperation)
{
- if (servant->__isMutating(current.operation))
+ if (!current.nonmutating)
{
_db->putServant(current.identity, servant);
}
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index 39fc23c31aa..7c68ab6f888 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -30,7 +30,7 @@ void
IceInternal::Incoming::invoke()
{
Current current;
- Byte gotProxy;
+ bool gotProxy;
_is.read(gotProxy);
if (gotProxy)
{
@@ -44,6 +44,7 @@ IceInternal::Incoming::invoke()
_is.read(current.facet);
}
_is.read(current.operation);
+ _is.read(current.nonmutating);
Int sz;
_is.read(sz);
while (sz--)
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index 63a8dfa5f29..ae2cb2a71ed 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -127,16 +127,6 @@ Ice::Object::__dispatch(Incoming& in, const Current& current)
return DispatchOperationNotExist;
}
-bool
-Ice::Object::__isMutating(const std::string& s)
-{
- //
- // None of the Ice::Object operations accessible via __dispatch()
- // is mutating.
- //
- return false;
-}
-
void
Ice::Object::__write(::IceInternal::BasicStream* __os) const
{
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index 28766a05d06..e8d3860a609 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -39,7 +39,7 @@ IceInternal::NonRepeatable::get() const
}
IceInternal::Outgoing::Outgoing(const EmitterPtr& emitter, const ReferencePtr& ref, bool sendProxy,
- const char* operation, const Context& context) :
+ const char* operation, bool nonmutating, const Context& context) :
_emitter(emitter),
_reference(ref),
_state(StateUnsent),
@@ -64,19 +64,19 @@ IceInternal::Outgoing::Outgoing(const EmitterPtr& emitter, const ReferencePtr& r
}
}
+ _os.write(sendProxy);
if (sendProxy)
{
- _os.write(Byte(1));
ObjectPrx proxy = _reference->instance->proxyFactory()->referenceToProxy(_reference);
_os.write(proxy);
}
else
{
- _os.write(Byte(0));
_os.write(_reference->identity);
_os.write(_reference->facet);
}
_os.write(operation);
+ _os.write(nonmutating);
_os.write(Int(context.size()));
Context::const_iterator p;
for (p = context.begin(); p != context.end(); ++p)
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index aec89f99e5e..ab2e910dbe3 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -164,7 +164,7 @@ IceProxy::Ice::Object::ice_invoke(const string& operation,
try
{
Handle< ::IceDelegate::Ice::Object> __del = __getDelegate();
- __del->ice_invoke(operation, inParams, outParams, __context);
+ __del->ice_invoke(operation, nonmutating, inParams, outParams, __context);
return;
}
catch (const LocationForward& __ex)
@@ -518,7 +518,7 @@ IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context)
{
try
{
- Outgoing __out(__emitter, __reference, __sendProxy, "ice_isA", __context);
+ Outgoing __out(__emitter, __reference, __sendProxy, "ice_isA", true, __context);
BasicStream* __is = __out.is();
BasicStream* __os = __out.os();
__os->write(__id);
@@ -545,7 +545,7 @@ IceDelegateM::Ice::Object::ice_ping(const Context& __context)
{
try
{
- Outgoing __out(__emitter, __reference, __sendProxy, "ice_ping", __context);
+ Outgoing __out(__emitter, __reference, __sendProxy, "ice_ping", true, __context);
if (!__out.invoke())
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__);
@@ -561,6 +561,7 @@ IceDelegateM::Ice::Object::ice_ping(const Context& __context)
void
IceDelegateM::Ice::Object::ice_invoke(const string& operation,
+ bool nonmutating,
const vector<Byte>& inParams,
vector<Byte>& outParams,
const Context& __context)
@@ -570,7 +571,7 @@ IceDelegateM::Ice::Object::ice_invoke(const string& operation,
{
try
{
- Outgoing __out(__emitter, __reference, __sendProxy, operation.c_str(), __context);
+ Outgoing __out(__emitter, __reference, __sendProxy, operation.c_str(), nonmutating, __context);
BasicStream* __os = __out.os();
__os->writeBlob(inParams);
__out.invoke();
@@ -652,7 +653,7 @@ bool
IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context& __context)
{
Current __current;
- __initCurrent(__current, "ice_isA", __context);
+ __initCurrent(__current, "ice_isA", true, __context);
while (true)
{
Direct __direct(__adapter, __current);
@@ -683,7 +684,7 @@ void
IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context& __context)
{
Current __current;
- __initCurrent(__current, "ice_ping", __context);
+ __initCurrent(__current, "ice_ping", true, __context);
while (true)
{
Direct __direct(__adapter, __current);
@@ -713,12 +714,13 @@ IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context& __context)
void
IceDelegateD::Ice::Object::ice_invoke(const string& operation,
+ bool nonmutating,
const vector<Byte>& inParams,
vector<Byte>& outParams,
const ::Ice::Context& context)
{
Current __current;
- __initCurrent(__current, operation, context);
+ __initCurrent(__current, operation, nonmutating, context);
while (true)
{
Direct __direct(__adapter, __current);
@@ -758,11 +760,12 @@ IceDelegateD::Ice::Object::ice_flush()
}
void
-IceDelegateD::Ice::Object::__initCurrent(Current& current, const string& op, const Context& context)
+IceDelegateD::Ice::Object::__initCurrent(Current& current, const string& op, bool nonmutating, const Context& context)
{
current.identity = __reference->identity;
current.facet = __reference->facet;
current.operation = op;
+ current.nonmutating = nonmutating;
current.context = context;
}
diff --git a/cpp/src/IceStorm/Subscriber.cpp b/cpp/src/IceStorm/Subscriber.cpp
index 67bfb29b87f..9c31acfa1df 100644
--- a/cpp/src/IceStorm/Subscriber.cpp
+++ b/cpp/src/IceStorm/Subscriber.cpp
@@ -122,11 +122,10 @@ Subscriber::flush()
}
void
-Subscriber::publish(const string& op, const std::vector< ::Ice::Byte>& blob)
+Subscriber::publish(const string& op, bool nonmutating, const std::vector< ::Ice::Byte>& blob)
{
try
{
- bool nonmutating = true;
std::vector< ::Ice::Byte> dummy;
_obj->ice_invoke(op, nonmutating, blob, dummy);
}
diff --git a/cpp/src/IceStorm/Subscriber.h b/cpp/src/IceStorm/Subscriber.h
index 65a5acefcff..23f80679fc9 100644
--- a/cpp/src/IceStorm/Subscriber.h
+++ b/cpp/src/IceStorm/Subscriber.h
@@ -35,7 +35,7 @@ public:
void unsubscribe();
void flush();
- void publish(const std::string&, const std::vector< ::Ice::Byte>&);
+ void publish(const std::string&, bool, const std::vector< ::Ice::Byte>&);
std::string id() const;
diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp
index d1205710c6b..b5e8d340ed8 100644
--- a/cpp/src/IceStorm/TopicI.cpp
+++ b/cpp/src/IceStorm/TopicI.cpp
@@ -136,7 +136,7 @@ public:
void
- publish(const string& op, const vector< Ice::Byte>& blob)
+ publish(const string& op, bool nonmutating, const vector< Ice::Byte>& blob)
{
JTCSyncT<JTCMutex> sync(*this);
@@ -157,7 +157,7 @@ public:
for (SubscriberList::iterator i = _subscribers.begin(); i != _subscribers.end(); ++i)
{
- (*i)->publish(op, blob);
+ (*i)->publish(op, nonmutating, blob);
}
//for_each(_subscribers.begin(), _subscribers.end(), Ice::memFun(&Subscriber::publish));
}
@@ -177,7 +177,7 @@ private:
void
BlobjectI::ice_invoke(const vector< Ice::Byte>& inParams, vector< Ice::Byte>& outParam, const Ice::Current& current)
{
- _subscribers->publish(current.operation, inParams);
+ _subscribers->publish(current.operation, current.nonmutating, inParams);
}
TopicI::TopicI(const Ice::ObjectAdapterPtr& adapter, const TraceLevelsPtr& traceLevels, const Ice::LoggerPtr& logger,
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index b5728046317..5bca50ba89b 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1108,7 +1108,8 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << sb;
C << nl << "try";
C << sb;
- C << nl << "::IceInternal::Outgoing __out(__emitter, __reference, __sendProxy, \"" << name << "\", __context);";
+ C << nl << "::IceInternal::Outgoing __out(__emitter, __reference, __sendProxy, \"" << name << "\", "
+ << (p->nonmutating() ? "true" : "false") << ", __context);";
if (ret || !outParams.empty() || !throws.empty())
{
C << nl << "::IceInternal::BasicStream* __is = __out.is();";
@@ -1318,7 +1319,8 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
C << sp << nl << retS << nl << "IceDelegateD" << scoped << paramsDecl;
C << sb;
C << nl << "::Ice::Current __current;";
- C << nl << "__initCurrent(__current, \"" << name << "\", __context);";
+ C << nl << "__initCurrent(__current, \"" << name << "\", " << (p->nonmutating() ? "true" : "false")
+ << ", __context);";
C << nl << "while (true)";
C << sb;
C << nl << "::IceInternal::Direct __direct(__adapter, __current);";
@@ -1613,27 +1615,12 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
allOpNames.sort();
allOpNames.unique();
- OperationList allMutatingOps;
- remove_copy_if(allOps.begin(), allOps.end(), back_inserter(allMutatingOps),
- ::IceUtil::memFun(&Operation::nonmutating));
- StringList allMutatingOpNames;
- transform(allMutatingOps.begin(), allMutatingOps.end(), back_inserter(allMutatingOpNames),
- ::IceUtil::memFun(&Operation::name));
- // Don't add ice_isA and ice_ping. These operations are non-mutating.
- allMutatingOpNames.sort();
- allMutatingOpNames.unique();
-
StringList::const_iterator q;
H << sp;
H << nl << exp2 << "static const char* __all[" << allOpNames.size() << "];";
- if (!allMutatingOpNames.empty())
- {
- H << nl << exp2 << "static const char* __mutating[" << allMutatingOpNames.size() << "];";
- }
H << nl << exp2
<< "virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const ::Ice::Current&);";
- H << nl << exp2 << "virtual bool __isMutating(const ::std::string&);";
C << sp;
C << nl << "const char* " << scoped.substr(2) << "::__all[] =";
C << sb;
@@ -1647,22 +1634,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
}
}
C << eb << ';';
- if (!allMutatingOpNames.empty())
- {
- C << sp;
- C << nl << "const char* " << scoped.substr(2) << "::__mutating[] =";
- C << sb;
- q = allMutatingOpNames.begin();
- while (q != allMutatingOpNames.end())
- {
- C << nl << '"' << *q << '"';
- if (++q != allMutatingOpNames.end())
- {
- C << ',';
- }
- }
- C << eb << ';';
- }
C << sp;
C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2)
<< "::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)";
@@ -1690,21 +1661,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "assert(false);";
C << nl << "return ::IceInternal::DispatchOperationNotExist;";
C << eb;
- C << sp;
- C << nl << "bool" << nl << scoped.substr(2)
- << "::__isMutating(const ::std::string& s)";
- C << sb;
- if (!allMutatingOpNames.empty())
- {
- C << nl << "const char** b = __mutating;";
- C << nl << "const char** e = __mutating + " << allMutatingOpNames.size() << ';';
- C << nl << "return ::std::binary_search(b, e, s);";
- }
- else
- {
- C << nl << "return false;";
- }
- C << eb;
}
H << sp;
H << nl << exp2 << "virtual void __write(::IceInternal::BasicStream*) const;";