Passing BOOST arrays over CORBA
Hello all: Do any of you have experience passing BOOST vectors/arrays over CORBA? Short of writing a BOOST idl, is there a way of getting at and passing raw array data? -- --------------------------------------------------------------------- Dr. Simon Monckton Defence Scientist Tactical Vehicle Systems Section DRDC Suffield Defence Research and Development Canada Phone: (403) 544-4724 Email: Simon.Monckton@drdc-rddc.gc.ca ---------------------------------------------------------------------
"Simon Monckton" wrote:
Do any of you have experience passing BOOST vectors/arrays over CORBA? Short of writing a BOOST idl, is there a way of getting at and passing raw array data?
I am not sure what you mean by BOOST vector. You need to convert data in Boost containers into/from Corba structures, like it needs to be done for any other C++ containers. There's no explicit Corba support in Boost. /Pavel
On Tue, 2005-04-19 at 13:34, Pavel Vozenilek wrote:
"Simon Monckton" wrote:
Do any of you have experience passing BOOST vectors/arrays over CORBA? Short of writing a BOOST idl, is there a way of getting at and passing raw array data?
I am not sure what you mean by BOOST vector.
My mistake, I should be clearer. Something like boost::numeric::ublas::vector<double> aVector(4);
You need to convert data in Boost containers into/from Corba structures, like it needs to be done for any other C++ containers.
I guess the question is whether I can get at the raw data in 'aVector' and pass it out as though it was a standard Corba type such as double aCorbaVector[4]
There's no explicit Corba support in Boost.
I am trying to avoid an assignment step like: for(i=0;i<4;i++) aCorbaVector[i]=aVector[i]; In my fantasy world, I'd hoped I might be able to do something like: aCorbaVector = aVector.data(); where data() returns a pointer to the raw memory area.
/Pavel
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Simon Monckton wrote:
boost::numeric::ublas::vector<double> aVector(4);
[snip]
I am trying to avoid an assignment step like:
for(i=0;i<4;i++) aCorbaVector[i]=aVector[i];
In my fantasy world, I'd hoped I might be able to do something like:
aCorbaVector = aVector.data();
where data() returns a pointer to the raw memory area.
Although you should not depend on boost::numeric::ublas::vector<double> iterators being implemented with pointers, you could do this: // IDL typedef sequence<double> DblSeq; // C++ boost::numeric::ublas::vector<double> aVector(4) DblSeq seq; seq.replace(aVector.size(), aVector.size(), aVector.begin(), 0); The CORBA sequence also has a similar constructor. KevinH -- Kevin Heifner heifner @ ociweb.com http://heifner.blogspot.com Object Computing, Inc. (OCI) www.ociweb.com
Thanks, Kevin...thats an interesting idea! A more difficult question is: Would the same technique be possible for boost::numeric::ublas::matrix<double> aMatrix(4,4)? Simon On Tue, 2005-04-19 at 15:23, Kevin Heifner wrote:
Simon Monckton wrote:
boost::numeric::ublas::vector<double> aVector(4);
[snip]
I am trying to avoid an assignment step like:
for(i=0;i<4;i++) aCorbaVector[i]=aVector[i];
In my fantasy world, I'd hoped I might be able to do something like:
aCorbaVector = aVector.data();
where data() returns a pointer to the raw memory area.
Although you should not depend on boost::numeric::ublas::vector<double> iterators being implemented with pointers, you could do this:
// IDL typedef sequence<double> DblSeq;
// C++ boost::numeric::ublas::vector<double> aVector(4)
DblSeq seq; seq.replace(aVector.size(), aVector.size(), aVector.begin(), 0);
The CORBA sequence also has a similar constructor.
KevinH
participants (3)
-
Kevin Heifner
-
Pavel Vozenilek
-
Simon Monckton