Discussion:
[omniORB] Getting sequence type to C++ vector
janarbek
2007-10-05 10:53:05 UTC
Permalink
Dear all,

As I mentioned in my previous post I want to get the sequence <short> type in my IDL to the vector in my C++ code.

typedef sequence<short> seqShort;
interface shortSeqTestServer {
void setSize(inout short size);
void acceptType(inout seqShort value);
seqShort returnType();
};


Then in C++,

vector<CORBA::Short> testPattern;
testPattern.resize(dummy, (short)5);

testPattern = (myObject->returnType());


Is this possible?





==================================================================================================================================================================
Janarbek, Researcher.
Software Robot Research Team, ETRI(Electronics and Telecommunications Research Institute)
161 Kajong-Dong, Yusong-Gu, TAEJON, 305-350, KOREA
Email : ***@etri.re.kr
Phone : 82-42-860-1838
Fax : 82-42-860-6790
Cell Phone: 82-10-8692-8103
===================================================================================================================================================================


---------------------------------
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20071004/0244ed34/attachment-0001.htm
Stefan Naewe
2007-10-05 13:53:28 UTC
Permalink
*Dear all,*
**
*As I mentioned in my previous post I want to get the sequence <short>
type in my IDL to the vector in my C++ code.*
typedef sequence<short> seqShort;
interface shortSeqTestServer {
void setSize(inout short size);
void acceptType(inout seqShort value);
seqShort returnType();
};
Then in C++,
vector<CORBA::Short> testPattern;
testPattern.resize(dummy, (short)5);
testPattern = (myObject->returnType());
*Is this possible?*
I'd say: not without a copy:

// Untested!!

seqShort* s = myObject->returnType();

CORBA::Short* first = s->get_buffer();
CORBA::Short* last = first + s->length();
std::vector<CORBA::Short> testPattern(first, last);


Regards,
Stefan
--
----------------------------------------------------------------------
Dipl.-Inform. Stefan Naewe ATLAS Elektronik GmbH
Dept.: NUS T4
phone: +49-(0)421-457-1378 Sebaldsbruecker Heerstr. 235
fax: +49-(0)421-457-3913 28305 Bremen
Continue reading on narkive:
Loading...