Home Bug Reports

uncompilable code generated by slice2cpp

srxavisrxavi Member Xavier FranciscoOrganization: IEECProject: Robotization of an astronomic observatory
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:
module Camera {
        enum CamStatus {IDLE, EXPOSING, READING};
        enum CoolerStatus {OFF, AT, RAMPINGUP, RAMPINGDOWN, ERROR};
        interface CameraInterface {
            idempotent int getTemp();
            idempotent int getTargetTemp();
            [B]idempotent void setTargetTemp(int temp);[/B]
            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:
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
idempotent void setTargetTemp(int temp);
it compiles perfectly.

Do you know if I may be doing something wrong?

Thanks in advance

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    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.
  • srxavisrxavi Member Xavier FranciscoOrganization: IEECProject: Robotization of an astronomic observatory
    The problem, as I see it, is that I am not overloading a method in the interface. One is called
    [B]get[/B]TargetTemp()
    
    and the other is called
    [B]set[/B]TargetTemp(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!
  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    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.
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    srxavi wrote: »
    The problem, as I see it, is that I am not overloading a method in the interface. One is called
    [B]get[/B]TargetTemp()
    
    and the other is called
    [B]set[/B]TargetTemp(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.
  • srxavisrxavi Member Xavier FranciscoOrganization: IEECProject: Robotization of an astronomic observatory
    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:
    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!
  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    Sorry, I still cannot reproduce any compile error with that Slice. What is your gcc command line that produces the error?
Sign In or Register to comment.