Archived

This forum has been archived. Please start a new discussion on GitHub.

Type id

Hi,
it could be nice to have a way to get the type id of a slice element
instead of hard-coding the string constant in the source
(something like CORBA XXHelper.id()).

Regards,
Guido

Comments

  • marc
    marc Florida
    Sure, we could do this, but what do you need it for?
  • Re: Type id
    Originally posted by ganzuoni
    Hi,
    it could be nice to have a way to get the type id of a slice element
    instead of hard-coding the string constant in the source
    (something like CORBA XXHelper.id()).

    Regards,
    Guido

    When you say "Slice element", what do you mean? (Note that you can call ice_staticId() for classes and exceptions.)

    Cheers,

    Michi.
  • Hi,
    To Marc:
    the reason is simply avoiding hard-coding the strings, so that in case
    of module renaming you have only to recompile instead of
    search&replace (keys in Map, for example).

    To Michi:
    Oops, yes (obviously) you are right !
    Well, something similar would be nice also for interface.
    Some static constant in XX.java, for example.

    Regards,
    Guido.
  • Oops, yes (obviously) you are right !
    Well, something similar would be nice also for interface.
    Some static constant in XX.java, for example.

    You can call ice_id() on a proxy to get the interface type. Note though that this call goes remote and delivers the actual run-time type, not the static type of the proxy.

    What I don't understand is why you care about the type ID though. Normally, there is little use for the type ID in application code. (The type ID exists mainly to support the Ice run time.) So, why do you need it?

    Cheers,

    Michi.
  • Originally posted by michi
    You can call ice_id() on a proxy to get the interface type. Note though that this call goes remote and delivers the actual run-time type, not the static type of the proxy.

    What I don't understand is why you care about the type ID though. Normally, there is little use for the type ID in application code. (The type ID exists mainly to support the Ice run time.) So, why do you need it?

    Cheers,

    Michi.

    Hi,
    well, in the past (when there were no valuetypes) I made extensive use
    of XXHelper.id() to map copnverter to marshal/unmarshal (:mad: )
    CORBA struct to/from internal, CORBA-unaware, object
    (one for all, java.util.Date).
    Anyway, I think you are right, there should be no need for that.
    A useful case is in Communicator.addObjectFactory(), but, as you
    pointed out, classes have ice_staticId() ....

    Sorry for the waste of time, I'll try to be more careful in the future.

    Regards,
    Guido.