omniorbpy: problems sending float values

J

Juergen

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.
 
D

Diez B. Roggisch

Juergen said:
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
 
S

SuperHik

Juergen said:
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)
 
D

Duncan Grisby

Juergen said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top