Hi,
What's the difference between a IceUtil::Handle<> and IceInternal::Handle<> ?
The slice code generator seems to be be generating IceInternal::Handle<> typedefs for the interfaces defined in slice files.
When does one use each class? And what's the use for each?
For example, for one's own implementation of slice interfaces, which one should be used?
I am asking this, because I have defined a factory object in slice and the implementation class for the factory also derives from Ice::ServantLocator (which is a local interface - maybe inheriting from slice (remotable) interfaces and local interfaces at the same time is a no no?).
Now when I tried using IceUtil::Handle for this implementation class I kept getting a compiler error (Using BC++ 2006: [C++ Error] Handle.h(148): E2014 Member is ambiguous: 'IceInternal::GCShared::__incRef' and 'Shared::__incRef'), despite using virtual inheritance everywhere.
If I change to using IceInternal::Handle (and implementing the right incRef and decRef functions for MyClass*) the compiler was satisfied. But I am in the blind if I'm doing the right thing or not. This in particular is because I do not know which base object's __incRef/__decRef to call within the global incRef and decRef functions as below:
namespace IceInternal
{
void
IceInternal::incRef(MyClass* p)
{
//should this be called:
((Ice::Object*)p)->__incRef();
//or this:
//((Ice::ServantLocator*)p)->__incRef();
}
void
IceInternal::decRef(MyClass* p)
{
//should this be called?
((Ice::Object*)p)->__decRef();
//or this:
((Ice::ServantLocator*)p)->__decRef();
}
}
Any pointers?
Tks - Adrian.

Reply With Quote
