Home Help Center

IceStorm: Publishing my own class

ShaChris23ShaChris23 Member Shiv WangOrganization: Applied Signal Technology, Inc.Project: high-performance scientific computation
Hi,

Does IceStorm support publishing my own class?

For example, I want to pubishing a topic called "BigInteger" as described here:

C++ Big Integer Library - Matt McCutchen's Web Site

I have an application that I want to publish a number that keeps growing forever (i.e. never overflows or wraps around).

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Sivesh,

    IceStorm allows you to publish any message, as long as this message is defined in Slice.

    For example, you could associate an IceStorm topic with the following interface:
    // Slice
    
    sequence<long> BigIntegerData;
    
    interface MyEvent
    {
        void sentData(BigIntegerData bigIntData);
    };
    
    

    Your publisher would transform its BigInteger objects into BigIntegerData before calling sendData, and your subscribers would transform the received BigIntegerData into BigIntegers.

    Best regards,
    Bernard
  • ShaChris23ShaChris23 Member Shiv WangOrganization: Applied Signal Technology, Inc.Project: high-performance scientific computation
    Hi Bernard,

    So essentially, I would have to:

    1) convert from an Object to a sequence of bytes (serializing it)
    2) publish the serialized data (as specified in the Slice file)
    3) have a subscriber that receives the serialized data
    4) subscriber will convert from sequence of bytes to Object (de-serializing it)
    5) and now it's ready to be used!

    I just want to confirm this is along the line of what you said.

    Note: Since I convert into sequence of bytes myself, this means I probably have to also take care of byte-endianness myself, or not?

    Thanks! :)

    S.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Shivesh,

    If you want to use bytes, you could, yes. In my example above, I used a sequence<long>: in that case, Ice would take care of reordering bytes as needed when your publisher and subscriber have different endianess.

    In Java and C#, you can pass serializable objects directly as Ice operation parameters (the Ice runtime sees just a sequence<byte>): see
    http://www.zeroc.com/doc/Ice-3.3.1/manual/Slice.5.18.html

    However, we don't have anything equivalent for C++.

    Cheers,
    Bernard
Sign In or Register to comment.