omniorbpy: problems sending float values

SuperHik junkytownMAKNI at gmail.com
Mon May 29 12:17:07 EDT 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)



More information about the Python-list mailing list