Archived
This forum has been archived. Please start a new discussion on GitHub.
Recognizing the type of returned inherited objects and proxies
in Help Center
Hi,
having a slice definition like:
...
class A {...};
class B extends A {...};
interface I {
A getObj();
A *getProxy();
};
...
is their any possibility to recognize at runtime (we use python) that both functions return an instance of class B and its proxy respectively? At least the proxy returned is of type A, but i need type B!
The same i need for inherited interfaces.
if not, could i manipulate the iceId (e.g. the category field which we don't use yet) of the instantiated object/proxy at server side to insert additional class information? I haven't found anything like "getIceId" within the proxies' implementations...
Thanks,
Matthias
having a slice definition like:
...
class A {...};
class B extends A {...};
interface I {
A getObj();
A *getProxy();
};
...
is their any possibility to recognize at runtime (we use python) that both functions return an instance of class B and its proxy respectively? At least the proxy returned is of type A, but i need type B!
The same i need for inherited interfaces.
if not, could i manipulate the iceId (e.g. the category field which we don't use yet) of the instantiated object/proxy at server side to insert additional class information? I haven't found anything like "getIceId" within the proxies' implementations...
Thanks,
Matthias
0
Comments
-
You can cast (either unchecked or checked) the proxy to whatever type you actually want just as the hello world python client does:
twoway = Demo.HelloPrx.checkedCast(self.communicator() ...));
In addition you can call ice_id to get the actual type of the object (or ice_ids to get all types). I suggest looking at the Ice documentation for more information.0