diff options
author | Marc Laukien <marc@zeroc.com> | 2001-11-28 21:26:04 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-11-28 21:26:04 +0000 |
commit | a60d11c20942109604735dc617576dbecdc8d23b (patch) | |
tree | 3fd48680cb34d0b335248a207e93f7de227b021f /cpp/src | |
parent | todo (diff) | |
download | ice-a60d11c20942109604735dc617576dbecdc8d23b.tar.bz2 ice-a60d11c20942109604735dc617576dbecdc8d23b.tar.xz ice-a60d11c20942109604735dc617576dbecdc8d23b.zip |
started with context, current
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Freeze/EvictorI.cpp | 25 | ||||
-rw-r--r-- | cpp/src/Freeze/EvictorI.h | 5 | ||||
-rw-r--r-- | cpp/src/Ice/Direct.cpp | 22 | ||||
-rw-r--r-- | cpp/src/Ice/Incoming.cpp | 38 | ||||
-rw-r--r-- | cpp/src/Ice/Makefile | 6 | ||||
-rw-r--r-- | cpp/src/Ice/Object.cpp | 9 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/ice.dsp | 45 | ||||
-rw-r--r-- | cpp/src/IcePack/Forward.cpp | 7 | ||||
-rw-r--r-- | cpp/src/IcePack/Forward.h | 7 | ||||
-rw-r--r-- | cpp/src/IceStorm/TopicI.cpp | 10 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 10 |
12 files changed, 119 insertions, 71 deletions
diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp index b022cbe0a52..48e7365e577 100644 --- a/cpp/src/Freeze/EvictorI.cpp +++ b/cpp/src/Freeze/EvictorI.cpp @@ -162,8 +162,7 @@ Freeze::EvictorI::installServantInitializer(const ServantInitializerPtr& initial } ObjectPtr -Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const string& ident, const string&, - LocalObjectPtr& cookie) +Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const Current& current, LocalObjectPtr& cookie) { JTCSyncT<JTCMutex> sync(*this); @@ -177,13 +176,13 @@ Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const string& ident, c EvictorElementPtr element; - map<string, EvictorElementPtr>::iterator p = _evictorMap.find(ident); + map<string, EvictorElementPtr>::iterator p = _evictorMap.find(current.identity); if (p != _evictorMap.end()) { if (_trace >= 2) { ostringstream s; - s << "found \"" << ident << "\" in the queue"; + s << "found \"" << current.identity << "\" in the queue"; _db->getCommunicator()->getLogger()->trace("Evictor", s.str()); } @@ -193,7 +192,7 @@ Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const string& ident, c // element = p->second; _evictorList.erase(element->position); - _evictorList.push_front(ident); + _evictorList.push_front(current.identity); element->position = _evictorList.begin(); } else @@ -201,8 +200,8 @@ Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const string& ident, c if (_trace >= 2) { ostringstream s; - s << "couldn't find \"" << ident << "\" in the queue\n" - << "loading \"" << ident << "\" from the database"; + s << "couldn't find \"" << current.identity << "\" in the queue\n" + << "loading \"" << current.identity << "\" from the database"; _db->getCommunicator()->getLogger()->trace("Evictor", s.str()); } @@ -213,7 +212,7 @@ Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const string& ident, c ObjectPtr servant; try { - servant = _db->getServant(ident); + servant = _db->getServant(current.identity); } catch (const DBNotFoundException&) { @@ -231,14 +230,14 @@ Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const string& ident, c // // Add the new Servant to the evictor queue. // - element = add(ident, servant); + element = add(current.identity, servant); // // If an initializer is installed, call it now. // if (_initializer) { - _initializer->initialize(adapter, ident, servant); + _initializer->initialize(adapter, current.identity, servant); } } @@ -260,7 +259,7 @@ Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const string& ident, c } void -Freeze::EvictorI::finished(const ObjectAdapterPtr&, const string& ident, const string& operation, +Freeze::EvictorI::finished(const ObjectAdapterPtr&, const Current& current, const ObjectPtr& servant, const LocalObjectPtr& cookie) { JTCSyncT<JTCMutex> sync(*this); @@ -288,9 +287,9 @@ Freeze::EvictorI::finished(const ObjectAdapterPtr&, const string& ident, const s // if (_persistenceMode == SaveAfterMutatingOperation) { - if (servant->__isMutating(operation)) + if (servant->__isMutating(current.operation)) { - _db->putServant(ident, servant); + _db->putServant(current.identity, servant); } } diff --git a/cpp/src/Freeze/EvictorI.h b/cpp/src/Freeze/EvictorI.h index 97cad50540f..f07fbcf705d 100644 --- a/cpp/src/Freeze/EvictorI.h +++ b/cpp/src/Freeze/EvictorI.h @@ -37,9 +37,8 @@ public: virtual void installServantInitializer(const ServantInitializerPtr&); - virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const std::string&, const std::string&, - Ice::LocalObjectPtr&); - virtual void finished(const Ice::ObjectAdapterPtr&, const std::string&, const std::string&, + virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const Ice::Current&, Ice::LocalObjectPtr&); + virtual void finished(const Ice::ObjectAdapterPtr&, const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); virtual void deactivate(); diff --git a/cpp/src/Ice/Direct.cpp b/cpp/src/Ice/Direct.cpp index 9a9a6e9109c..f36d44f1f5d 100644 --- a/cpp/src/Ice/Direct.cpp +++ b/cpp/src/Ice/Direct.cpp @@ -20,23 +20,25 @@ using namespace Ice; using namespace IceInternal; IceInternal::Direct::Direct(const ObjectAdapterPtr& adapter, const ReferencePtr& ref, const char* operation) : - _adapter(adapter), - _reference(ref), - _operation(operation) + _adapter(adapter) { + _current.identity = ref->identity; + _current.facet = ref->facet; + _current.operation = operation; + try { - _servant = _adapter->identityToServant(_reference->identity); + _servant = _adapter->identityToServant(_current.identity); if (!_servant) { - string::size_type pos = _reference->identity.find('#'); + string::size_type pos = _current.identity.find('#'); if (pos != string::npos) { - _locator = _adapter->findServantLocator(_reference->identity.substr(0, pos)); + _locator = _adapter->findServantLocator(_current.identity.substr(0, pos)); if (_locator) { - _servant = _locator->locate(_adapter, _reference->identity, _operation, _cookie); + _servant = _locator->locate(_adapter, _current, _cookie); } } } @@ -46,7 +48,7 @@ IceInternal::Direct::Direct(const ObjectAdapterPtr& adapter, const ReferencePtr& _locator = _adapter->findServantLocator(""); if (_locator) { - _servant = _locator->locate(_adapter, _reference->identity, _operation, _cookie); + _servant = _locator->locate(_adapter, _current, _cookie); } } @@ -63,7 +65,7 @@ IceInternal::Direct::Direct(const ObjectAdapterPtr& adapter, const ReferencePtr& { if (_locator && _servant) { - _locator->finished(_adapter, _reference->identity, _operation, _servant, _cookie); + _locator->finished(_adapter, _current, _servant, _cookie); } throw; } @@ -78,7 +80,7 @@ IceInternal::Direct::~Direct() { if (_locator && _servant) { - _locator->finished(_adapter, _reference->identity, _operation, _servant, _cookie); + _locator->finished(_adapter, _current, _servant, _cookie); } } diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 276c93ad5ba..aad4c8f3e40 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -28,12 +28,10 @@ IceInternal::Incoming::Incoming(const InstancePtr& instance, const ObjectAdapter void IceInternal::Incoming::invoke() { - string identity; - _is.read(identity); - string facet; - _is.read(facet); - string operation; - _is.read(operation); + Current current; + _is.read(current.identity); + _is.read(current.facet); + _is.read(current.operation); BasicStream::Container::size_type statusPos = _os.b.size(); @@ -49,17 +47,17 @@ IceInternal::Incoming::invoke() // _is.startReadEncaps(); - servant = _adapter->identityToServant(identity); + servant = _adapter->identityToServant(current.identity); if (!servant) { - string::size_type pos = identity.find('#'); + string::size_type pos = current.identity.find('#'); if (pos != string::npos) { - locator = _adapter->findServantLocator(identity.substr(0, pos)); + locator = _adapter->findServantLocator(current.identity.substr(0, pos)); if (locator) { - servant = locator->locate(_adapter, identity, operation, cookie); + servant = locator->locate(_adapter, current, cookie); } } } @@ -69,7 +67,7 @@ IceInternal::Incoming::invoke() locator = _adapter->findServantLocator(""); if (locator) { - servant = locator->locate(_adapter, identity, operation, cookie); + servant = locator->locate(_adapter, current, cookie); } } @@ -79,9 +77,9 @@ IceInternal::Incoming::invoke() } else { - if (!facet.empty()) + if (!current.facet.empty()) { - ObjectPtr facetServant = servant->ice_findFacet(facet); + ObjectPtr facetServant = servant->ice_findFacet(current.facet); if (!facetServant) { _os.write(static_cast<Byte>(DispatchFacetNotExist)); @@ -89,7 +87,7 @@ IceInternal::Incoming::invoke() else { _os.write(static_cast<Byte>(DispatchOK)); - DispatchStatus status = facetServant->__dispatch(*this, identity, facet, operation); + DispatchStatus status = facetServant->__dispatch(*this, current); _is.checkReadEncaps(); *(_os.b.begin() + statusPos) = static_cast<Byte>(status); } @@ -97,7 +95,7 @@ IceInternal::Incoming::invoke() else { _os.write(static_cast<Byte>(DispatchOK)); - DispatchStatus status = servant->__dispatch(*this, identity, facet, operation); + DispatchStatus status = servant->__dispatch(*this, current); _is.checkReadEncaps(); *(_os.b.begin() + statusPos) = static_cast<Byte>(status); } @@ -106,7 +104,7 @@ IceInternal::Incoming::invoke() _is.endReadEncaps(); if (locator && servant) { - locator->finished(_adapter, identity, operation, servant, cookie); + locator->finished(_adapter, current, servant, cookie); } } catch (const LocationForward& ex) @@ -114,7 +112,7 @@ IceInternal::Incoming::invoke() _is.endReadEncaps(); if (locator && servant) { - locator->finished(_adapter, identity, operation, servant, cookie); + locator->finished(_adapter, current, servant, cookie); } _os.b.resize(statusPos); _os.write(static_cast<Byte>(DispatchLocationForward)); @@ -126,7 +124,7 @@ IceInternal::Incoming::invoke() _is.endReadEncaps(); if (locator && servant) { - locator->finished(_adapter, identity, operation, servant, cookie); + locator->finished(_adapter, current, servant, cookie); } _os.b.resize(statusPos); _os.write(static_cast<Byte>(DispatchUnknownLocalException)); @@ -137,7 +135,7 @@ IceInternal::Incoming::invoke() _is.endReadEncaps(); if (locator && servant) { - locator->finished(_adapter, identity, operation, servant, cookie); + locator->finished(_adapter, current, servant, cookie); } _os.b.resize(statusPos); _os.write(static_cast<Byte>(DispatchUnknownUserException)); @@ -148,7 +146,7 @@ IceInternal::Incoming::invoke() _is.endReadEncaps(); if (locator && servant) { - locator->finished(_adapter, identity, operation, servant, cookie); + locator->finished(_adapter, current, servant, cookie); } _os.b.resize(statusPos); _os.write(static_cast<Byte>(DispatchUnknownException)); diff --git a/cpp/src/Ice/Makefile b/cpp/src/Ice/Makefile index aea7fbb3307..b3f0ccfcf0e 100644 --- a/cpp/src/Ice/Makefile +++ b/cpp/src/Ice/Makefile @@ -44,6 +44,7 @@ OBJS = Application.o \ UserExceptionFactoryManager.o \ Endpoint.o \ Reference.o \ + Current.o \ LocalObject.o \ Object.o \ ProxyFactory.o \ @@ -254,4 +255,9 @@ $(HDIR)/UserExceptionFactoryF.h: $(SDIR)/UserExceptionFactoryF.ice $(SLICE2CPP) clean:: rm -f $(HDIR)/UserExceptionFactoryF.h +$(HDIR)/Current.h Current.cpp: $(SDIR)/Current.ice $(SLICE2CPP) + rm -f $(HDIR)/Current.h Current.cpp + $(SLICECMD) $(SDIR)/Current.ice + mv Current.h $(HDIR) + include .depend diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 996e575bfe8..ba62e0dbca4 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -10,6 +10,7 @@ #include <Ice/Object.h> #include <Ice/Incoming.h> +#include <Ice/Current.h> using namespace std; using namespace Ice; @@ -100,11 +101,11 @@ const char* Ice::Object::__all[] = }; DispatchStatus -Ice::Object::__dispatch(Incoming& in, const string&, const string&, const string& s) +Ice::Object::__dispatch(Incoming& in, const Current& current) { const char** b = __all; const char** e = __all + sizeof(__all) / sizeof(const char*); - pair<const char**, const char**> r = equal_range(b, e, s); + pair<const char**, const char**> r = equal_range(b, e, current.operation); if (r.first == r.second) { return DispatchOperationNotExist; @@ -245,11 +246,11 @@ Ice::Object::ice_findFacet(const string& name) } DispatchStatus -Ice::Blobject::__dispatch(Incoming& in, const string& ident, const string& facet, const string& operation) +Ice::Blobject::__dispatch(Incoming& in, const Current& current) { vector<Byte> blob; Int sz = in.is()->getReadEncapsSize(); in.is()->readBlob(blob, sz); - ice_invokeIn(ident, facet, operation, blob); + ice_invokeIn(blob, current); return ::IceInternal::DispatchOK; } diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index d7b06696567..8f75a9e2590 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -627,7 +627,11 @@ IceDelegateD::Ice::Object::ice_invokeIn(const string& operation, const vector<By } try { - __servant->ice_invokeIn(__reference->identity, __reference->facet, operation, inParams); + Current current; + current.identity = __reference->identity; + current.facet = __reference->facet; + current.operation = operation; + __servant->ice_invokeIn(inParams, current); } catch (const ::Ice::LocalException&) { diff --git a/cpp/src/Ice/ice.dsp b/cpp/src/Ice/ice.dsp index bb616c556b9..1027ad1c81a 100644 --- a/cpp/src/Ice/ice.dsp +++ b/cpp/src/Ice/ice.dsp @@ -1300,7 +1300,7 @@ BuildCmds= \ InputPath=..\..\slice\Ice\Stream.ice
BuildCmds= \
- set PATH=%PATH%;..\..\lib \
+' set PATH=%PATH%;..\..\lib \
..\..\bin\slice2cpp.exe --dll-export ICE_API --include-dir Ice -I../../slice ../../slice/Ice/Stream.ice \
move Stream.h ..\..\include\Ice \
@@ -1424,6 +1424,49 @@ InputPath=..\..\slice\Ice\UserExceptionFactoryF.ice !ENDIF
# End Source File
+# Begin Source File
+
+SOURCE=..\..\slice\Ice\Current.ice
+
+!IF "$(CFG)" == "Ice - Win32 Release"
+
+# Begin Custom Build
+InputPath=..\..\slice\Ice\Current.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\lib \
+ ..\..\bin\slice2cpp.exe --dll-export ICE_API --include-dir Ice -I../../slice ../../slice/Ice/Current.ice \
+ move Current.h ..\..\include\Ice \
+
+
+"..\..\include\Ice\Current.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Current.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Ice - Win32 Debug"
+
+# Begin Custom Build
+InputPath=..\..\slice\Ice\Current.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\lib \
+ ..\..\bin\slice2cpp.exe --dll-export ICE_API --include-dir Ice -I../../slice ../../slice/Ice/Current.ice \
+ move Current.h ..\..\include\Ice \
+
+
+"..\..\include\Ice\Current.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Current.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
# End Group
# End Target
# End Project
diff --git a/cpp/src/IcePack/Forward.cpp b/cpp/src/IcePack/Forward.cpp index 18a712d39ce..acdf45dae46 100644 --- a/cpp/src/IcePack/Forward.cpp +++ b/cpp/src/IcePack/Forward.cpp @@ -48,12 +48,12 @@ IcePack::Forward::~Forward() } ObjectPtr -IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const string& ident, const string&, LocalObjectPtr&) +IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const Current& current, LocalObjectPtr&) { // // Look up the server description // - ServerDescription desc = _admin->find(ident); + ServerDescription desc = _admin->find(current.identity); // // If we didn't find a server description, we return null, meaning @@ -159,8 +159,7 @@ IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const string& ident, c } void -IcePack::Forward::finished(const ObjectAdapterPtr&, const string&, const string&, - const ObjectPtr&, const LocalObjectPtr&) +IcePack::Forward::finished(const ObjectAdapterPtr&, const Current&, const ObjectPtr&, const LocalObjectPtr&) { // Nothing to do } diff --git a/cpp/src/IcePack/Forward.h b/cpp/src/IcePack/Forward.h index daf7d72d5e3..414272b9576 100644 --- a/cpp/src/IcePack/Forward.h +++ b/cpp/src/IcePack/Forward.h @@ -26,10 +26,9 @@ public: Forward(const Ice::CommunicatorPtr& communicator, const AdminPtr&); virtual ~Forward(); - virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const std::string&, const std::string&, - Ice::LocalObjectPtr&); - virtual void finished(const Ice::ObjectAdapterPtr&, const std::string&, const std::string&, const Ice::ObjectPtr&, - const Ice::LocalObjectPtr&); + virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const Ice::Current&, Ice::LocalObjectPtr&); + virtual void finished(const Ice::ObjectAdapterPtr&, const Ice::Current&, + const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); virtual void deactivate(); private: diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp index 8b17f4da2f1..939535375ff 100644 --- a/cpp/src/IceStorm/TopicI.cpp +++ b/cpp/src/IceStorm/TopicI.cpp @@ -41,8 +41,7 @@ public: { } - virtual void ice_invokeIn(const std::string&, const std::string&, const std::string&, - const std::vector< ::Ice::Byte>&); + virtual void ice_invokeIn(const vector< Ice::Byte>&, const Ice::Current&); private: @@ -137,7 +136,7 @@ public: void - publish(const string& op, const std::vector< ::Ice::Byte>& blob) + publish(const string& op, const vector< Ice::Byte>& blob) { JTCSyncT<JTCMutex> sync(*this); @@ -176,10 +175,9 @@ private: } // End namespace IceStorm void -BlobjectI::ice_invokeIn(const string&, const string&, const string& op, - const std::vector< ::Ice::Byte>& blob) +BlobjectI::ice_invokeIn(const vector< Ice::Byte>& blob, const Ice::Current& current) { - _subscribers->publish(op, blob); + _subscribers->publish(current.operation, blob); } 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 e73f836d3a6..54efdc5027f 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1635,8 +1635,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) { H << nl << exp2 << "static const char* __mutating[" << allMutatingOpNames.size() << "];"; } - H << nl << exp2 << "virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, " - << "const ::std::string&, const ::std::string&, const ::std::string&);"; + 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[] ="; @@ -1668,12 +1668,12 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << eb << ';'; } C << sp; - C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2) << "::__dispatch(" - << "::IceInternal::Incoming& in, const ::std::string&, const ::std::string&, const ::std::string& s)"; + C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2) + << "::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)"; C << sb; C << nl << "const char** b = __all;"; C << nl << "const char** e = __all + " << allOpNames.size() << ';'; - C << nl << "::std::pair< const char**, const char**> r = ::std::equal_range(b, e, s);"; + C << nl << "::std::pair< const char**, const char**> r = ::std::equal_range(b, e, current.operation);"; C << nl << "if (r.first == r.second)"; C << sb; C << nl << "return ::IceInternal::DispatchOperationNotExist;"; |