omniorbpy: problems sending float values

Discussion in 'Python' started by Juergen, May 29, 2006.

  1. Juergen

    Juergen Guest

    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_object(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.User ):
    def setV( self, x ):
    print x
    print type(x)
    y = float(x)
    print y
    print type(y)


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

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


    us = User_i()
    tg = Target_i()

    uo = us._this()
    to = tg._this()
    print orb.object_to_string(uo)
    print
    print orb.object_to_string(to)


    poaManager = poa._get_the_POAManager()
    poaManager.activate()

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

    does anyone have an answer to that kind of problem?
    I mean, it just like sending short values, or strings.
     
    Juergen, May 29, 2006
    #1
    1. Advertising

  2. Juergen wrote:

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


    <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
     
    Diez B. Roggisch, May 29, 2006
    #2
    1. Advertising

  3. Juergen

    SuperHik Guest

    Juergen wrote:
    > 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_object(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.User ):
    > def setV( self, x ):
    > print x
    > print type(x)
    > y = float(x)
    > print y
    > print type(y)
    >
    >
    > class Target_i( Example__POA.Target ):
    > def getV( self ):
    > return 5
    >
    > orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
    > poa = orb.resolve_initial_references("RootPOA")
    >
    >
    > us = User_i()
    > tg = Target_i()
    >
    > uo = us._this()
    > to = tg._this()
    > print orb.object_to_string(uo)
    > print
    > print orb.object_to_string(to)
    >
    >
    > poaManager = poa._get_the_POAManager()
    > poaManager.activate()
    >
    > orb.run()
    > **********************************************************
    >
    > does anyone have an answer to that kind of problem?
    > I mean, it just like sending short values, or strings.
    >

    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)
     
    SuperHik, May 29, 2006
    #3
  4. In article <>,
    Juergen <> wrote:

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


    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 --
    -- --
    -- http://www.grisby.org --
     
    Duncan Grisby, May 31, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bd
    Replies:
    0
    Views:
    660
  2. Duncan Grisby

    omniORB 4.0.2 and omniORBpy 2.2 released

    Duncan Grisby, Aug 8, 2003, in forum: Python
    Replies:
    3
    Views:
    325
    Duncan Grisby
    Aug 18, 2003
  3. Duncan Grisby

    omniORB 4.0.3 and omniORBpy 2.3 available

    Duncan Grisby, Nov 25, 2003, in forum: Python
    Replies:
    4
    Views:
    394
    Duncan Grisby
    Dec 1, 2003
  4. Replies:
    0
    Views:
    292
  5. Carsten Fuchs
    Replies:
    45
    Views:
    1,628
    James Kanze
    Oct 8, 2009
Loading...

Share This Page