Discussion:
[omniORB] How to push an element into an unbounded sequence?
Rajesh Khan
2011-12-21 08:24:13 UTC
Permalink
I have an interface as :
my idl file:
*typedef sequence<CustObj> CustObj_Cont;

interface TestInt {
CustObj_Cont get_obj();
void set_obj(in CustObj_Cont rx);
}; *

my cpp file:
So to create a CustObj_Cont that could be passed to set_obj I did something
like this

*CustObj obja;
obja.val =100;

CustObj objb;
objb.val =20;

::_CORBA_Unbounded_Sequence<CustObj> vctor_;*

Now here is where the problem starts if this was a vector i could have
simply done something like vctor_.push_back(obja)
but its not . so how can i push elements into an unbounded sequence?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20111220/102afd69/attachment.htm
Thomas Lockhart
2011-12-21 08:39:49 UTC
Permalink
...
Post by Rajesh Khan
but its not . so how can i push elements into an unbounded sequence?
You need to set the size and assign to a specific element afaicr.
Constructors might let you set aside space so it does not reallocate
every time.

hth

- Tom
Rajesh Khan
2011-12-21 10:41:15 UTC
Permalink
Thanks for the rly. However I am getting a debug assertion When reading the
data that was passed. Although the data is being read and displayed but i
am getting a debug assertion when i do something like

*std::cout << (*(e->get_obj()))[0].data << "\n"; *

I am sure there are no library issues. Any idea why i am getting a
*Debug assertion failed
Expression :_BLOCK_TYPE_IS_VAILD(pHead->nBlockUSe)*
Post by Rajesh Khan
...
but its not . so how can i push elements into an unbounded sequence?
You need to set the size and assign to a specific element afaicr.
Constructors might let you set aside space so it does not reallocate every
time.
hth
- Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20111220/2dc3dad6/attachment.htm
Loading...