Archived

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

Ice-E with circular class references and lists of classes unsupported?

Hello,

I'm very excited at the prospect of using Ice-E to replace some gsoap usage on a fairly large project. Unfortunately, I have an existing class set which has two characteristics which together, I'm afraid, make it impossible to model in Ice-E.

First, it has sequences of objects. Ice-E doesn't support sequences of classes (b/c that would imply passing classes by value, in some subtle way), so I have to model everything as structs. That's too bad, since there is a lot of inheritance that now has to be modeled through has-a relationships instead of is-a relationships. That is, a sub-class will just contain an instance of its base class with some special naming convention to indicate it's really the base class.

Second, I also have many circular class references. Since Slice doesn't allow declaring structs before implementation, this is not supported, and I'm out of luck.

Is my only option to prune the class hierarchy (we're talking over 400 classes) to avoid circular references? Would it be terribly non-trivial to hack forward declarations into the mix, given that classes already support them (and the two cases seem awfully similar)? Am I missing something?

Thanks very much,
Eric

Comments

  • bernard
    bernard Jupiter, FL
    Hi Eric,

    Why do you want to use Ice-E and not Ice for this project?

    Best regards,
    Bernard
  • I want Ice-E because the client is embedded on a smallish device. I do video playback, music playback, animations, etc, with limited RAM. If I can save a couple of MB by using Ice-E, then I really want to do that.

    Is the size difference between the embedded version and full-Ice insignificant?

    Thanks,
    Eric
  • bernard
    bernard Jupiter, FL
    Hi Eric,

    Ice is very small, just not as small as Ice-E. Ice-E also offers various build-time configuration option to reduce its size.

    How much RAM do you have on these devices? If it's 128MB or more (like on an iPhone), I would start with Ice: I doubt it will use too much RAM.

    Best regards,
    Bernard
  • Bernard,

    Ok, I guess that's easier than trying to solve it with Ice-E, so it's worth a try. We do have something like 128MB, but then we try to do a few too many things with it, like push triple the pixels as an iPhone. I suppose if Ice is as fast as it is supposed to be, I can cache less to make up for code-size issues.

    Thanks for your help!
    Eric
  • Could one disable the "no sequences of classes" constraint of Ice-E?

    Hello Bernard,

    I've been trying to get full-Ice to build for my embedded platform, but the additional requirements (third party libraries especially) are somewhat onerous. I'll likely have to port some of the libraries, which is not my ideal scenario.

    All I really need to add to Ice-E is the ability to pass sequences of classes down to the client. I don't really understand why that relates to "passing classes by value" which was the reason for the limitation I saw posted elsewhere. Is there no way to pass lists of classes, other that sequences? Workarounds? All I can think is to model linked lists in Slice, but there's nothing like generic templates to work with, so that would be pretty ugly.

    My quandry is essentially:
    -a track is a media file (so we have inheritance, so it's a class)
    -there are more than one track in an album (so we pass a sequence of classes)
    ... and I'm sunk.

    I'll keep at trying to port full-Ice, but I'd really appreciate your input on this.

    Thanks again!
    Eric
  • matthew
    matthew NL, Canada
    ModEric wrote: »
    Hello Bernard,

    I've been trying to get full-Ice to build for my embedded platform, but the additional requirements (third party libraries especially) are somewhat onerous. I'll likely have to port some of the libraries, which is not my ideal scenario.
    ...

    What third party library? For plain jane Ice itself, especially if you cross compile, you don't need any third party library, other than bzip2. If you don't port bzip2, then you'll need to edit the Ice source to remove support for protocol compression. Additional features (which you probably do not need), such as SSL & Freeze requires porting additional libraries.
    My quandry is essentially:
    -a track is a media file (so we have inheritance, so it's a class)
    -there are more than one track in an album (so we pass a sequence of classes)
    ... and I'm sunk.

    What you send over the wire does not necessarily need to mirror your application classes. For example, you could model internally your data in terms of classes, but instead send structs over the wire (containing the application class data).

    Alternatively, if you want a version of Ice-E with additional features, you could sponsor these. Please contact us at sales@zeroc.com if you are interested.
  • Hi Matthew, thanks for the reply.

    "For plain jane Ice itself, especially if you cross compile, you don't need any third party library, other than bzip2."

    Are there any resources I can refer to in trying to cross compile a minimal build? I don't see any obvious config options, and my build system mastery is unfortunately incomplete.

    "...you could model internally your data in terms of classes, but instead send structs over the wire"

    I tried to massage the class hierarchy into a struct based system, but was ultimately stymied by circular struct references. Since I can't forward-declare structs (unlike classes), there is no ordering of the definitions that will prevent usage-before-definition. The only way forward there is to prune out cyclical references, but there are ~430 classes, many of which take part in circular reference relationships, so I am hesitant to dive in to that process.

    Perhaps that pruning is the best course, but I wanted to make sure I wasn't doing it for nothing.

    Thanks,
    Eric
  • matthew
    matthew NL, Canada
    ModEric wrote: »
    Hi Matthew, thanks for the reply.

    "For plain jane Ice itself, especially if you cross compile, you don't need any third party library, other than bzip2."

    Are there any resources I can refer to in trying to cross compile a minimal build? I don't see any obvious config options, and my build system mastery is unfortunately incomplete.

    Sorry, no there are no resources that I'm aware of. If you need assistance of a commercial nature you can contact us at sales@zeroc.com.