diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 8 | ||||
-rw-r--r-- | cpp/include/Ice/Proxy.h | 5 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 7 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 12 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.h | 2 | ||||
-rw-r--r-- | cpp/test/Ice/operations/AllTests.cpp | 4 |
8 files changed, 46 insertions, 0 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 3ea334d8d23..ff5e3728b14 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,14 @@ Changes since version 2.1.2 --------------------------- +- Added ice_communicator() to proxies. This function returns + the communicator that was used to create the proxy. + +- Added ice_toString() to proxies. This function returns + the stringified proxy. This function can be more convenient + to use than communicator->stringToProxy() because you do + not need the communicator to stringify a proxy that way. + - IceUtil/Config.h no longer includes winsock.h under WIN32. Ice can now build with WIN32_LEAN_AND_MEAN. diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 902a79daee3..46e7c0296b1 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -24,6 +24,7 @@ //#include <Ice/LocatorF.h> // Can't include RouterF.h here, otherwise we have cyclic includes #include <Ice/Current.h> #include <Ice/StreamF.h> +#include <Ice/CommunicatorF.h> namespace IceProxy { @@ -79,6 +80,10 @@ public: bool operator<(const Object&) const; ::Ice::Int ice_hash() const; + ::Ice::CommunicatorPtr ice_communicator() const; + + ::std::string ice_toString() const; + bool ice_isA(const ::std::string&); bool ice_isA(const ::std::string&, const ::Ice::Context&); void ice_ping(); diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 73c99c93176..dd31dc1daf7 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -68,6 +68,12 @@ extern bool ICE_UTIL_API nullHandleAbort; void IceInternal::incRef(Instance* p) { p->__incRef(); } void IceInternal::decRef(Instance* p) { p->__decRef(); } +CommunicatorPtr +IceInternal::Instance::communicator() const +{ + return _communicator; +} + PropertiesPtr IceInternal::Instance::properties() const { @@ -391,6 +397,7 @@ IceInternal::Instance::getDefaultContext() const IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const PropertiesPtr& properties) : + _communicator(communicator.get()), _destroyed(false), _properties(properties), _messageSizeMax(0), diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h index 2ff86dcbdbe..ca0b971282a 100644 --- a/cpp/src/Ice/Instance.h +++ b/cpp/src/Ice/Instance.h @@ -48,6 +48,7 @@ class Instance : public IceUtil::Shared, public IceUtil::RecMutex { public: + Ice::CommunicatorPtr communicator() const; Ice::PropertiesPtr properties() const; Ice::LoggerPtr logger() const; void logger(const Ice::LoggerPtr&); @@ -85,6 +86,7 @@ private: void destroy(); friend class Ice::CommunicatorI; + Ice::Communicator* _communicator; // Not a Ptr, to avoid having Instance and CommunicatorI point at each other. bool _destroyed; const Ice::PropertiesPtr _properties; // Immutable, not reset by destroy(). Ice::LoggerPtr _logger; // Not reset by destroy(). diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index ca04ffd949b..3cfb4f1e1e7 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -133,6 +133,18 @@ IceProxy::Ice::Object::ice_hash() const return _reference->hash(); } +CommunicatorPtr +IceProxy::Ice::Object::ice_communicator() const +{ + return _reference->getCommunicator(); +} + +string +IceProxy::Ice::Object::ice_toString() const +{ + return _reference->toString(); +} + bool IceProxy::Ice::Object::ice_isA(const string& __id) { diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index ae64dc783b0..ceb0e996961 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -51,6 +51,12 @@ IceInternal::Reference::defaultContext() const return r; } +CommunicatorPtr +IceInternal::Reference::getCommunicator() const +{ + return _instance->communicator(); +} + ReferencePtr IceInternal::Reference::changeContext(const Context& newContext) const { diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index 748eb6b011b..a37b94daf78 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -50,6 +50,8 @@ public: ReferencePtr defaultContext() const; + Ice::CommunicatorPtr getCommunicator() const; + virtual bool getSecure() const = 0; virtual std::vector<EndpointPtr> getEndpoints() const = 0; virtual bool getCollocationOptimization() const = 0; diff --git a/cpp/test/Ice/operations/AllTests.cpp b/cpp/test/Ice/operations/AllTests.cpp index af91e484a65..a1b713a7e30 100644 --- a/cpp/test/Ice/operations/AllTests.cpp +++ b/cpp/test/Ice/operations/AllTests.cpp @@ -23,6 +23,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) test(base); cout << "ok" << endl; + cout << "testing ice_communicator... " << flush; + test(base->ice_communicator() == communicator); + cout << "ok" << endl; + cout << "testing checked cast... " << flush; Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base); test(cl); |