diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/doc/Makefile | 4 | ||||
-rw-r--r-- | cpp/include/Ice/Object.h | 1 | ||||
-rw-r--r-- | cpp/include/Ice/Outgoing.h | 2 | ||||
-rw-r--r-- | cpp/include/Ice/Proxy.h | 8 | ||||
-rw-r--r-- | cpp/slice/Ice/Current.ice | 8 | ||||
-rw-r--r-- | cpp/slice/Ice/LocalObject.ice | 37 | ||||
-rw-r--r-- | cpp/slice/Ice/Object.ice | 54 | ||||
-rw-r--r-- | cpp/src/Freeze/EvictorI.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Incoming.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/Object.cpp | 10 | ||||
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 19 | ||||
-rw-r--r-- | cpp/src/IceStorm/Subscriber.cpp | 3 | ||||
-rw-r--r-- | cpp/src/IceStorm/Subscriber.h | 2 | ||||
-rw-r--r-- | cpp/src/IceStorm/TopicI.cpp | 6 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 52 |
16 files changed, 40 insertions, 177 deletions
diff --git a/cpp/doc/Makefile b/cpp/doc/Makefile index cd2de9e3c9c..67a78f49bd2 100644 --- a/cpp/doc/Makefile +++ b/cpp/doc/Makefile @@ -17,9 +17,7 @@ SGMLFILES = manual.sgml \ Properties.sgml \ ReferencesEndpoints.sgml -SLICEFILES = ../slice/Ice/Object.ice \ - ../slice/Ice/LocalObject.ice \ - ../slice/Ice/LocalException.ice \ +SLICEFILES = ../slice/Ice/LocalException.ice \ ../slice/Ice/Properties.ice \ ../slice/Ice/Logger.ice \ ../slice/Ice/Stream.ice \ diff --git a/cpp/include/Ice/Object.h b/cpp/include/Ice/Object.h index e4ae12736dd..8e627cd9461 100644 --- a/cpp/include/Ice/Object.h +++ b/cpp/include/Ice/Object.h @@ -81,7 +81,6 @@ public: static const char* __all[]; virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const Current&); - virtual bool __isMutating(const std::string&); virtual void __write(::IceInternal::BasicStream*) const; virtual void __read(::IceInternal::BasicStream*); diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h index 5b117515872..948101897b7 100644 --- a/cpp/include/Ice/Outgoing.h +++ b/cpp/include/Ice/Outgoing.h @@ -50,7 +50,7 @@ class ICE_API Outgoing : public ::IceUtil::noncopyable, public JTCMonitorT< JTCM { public: - Outgoing(const EmitterPtr&, const ReferencePtr&, bool, const char*, const ::Ice::Context&); + Outgoing(const EmitterPtr&, const ReferencePtr&, bool, const char*, bool, const ::Ice::Context&); ~Outgoing(); bool invoke(); diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 720da59026b..0aa4dc8a866 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -92,7 +92,7 @@ public: virtual bool ice_isA(const std::string&, const ::Ice::Context&) = 0; virtual void ice_ping(const ::Ice::Context&) = 0; - virtual void ice_invoke(const std::string&, const std::vector< ::Ice::Byte>&, std::vector< ::Ice::Byte>&, + virtual void ice_invoke(const std::string&, bool, const std::vector< ::Ice::Byte>&, std::vector< ::Ice::Byte>&, const ::Ice::Context&) = 0; virtual void ice_flush() = 0; }; @@ -108,7 +108,7 @@ public: virtual bool ice_isA(const std::string&, const ::Ice::Context&); virtual void ice_ping(const ::Ice::Context&); - virtual void ice_invoke(const std::string&, const std::vector< ::Ice::Byte>&, std::vector< ::Ice::Byte>&, + virtual void ice_invoke(const std::string&, bool, const std::vector< ::Ice::Byte>&, std::vector< ::Ice::Byte>&, const ::Ice::Context&); virtual void ice_flush(); @@ -134,7 +134,7 @@ public: virtual bool ice_isA(const std::string&, const ::Ice::Context&); virtual void ice_ping(const ::Ice::Context&); - virtual void ice_invoke(const std::string&, const std::vector< ::Ice::Byte>&, std::vector< ::Ice::Byte>&, + virtual void ice_invoke(const std::string&, bool, const std::vector< ::Ice::Byte>&, std::vector< ::Ice::Byte>&, const ::Ice::Context&); virtual void ice_flush(); @@ -143,7 +143,7 @@ protected: ::Ice::ObjectAdapterPtr __adapter; ::IceInternal::ReferencePtr __reference; - void __initCurrent(::Ice::Current&, const std::string&, const ::Ice::Context&); + void __initCurrent(::Ice::Current&, const std::string&, bool, const ::Ice::Context&); void __initCurrentProxy(::Ice::Current&); private: diff --git a/cpp/slice/Ice/Current.ice b/cpp/slice/Ice/Current.ice index 973d5956277..01cb0518f4b 100644 --- a/cpp/slice/Ice/Current.ice +++ b/cpp/slice/Ice/Current.ice @@ -60,6 +60,14 @@ module Ice /** * + * Set to true if the operation is nonmutating. + * + * + **/ + bool \nonmutating; + + /** + * * The request context, as received from the client. * * @see Context; diff --git a/cpp/slice/Ice/LocalObject.ice b/cpp/slice/Ice/LocalObject.ice deleted file mode 100644 index 1210a2b4d39..00000000000 --- a/cpp/slice/Ice/LocalObject.ice +++ /dev/null @@ -1,37 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2001 -// MutableRealms, Inc. -// Huntsville, AL, USA -// -// All Rights Reserved -// -// ********************************************************************** - -// -// This file is not used in the Ice core. It is only for documentation -// purposes, and for tool such as <literal>slice2pythonext</literal>. -// - -#ifndef ICE_LOCAL_OBJECT_ICE -#define ICE_LOCAL_OBJECT_ICE - -module Ice -{ - -/** - * - * The base interface for all local objects in Ice. In contrast to - * [Object], no Proxies are generated for local objects, and neither - * the supporting marshaling and unmarshaling code. - * - * @see Ice::Object - * - **/ -local interface \LocalObject -{ -}; - -}; - -#endif diff --git a/cpp/slice/Ice/Object.ice b/cpp/slice/Ice/Object.ice deleted file mode 100644 index 7e2ad417692..00000000000 --- a/cpp/slice/Ice/Object.ice +++ /dev/null @@ -1,54 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2001 -// MutableRealms, Inc. -// Huntsville, AL, USA -// -// All Rights Reserved -// -// ********************************************************************** - -// -// This file is not used in the Ice core. It is only for documentation -// purposes, and for tools such as <literal>slice2pythonext</literal>. -// - -#ifndef ICE_OBJECT_ICE -#define ICE_OBJECT_ICE - -module Ice -{ - -/** - * - * The base interface for all objects in Ice. - * - * @see Ice::LocalObject - * - **/ -interface \Object -{ - /** - * - * Check whether the object is of a certain type. - * - * @param id The type id, which is the same as the fully qualified - * Slice type name. - * - * @return True, if the object is of the specified type, or false - * otherwise. - * - **/ - nonmutating bool ice_isA(string id); - - /** - * - * Check if an object is alive. - * - **/ - nonmutating void ice_ping(); -}; - -}; - -#endif 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;"; |