Results 1 to 2 of 2

Thread: Requesting suggestions for how to fake polymorphic values in Ice-E

  1. #1
    bartley is offline Registered User
    Name: Chris Bartley
    Organization: Carnegie Mellon University Robotics Institute
    Project: The Telepresence Robot Kit (TeRK)
    Join Date
    Dec 2005
    Posts
    52

    Question Requesting suggestions for how to fake polymorphic values in Ice-E

    I'm trying to implement something similar to the ShapeProcessor example presented in the manual (pps 123-124), but I want to do it in Ice-E.

    The problem I've run into is Ice-E's lack of support for 1) pass-by-value for classes; and 2) sequences of objects. I'd really like to be able to do both of these in Ice-E.

    So, does anyone have a suggestion for a good way to fake it? That is, if your ShapeProcessor was running on an embedded device, what would be the best way to modify the Slice (below) for Ice-E?

    Code:
    class Shape
       {
       // Definitions for shapes, such as size, center, etc.
       };
    
    class Circle extends Shape
       {
       // Definitions for circles, such as radius...
       };
       
    class Rectangle extends Shape
       {
       // Definitions for rectangles, such as width and length...
       };
    
    sequence<Shape> ShapeSeq;
    
    interface ShapeProcessor
       {
       void processShapes(ShapeSeq ss);
       };
    If I relaxed my requirements so that I could live without sequences of objects, would that help make faking things easier? The Slice could be:

    Code:
    class Shape
       {
       // Definitions for shapes, such as size, center, etc.
       };
    
    class Circle extends Shape
       {
       // Definitions for circles, such as radius...
       };
       
    class Rectangle extends Shape
       {
       // Definitions for rectangles, such as width and length...
       };
    
    interface ShapeProcessor
       {
       void processShape(Shape s);
       };
    Any ideas? Many thanks!

    best,

    chris

  2. #2
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Chris,

    There is no simple work-around. Maybe you could use structs and sequences of structs, e.g.

    Code:
    struct Shape
    {
     // data members common to all shapes
    };
    
    struct Circle
    {
       Shape shape;
       //  Circle-specific data members
    };
    
    struct Rectangle
    {
       Shape shape;
       // Rectangle-specific data members
    };
    and then in your C++ or Java code, create wrappers that provide the desired polymorphic API.

    processShapes is the most difficult. This could work for some applications:

    Code:
    void processShapes(ShapeSeq ss, CircleSeq cs, RectangleSeq rs);
    Cheers,
    Bernard
    Bernard Normier
    ZeroC, Inc.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 05-04-2009, 07:19 PM
  2. Replies: 7
    Last Post: 03-11-2009, 11:50 AM
  3. Slashes in property values kills icegridadmin
    By ctennis in forum Bug Reports
    Replies: 8
    Last Post: 04-19-2007, 10:43 AM
  4. Windows Service suggestions
    By Powell Trusler in forum Help Center
    Replies: 5
    Last Post: 09-29-2006, 04:18 PM
  5. ICE extension suggestions....
    By ChMeessen in forum Comments
    Replies: 7
    Last Post: 09-18-2003, 03:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •