Home Help Center

how to implement Win32 VARIANT like mechanism?

kevinkangkevinkang Member Kevin KangOrganization: Micorcyber, IncProject: control system for IC equipment
Hi,

In my application, data array should be transfered between client and server, the data is filled in a structure including value, timestamp, quality, etc.
I think 'sequence' could be the right choice, but the data value type of each element in the array is not fixed.
Before switching to ICE, we developed apps based on Win32 DCOM, the VARIANT data type (in fact a union) meet this requirement.
I'm a newbie to ICE, anyone can give me some suggestion or hint about this case? Thanks a lot.

Regards,
Kevin

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    You could use a sequence of classes, where you use Object for the base class, or some common base class if appropriate. Without knowing more about your application its hard, however, to give concrete advise.
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    The Slice chapter in the manual explains how to use Slice classes as unions (see "Classes as Unions").

    Let us know if this does not solve your problem (but we will need a concrete example in that case).

    Cheers,

    Michi.
  • kevinkangkevinkang Member Kevin KangOrganization: Micorcyber, IncProject: control system for IC equipment
    thanks to matthew and michi, it seems that classes as unions meets my case, I'll study the manual carefully and write some code for testing. the result will be posted here later.

    cheers,
    Kevin
  • kevinkangkevinkang Member Kevin KangOrganization: Micorcyber, IncProject: control system for IC equipment
    I've wrote some code to test 'class as unions', it does work for my situation.

    additionally, to test the performance, I put thousands of elements in a sequence for one function call, it tooks no more than 50ms over LAN(TCP, VS2005, Windows Server 2003). Compare to passing structure, the performance difference seems trivial, is it truth?

    Cheers,
    Kevin
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    The performance difference depends on your the contents of your class. Different data members perform differently, and the number of data members and derivation levels also affects performance. Having said that, compared to the cost of going on the wire, the marshaling and unmarshaling cost are likely to be insignificant, so it's not a surprise that you are seeing very little performance difference, if any.

    Cheers,

    Michi.
Sign In or Register to comment.