omniorbpy: problems sending float values

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Juergen

    #1

    omniorbpy: problems sending float values

    hi,

    I've got a problem sending floating point values to an corba server.
    With other datatyes like short or string it works fine.


    So having this idl file :

    module Example{
    interface User{
    void setV( in float x );
    };
    interface Target{
    void getV( out short x);
    };
    };

    I just receive zero ( -2.58265845332e-05) by sending an float to
    another client with the above interface.
    the client :
    *************** *************** *************** *************
    import sys
    from omniORB import CORBA
    import _omnipy
    import Example, CosNaming

    orb = CORBA.ORB_init( sys.argv, CORBA.ORB_ID)



    ior = sys.argv[1]
    obj = orb.string_to_o bject(ior)

    us = obj._narrow( Example.User )

    if us is None:
    print "blabla"
    sys.exit(1)

    us.setV( 5.0 )
    *************** *************** *************** *************

    the server :
    *************** *************** *************** *************
    import sys
    from omniORB import CORBA, PortableServer
    import CosNaming, Example, Example__POA

    class User_i( Example__POA.Us er ):
    def setV( self, x ):
    print x
    print type(x)
    y = float(x)
    print y
    print type(y)


    class Target_i( Example__POA.Ta rget ):
    def getV( self ):
    return 5

    orb = CORBA.ORB_init( sys.argv, CORBA.ORB_ID)
    poa = orb.resolve_ini tial_references ("RootPOA")


    us = User_i()
    tg = Target_i()

    uo = us._this()
    to = tg._this()
    print orb.object_to_s tring(uo)
    print
    print orb.object_to_s tring(to)


    poaManager = poa._get_the_PO AManager()
    poaManager.acti vate()

    orb.run()
    *************** *************** *************** *************

    does anyone have an answer to that kind of problem?
    I mean, it just like sending short values, or strings.

  • Diez B. Roggisch

    #2
    Re: omniorbpy: problems sending float values

    Juergen wrote:
    [color=blue]
    > hi,
    >
    > I've got a problem sending floating point values to an corba server.
    > With other datatyes like short or string it works fine.[/color]

    <snip/>

    It works fine for me with floats, too. You'd better ask this on the omniorb
    ML, and don't forget to give some more details on the python & omniorb & OS
    versions you're using.

    Diez

    Comment

    • SuperHik

      #3
      Re: omniorbpy: problems sending float values

      Juergen wrote:[color=blue]
      > hi,
      >
      > I've got a problem sending floating point values to an corba server.
      > With other datatyes like short or string it works fine.
      >
      >
      > So having this idl file :
      >
      > module Example{
      > interface User{
      > void setV( in float x );
      > };
      > interface Target{
      > void getV( out short x);
      > };
      > };
      >
      > I just receive zero ( -2.58265845332e-05) by sending an float to
      > another client with the above interface.
      > the client :
      > *************** *************** *************** *************
      > import sys
      > from omniORB import CORBA
      > import _omnipy
      > import Example, CosNaming
      >
      > orb = CORBA.ORB_init( sys.argv, CORBA.ORB_ID)
      >
      >
      >
      > ior = sys.argv[1]
      > obj = orb.string_to_o bject(ior)
      >
      > us = obj._narrow( Example.User )
      >
      > if us is None:
      > print "blabla"
      > sys.exit(1)
      >
      > us.setV( 5.0 )
      > *************** *************** *************** *************
      >
      > the server :
      > *************** *************** *************** *************
      > import sys
      > from omniORB import CORBA, PortableServer
      > import CosNaming, Example, Example__POA
      >
      > class User_i( Example__POA.Us er ):
      > def setV( self, x ):
      > print x
      > print type(x)
      > y = float(x)
      > print y
      > print type(y)
      >
      >
      > class Target_i( Example__POA.Ta rget ):
      > def getV( self ):
      > return 5
      >
      > orb = CORBA.ORB_init( sys.argv, CORBA.ORB_ID)
      > poa = orb.resolve_ini tial_references ("RootPOA")
      >
      >
      > us = User_i()
      > tg = Target_i()
      >
      > uo = us._this()
      > to = tg._this()
      > print orb.object_to_s tring(uo)
      > print
      > print orb.object_to_s tring(to)
      >
      >
      > poaManager = poa._get_the_PO AManager()
      > poaManager.acti vate()
      >
      > orb.run()
      > *************** *************** *************** *************
      >
      > does anyone have an answer to that kind of problem?
      > I mean, it just like sending short values, or strings.
      >[/color]
      I never used omniorb and have no clue were's the problem,
      but if you don't find a solution just convert float into a string
      on one side and back on the other hehe =B)

      Comment

      • Duncan Grisby

        #4
        Re: omniorbpy: problems sending float values

        In article <1148914432.514 658.216050@38g2 000cwa.googlegr oups.com>,
        Juergen <juergen.eckel@ gmx.net> wrote:
        [color=blue]
        >I've got a problem sending floating point values to an corba server.
        >With other datatyes like short or string it works fine.[/color]

        Upgrade to the latest stable release, omniORB 4.0.7 and omniORBpy 2.7.
        The problem you are seeing is due to a conflict between some
        marshalling code in omniORB 4.0.6 and your compiler's use of strict
        aliasing.

        Cheers,

        Duncan.

        --
        -- Duncan Grisby --
        -- duncan@grisby.o rg --
        -- http://www.grisby.org --

        Comment

        Working...