Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > omniorbpy: problems sending float values

Reply
Thread Tools

omniorbpy: problems sending float values

 
 
Juergen
Guest
Posts: n/a
 
      05-29-2006
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.

 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      05-29-2006
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
 
Reply With Quote
 
 
 
 
SuperHik
Guest
Posts: n/a
 
      05-29-2006
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)
 
Reply With Quote
 
Duncan Grisby
Guest
Posts: n/a
 
      05-31-2006
In article <. com>,
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 --
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
float to string to float, with first float == second float Carsten Fuchs C++ 45 10-08-2009 09:47 AM
Sending Float values... swetha C Programming 3 12-10-2007 04:16 AM
Re: sending hidden values AND option values at the same time ? Jukka K. Korpela HTML 1 09-12-2006 02:32 PM
need code to convert float format to internal java float format which is kept in 4 bytes integer Andy Java 7 05-10-2004 09:26 PM
Re: float->byte->float is same with original float image. why float->ubyte->float is different??? bd C Programming 0 07-07-2003 12:09 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57