Results 1 to 5 of 5

Thread: Generating code from slice includes?

  1. #1
    ctennis is offline Registered User
    Name: Caleb Tennis
    Organization: AEI
    Project: Project GINA
    Join Date
    Mar 2006
    Posts
    123

    Generating code from slice includes?

    I'm trying to put some common logic into a central .ice file that gets "included" by some of my server definitions. The problem is that there's some tedium involved because I have to run slice2cpp on each of the included files as well as on my main slice file that includes them.

    For example, if I define some kind of common structure:

    struct Datum {
    double data;
    string unit;
    };

    That I want to use between various servers:

    ..

    include <datum.ice>

    module Something {
    interface SomeServer {
    } ...
    };

    ...

    include <datum.ice>

    module Something2 {
    interface SomeOtherServer {
    };
    };

    Is there a way to tell "slice2cpp" to go ahead and run itself on any files that were "include"d in a slice definition file? The problem is that as I may be utilizing a bunch of different "datum.ice" like files for common structures between different servers and in my project files where I tell it which ice files to build it gets tedius to have to specify every single include dependency manually, particularly if some of them have includes, and some of their includes have includes, etc.

    Thanks,
    Caleb
    Caleb Tennis
    Analytical Engineering, Inc.
    http://www.aei-tech.com
    Project: Our facility infrastructure heavily utilizes Ice

    Gentoo ebuild maintainer for Ice, IceRuby, etc.

  2. #2
    n2503v is offline Registered User
    Name: Alex Makarenko
    Organization: ACFR, University of Sydney
    Project: Orca
    Join Date
    Jun 2005
    Posts
    134
    You could of course compile all slice sources at once with something like this:

    $ slice2cpp *.ice
    Alex Makarenko
    Marathon Robotics
    project: multi-robot systems

  3. #3
    matthew's Avatar
    matthew is offline ZeroC Staff
    Name: Matthew Newhook
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Feb 2003
    Location
    NL, Canada
    Posts
    1,458
    There is no way to do what you want. For that matter I'm not sure what you actually want to do. Each .ice file generates a .cpp and a .h file, so each one of these needs to be compiled also.

  4. #4
    ctennis is offline Registered User
    Name: Caleb Tennis
    Organization: AEI
    Project: Project GINA
    Join Date
    Mar 2006
    Posts
    123
    > There is no way to do what you want. For that matter I'm not sure what you actually want to do. Each .ice file generates a .cpp and a .h file, so each one of these needs to be compiled also.

    Righto. My projects basically use the .ice files and run slice2cpp on them on a fresh compile and automatically add the generated .cpp and .h files as dependencies. This way, instead of manually creating makefiles I can just create a list of the .ice files I am using for the project and my generator script does the rest.

    But obviously this fails unless I also include all of the .ice dependencies in my definition file.

    Anyway, I can work around it, but I was hoping there might be an easier way. Thanks for the comments.
    Caleb Tennis
    Analytical Engineering, Inc.
    http://www.aei-tech.com
    Project: Our facility infrastructure heavily utilizes Ice

    Gentoo ebuild maintainer for Ice, IceRuby, etc.

  5. #5
    matthew's Avatar
    matthew is offline ZeroC Staff
    Name: Matthew Newhook
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Feb 2003
    Location
    NL, Canada
    Posts
    1,458
    Why don't you use the --depend option of the slice2cpp compiler to automatically generate the dependencies?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 09-08-2009, 02:05 AM
  2. how to Load ice.slice in PHP-Code?
    By oVi in forum Help Center
    Replies: 1
    Last Post: 08-28-2009, 11:35 AM
  3. Replies: 3
    Last Post: 06-17-2009, 08:10 AM
  4. How do YOU handle redundant generated slice code?
    By ctennis in forum Help Center
    Replies: 1
    Last Post: 11-10-2006, 03:02 PM
  5. Replies: 6
    Last Post: 08-11-2005, 09:24 PM

Posting Permissions

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