Type id

ganzuoniganzuoni Member Guido AnzuoniOrganization: IndividualProject: No specific project ✭✭
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

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Sure, we could do this, but what do you need it for?
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    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.
  • ganzuoniganzuoni Member Guido AnzuoniOrganization: IndividualProject: No specific project ✭✭
    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.
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    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.
  • ganzuoniganzuoni Member Guido AnzuoniOrganization: IndividualProject: No specific project ✭✭
    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.
Sign In or Register to comment.