summaryrefslogtreecommitdiff
path: root/cpp/include
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/include')
-rw-r--r--cpp/include/Ice/Proxy.h28
-rw-r--r--cpp/include/Ice/ProxyF.h6
-rw-r--r--cpp/include/Ice/ProxyHandle.h90
3 files changed, 74 insertions, 50 deletions
diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h
index 49175e134c0..623c22e94a1 100644
--- a/cpp/include/Ice/Proxy.h
+++ b/cpp/include/Ice/Proxy.h
@@ -35,6 +35,7 @@ class ICE_API Object : public ::IceUtil::Shared, JTCMutex
public:
bool _isA(const std::string&);
+ bool _hasFacet(const std::string&);
void _ping();
bool operator==(const Object&) const;
@@ -58,17 +59,14 @@ public:
void _flush(); // Flush batch messages
::IceInternal::ReferencePtr __reference() const;
- void __copyTo(::IceProxy::Ice::Object*) const;
+ void __copyFrom(const ::IceProxy::Ice::Object*);
+ void __copyFromWithFacet(const ::IceProxy::Ice::Object*, const std::string&);
void __handleException(const ::Ice::LocalException&, int&);
void __rethrowException(const ::Ice::LocalException&);
void __locationForward(const ::Ice::LocationForward&);
protected:
- Object();
- virtual ~Object();
- friend class ::IceInternal::ProxyFactory;
-
::IceInternal::Handle< ::IceDelegate::Ice::Object> __getDelegate();
virtual ::IceInternal::Handle< ::IceDelegateM::Ice::Object> __createDelegateM();
virtual ::IceInternal::Handle< ::IceDelegateD::Ice::Object> __createDelegateD();
@@ -76,6 +74,7 @@ protected:
private:
void setup(const ::IceInternal::ReferencePtr&);
+ friend ::IceInternal::ProxyFactory;
::IceInternal::ReferencePtr _reference;
::IceInternal::Handle< ::IceDelegate::Ice::Object> _delegate;
@@ -91,14 +90,9 @@ class ICE_API Object : public ::IceUtil::Shared
public:
virtual bool _isA(const std::string&) = 0;
+ virtual bool _hasFacet(const std::string&) = 0;
virtual void _ping() = 0;
virtual void _flush() = 0;
-
-protected:
-
- Object();
- virtual ~Object();
- friend class ::IceProxy::Ice::Object;
};
} }
@@ -111,21 +105,19 @@ class ICE_API Object : virtual public ::IceDelegate::Ice::Object
public:
virtual bool _isA(const std::string&);
+ virtual bool _hasFacet(const std::string&);
virtual void _ping();
virtual void _flush();
protected:
- Object();
- virtual ~Object();
- friend class ::IceProxy::Ice::Object;
-
::IceInternal::EmitterPtr __emitter;
::IceInternal::ReferencePtr __reference;
private:
void setup(const ::IceInternal::ReferencePtr&);
+ friend class ::IceProxy::Ice::Object;
};
} }
@@ -138,21 +130,19 @@ class ICE_API Object : virtual public ::IceDelegate::Ice::Object
public:
virtual bool _isA(const std::string&);
+ virtual bool _hasFacet(const std::string&);
virtual void _ping();
virtual void _flush();
protected:
- Object();
- virtual ~Object();
- friend class ::IceProxy::Ice::Object;
-
::Ice::ObjectAdapterPtr __adapter;
::IceInternal::ReferencePtr __reference;
private:
void setup(const ::IceInternal::ReferencePtr&, const ::Ice::ObjectAdapterPtr&);
+ friend class ::IceProxy::Ice::Object;
};
} }
diff --git a/cpp/include/Ice/ProxyF.h b/cpp/include/Ice/ProxyF.h
index 8001b4bf06b..8afd5f3425d 100644
--- a/cpp/include/Ice/ProxyF.h
+++ b/cpp/include/Ice/ProxyF.h
@@ -33,10 +33,8 @@ void ICE_API decRef(::IceDelegateM::Ice::Object*);
void ICE_API incRef(::IceDelegateD::Ice::Object*);
void ICE_API decRef(::IceDelegateD::Ice::Object*);
-void ICE_API checkedCast(::IceProxy::Ice::Object*,
- ::IceProxy::Ice::Object*&);
-void ICE_API uncheckedCast(::IceProxy::Ice::Object*,
- ::IceProxy::Ice::Object*&);
+void ICE_API checkedCast(::IceProxy::Ice::Object*, const ::std::string&, ::IceProxy::Ice::Object*&);
+void ICE_API uncheckedCast(::IceProxy::Ice::Object*, const ::std::string&, ::IceProxy::Ice::Object*&);
}
diff --git a/cpp/include/Ice/ProxyHandle.h b/cpp/include/Ice/ProxyHandle.h
index eb0880a01fb..ea428e7c7e8 100644
--- a/cpp/include/Ice/ProxyHandle.h
+++ b/cpp/include/Ice/ProxyHandle.h
@@ -11,8 +11,8 @@
#ifndef ICE_PROXY_HANDLE_H
#define ICE_PROXY_HANDLE_H
+#include <IceUtil/Handle.h>
#include <Ice/Config.h>
-#include <algorithm>
namespace IceInternal
{
@@ -23,23 +23,40 @@ namespace IceInternal
// dynamicCast().
//
template<typename T>
-class ProxyHandle
+class ProxyHandle : public ::IceUtil::HandleBase<T>
{
public:
ProxyHandle(T* p = 0)
- : _ptr(p)
{
+ _ptr = p;
+
if (_ptr)
+ {
incRef(_ptr);
+ }
}
template<typename Y>
ProxyHandle(const ProxyHandle<Y>& r)
- : _ptr(r._ptr)
{
+ _ptr = r._ptr;
+
+ if (_ptr)
+ {
+ incRef(_ptr);
+ }
+ }
+
+ template<typename Y>
+ ProxyHandle(const ::IceUtil::Handle<Y>& r)
+ {
+ _ptr = r._ptr;
+
if (_ptr)
+ {
incRef(_ptr);
+ }
}
#ifdef WIN32 // COMPILERBUG: Is VC++ or GNU C++ right here???
@@ -48,16 +65,21 @@ public:
#else
ProxyHandle(const ProxyHandle& r)
#endif
- : _ptr(r._ptr)
{
+ _ptr = r._ptr;
+
if (_ptr)
+ {
incRef(_ptr);
+ }
}
~ProxyHandle()
{
if (_ptr)
+ {
decRef(_ptr);
+ }
}
ProxyHandle& operator=(T* p)
@@ -65,10 +87,14 @@ public:
if (_ptr != p)
{
if (p)
+ {
incRef(p);
+ }
if (_ptr)
+ {
decRef(_ptr);
+ }
_ptr = p;
}
@@ -81,10 +107,34 @@ public:
if (_ptr != r._ptr)
{
if (r._ptr)
+ {
incRef(r._ptr);
+ }
if (_ptr)
+ {
decRef(_ptr);
+ }
+
+ _ptr = r._ptr;
+ }
+ return *this;
+ }
+
+ template<typename Y>
+ ProxyHandle& operator=(const ::IceUtil::Handle<Y>& r)
+ {
+ if (_ptr != r._ptr)
+ {
+ if (r._ptr)
+ {
+ incRef(r._ptr);
+ }
+
+ if (_ptr)
+ {
+ decRef(_ptr);
+ }
_ptr = r._ptr;
}
@@ -101,10 +151,14 @@ public:
if (_ptr != r._ptr)
{
if (r._ptr)
+ {
incRef(r._ptr);
+ }
if (_ptr)
+ {
decRef(_ptr);
+ }
_ptr = r._ptr;
}
@@ -112,38 +166,20 @@ public:
}
template<class Y>
- static ProxyHandle checkedCast(const ProxyHandle<Y>& r)
+ static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const std::string& f = "")
{
T* p;
- ::IceInternal::checkedCast(r._ptr, p);
+ ::IceInternal::checkedCast(r._ptr, f, p);
return ProxyHandle(p);
}
template<class Y>
- static ProxyHandle uncheckedCast(const ProxyHandle<Y>& r)
+ static ProxyHandle uncheckedCast(const ProxyHandle<Y>& r, const std::string& f = "")
{
T* p;
- ::IceInternal::uncheckedCast(r._ptr, p);
+ ::IceInternal::uncheckedCast(r._ptr, f, p);
return ProxyHandle(p);
}
-
- typedef T element_type;
-
- T* get() const { return _ptr; }
- T* operator->() const { return _ptr; }
- operator bool() const { return _ptr ? true : false; }
-
- void swap(ProxyHandle& other) { std::swap(_ptr, other._ptr); }
-
-#ifndef WIN32 // COMPILERBUG: VC++ 6.0 doesn't understand this
-
- template<typename Y> friend class ProxyHandle;
-
-protected:
-
-#endif
-
- T* _ptr;
};
template<typename T, typename U>