Results 1 to 7 of 7

Thread: uncompilable code generated by slice2cpp

  1. #1
    srxavi's Avatar
    srxavi is offline Registered User
    Name: Xavier Francisco
    Organization: IEEC
    Project: Robotization of an astronomic observatory
    Join Date
    Jan 2010
    Posts
    3

    uncompilable code generated by slice2cpp

    Hello everybody,

    I'm using Ice 3.3.1 as it's shipped in ubuntu 10.04 beta and I'm struck by this problem:

    I have this interface:

    Code:
    module Camera {
            enum CamStatus {IDLE, EXPOSING, READING};
            enum CoolerStatus {OFF, AT, RAMPINGUP, RAMPINGDOWN, ERROR};
            interface CameraInterface {
                idempotent int getTemp();
                idempotent int getTargetTemp();
                idempotent void setTargetTemp(int temp);
                CamStatus getStatus();
                CoolerStatus getCoolerStatus();
            };
        };
    When I use slice2cpp it generates the code and it does not complain. When I try to compile it gives me this error:

    Code:
    In file included from /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talonI.h:4,
                     from /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talonservice.cpp:4:
    /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talon.h:851: error: expected ‘,’ or ‘...’ before ‘->’ token
    /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talon.h:855: error: expected ‘,’ or ‘...’ before ‘->’ token
    /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talon.h:855: error: ‘void IceProxy::OpenROCS::Support::Talon::Camera::CameraInterface::setTargetTemp(Ice::Int)’ cannot be overloaded
    /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talon.h:851: error: with ‘void IceProxy::OpenROCS::Support::Talon::Camera::CameraInterface::setTargetTemp(Ice::Int)’
    /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talon.h: In member function ‘void IceProxy::OpenROCS::Support::Talon::Camera::CameraInterface::setTargetTemp(Ice::Int)’:
    /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talon.h:853: error: base operand of ‘->’ is not a pointer
    /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talon.h: In member function ‘void IceProxy::OpenROCS::Support::Talon::Camera::CameraInterface::setTargetTemp(Ice::Int)’:
    /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talon.h:857: error: base operand of ‘->’ is not a pointer
    /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talon.h:857: error: ‘__ctx’ was not declared in this scope
    /home/xavier/Projectes/OAdM/OpenROCS/OpenROCS-Core/src/OpenROCS-Support/Talon/talonservice.cpp: In member function ‘virtual void TalonService::start(const std::string&, const Ice::CommunicatorPtr&, const Ice::StringSeq&)’:
    If I try to compile without the
    Code:
    idempotent void setTargetTemp(int temp);
    it compiles perfectly.

    Do you know if I may be doing something wrong?

    Thanks in advance

  2. #2
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    Slice does not permit operation overloading. Have a look at the manual for details.

    However, slice2cpp should give you an error message. We will investigate this problem.

  3. #3
    srxavi's Avatar
    srxavi is offline Registered User
    Name: Xavier Francisco
    Organization: IEEC
    Project: Robotization of an astronomic observatory
    Join Date
    Jan 2010
    Posts
    3
    The problem, as I see it, is that I am not overloading a method in the interface. One is called
    Code:
    getTargetTemp()
    and the other is called
    Code:
    setTargetTemp(int temp)
    . It also fails using the stub implementations generated by the slice2cpp --impl command.

    I can put more info here if you need it.

    Thanks a lot!

  4. #4
    dwayne's Avatar
    dwayne is offline ZeroC Staff
    Name: Dwayne Boone
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Jan 2005
    Location
    St. John's, Newfoundland
    Posts
    397
    I have not been able to reproduce any compilation error with that Slice other than on Windows it does not like the fact you are using ERROR as an enum value.

    What compiler are you using? Are you using any slice2cpp options? Are there other definitions in the Slice file other than what you show or do you get error with file including just the Slice definition you show.
    Dwayne Boone

  5. #5
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    Quote Originally Posted by srxavi View Post
    The problem, as I see it, is that I am not overloading a method in the interface. One is called
    Code:
    getTargetTemp()
    and the other is called
    Code:
    setTargetTemp(int temp)
    . It also fails using the stub implementations generated by the slice2cpp --impl command.

    I can put more info here if you need it.

    Thanks a lot!
    Sorry, I misread. Anyway, Dwayne unsuccessfully tried to duplicate the problem.

  6. #6
    srxavi's Avatar
    srxavi is offline Registered User
    Name: Xavier Francisco
    Organization: IEEC
    Project: Robotization of an astronomic observatory
    Join Date
    Jan 2010
    Posts
    3
    Hello,

    I'm using gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu4) , and I'm using slice2cpp without any flags (except the first time that I used --impl to generate a stub implementation)

    Here is the full Slice definition:

    Code:
    module OpenROCS {
    module Support {
    module Talon {
    
        struct MInfo {
            double cvel;
            double cpos;
            double dpos;
            int raw;
        };
        
        enum ImageType {RAW, BIAS, DARK, FLAT};
        enum ScanStatus {NEW, DONE, FAIL};
        
        module Telescope {
            enum TelStatus {STOPPED, HUNTING, TRACKING, SLEWING, HOMING, LIMITING};
            interface TelescopeInterface {
                TelStatus getStatus();
                MInfo getHAInfo();
                MInfo getDecInfo();
                MInfo getFocusInfo();
                MInfo getFilterInfo(out string filter);
                void getCurrentRAHADec(out double ra, out double ha, out double dec);
                void getCurrentAltAz(out double alt, out double az);
                void getDesiredRAHADec(out double ra, out double ha, out double dec);
                void getDesiredAltAz(out double alt, out double az);
                int getLights();
            };
        };
        module Camera {
            enum CamStatus {IDLE, EXPOSING, READING};
            enum CoolerStatus {OFF, AT, RAMPINGUP, RAMPINGDOWN, ERROR};
            interface CameraInterface {
                idempotent int getTemp();
                idempotent int getTargetTemp();
                idempotent void setTargetTemp(int temp);
                CamStatus getStatus();
                CoolerStatus getCoolerStatus();
            };
        };
    
        module Dome {
            enum DomeStatus {ABSENT, STOPPED, ROTATING, HOMING};
            enum ShutterStatus {SHABSENT, SHIDLE, SHOPENING, SHCLOSING, SHOPEN, SHCLOSED};
            interface DomeInterface {
                double getCurrentAz();
                double getTargetAz();
                DomeStatus getDomeStatus();
                ShutterStatus getShutterStatus();
            };
        };
    
        interface Scan {
            ImageType getImageType();
            ScanStatus getStatus();
            bool isRunning();
            void getSubimage(out int sx, out int sy, out int sw, out int sh);
            void getBinning(out int bx, out int by);
            double getDuration();
            string getTitle();
            string getComment();
            string getObserver();
            long startTime();
            string getScheduleFile();
            string getImageFile();   
        };
    
        module Cover {
            enum CoverStatus {ABSENT, IDLE, OPENING, CLOSING, OPEN, CLOSED};
            interface CoverInterface {
                CoverStatus getStatus();
            };
        };
    };
    };
    };
    Again, thank you for everything!

  7. #7
    dwayne's Avatar
    dwayne is offline ZeroC Staff
    Name: Dwayne Boone
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Jan 2005
    Location
    St. John's, Newfoundland
    Posts
    397
    Sorry, I still cannot reproduce any compile error with that Slice. What is your gcc command line that produces the error?
    Dwayne Boone

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Adding docstrings to generated code?
    By Han in forum Comments
    Replies: 2
    Last Post: 01-28-2010, 12:10 PM
  2. slice2cpp generated code and Ice versions
    By phil++ in forum Help Center
    Replies: 1
    Last Post: 08-01-2008, 02:41 PM
  3. Generated C# code indentation
    By kwaclaw in forum Comments
    Replies: 1
    Last Post: 11-24-2006, 11:58 AM
  4. assert() in slice2java generated code?
    By SteveWampler in forum Help Center
    Replies: 2
    Last Post: 04-13-2004, 01:38 PM
  5. Compiling slice2cpp-generated-code on Win. XP Pro
    By catalin in forum Help Center
    Replies: 21
    Last Post: 10-29-2003, 09:56 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
  •