[C++-sig] Newbie : fastest way of sending floats

Benjamin Golinvaux Benjamin.Golinvaux at euresys.com
Thu Nov 20 18:04:41 CET 2003


hello
 
i have joined this list because i need to wrap a big c++ library and i
plan
to use boost.
 
i'm just at the very very beginning right now. 
i need to wrap a c++ function that takes an array a point coordinates
on the python side, they are built that way :
 
myList = [ [ 12.23 , 34.34 ] , [ 16.534, 34.8643] , ....    ]
 
right now, i wrap this function :
 
void testObject(const boost::python::object& obj)
{
	boost::python::list list(obj);
	double x,y;
	for(int i = 0; i < 5; ++i )
	{
		x =
PyFloat_AS_DOUBLE(boost::python::object(list[i][0]).ptr());
		y =
PyFloat_AS_DOUBLE(boost::python::object(list[i][1]).ptr());
		_RPT3(_CRT_WARN,"point %d = (%f,%f)\n",i,x,y);
	}
}

And it somehow works

I understand this really looks like horrible code, but these are just
very very very early tests :)

Could you please point me to some information on how to make this
cleaner...

I am not looking for the cleanest code, but for the FASTEST way to pass
the array of floats. I am willing to use the raw C api if needed.

Thanks 

Best,

Benjamin Golinvaux
www.euresys.com 
**************** 
 
The information contained in this message or any of its attachments may be privileged and confidential and intended for the exclusive use of the addressee. If you are not the addressee any disclosure, reproduction, distribution or other dissemination or use of this communication is strictly prohibited. If you have received this transmission by error please notify the sender immediately and then delete this email. 
EURESYS shall not be liable for any loss of or damage to revenues, profits, goodwill, data, information systems or other special, incidental, indirect, consequential or punitive damages of any kind arising in connection with the use of information contained in this mail or its attachments. 
Email transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. 
The sender therefore is in no way liable for any errors or omissions in the content of this message, which may arise as a result of email transmission. If verification is required, please request a hard copy. 
Please note that neither EURESYS, nor the sender accepts any responsibility for viruses and it is your responsibility to scan attachments (if any). 
**************** 
  


More information about the Cplusplus-sig mailing list